From a3bf304d654498ee4660219e7117b4a3182995d7 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Sat, 20 Apr 2024 19:18:21 -0400 Subject: [PATCH 1/2] packages-openshift: make `usermod -a -G` work on derivation This is a brutal hack for working around `usermod` not being NSS-aware. This is the same bug as https://github.com/coreos/rpm-ostree/issues/1318 but in the container flow. --- packages-openshift.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages-openshift.yaml b/packages-openshift.yaml index 74c4bff37..f28664fe9 100644 --- a/packages-openshift.yaml +++ b/packages-openshift.yaml @@ -57,7 +57,22 @@ postprocess: # that stopped working in the sysusers conversion. We should be able to drop this # when a bug gets fixed in systemd: https://github.com/openshift/os/issues/1274#issuecomment-1605507390 if [ -f /usr/lib/sysusers.d/openvswitch-hugetlbfs.conf ]; then + if [ -f /run/.containerenv ]; then + # We're running as part of a derivation; `usermod` will not work + # because it doesn't go through NSS. Hackily put the /usr/lib files + # in /etc temporarily then put them back + mv /etc/passwd /etc/passwd.bak + mv /etc/group /etc/group.bak + mv /usr/lib/passwd /etc/passwd + mv /usr/lib/group /etc/group + fi usermod -a -G hugetlbfs openvswitch + if [ -f /run/.containerenv ]; then + mv /etc/passwd /usr/lib/passwd + mv /etc/group /usr/lib/group + mv /etc/passwd.bak /etc/passwd + mv /etc/group.bak /etc/group + fi fi - | From 1872cbf2834adac26d41ae1296ba36a039bc39d6 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Wed, 13 Mar 2024 16:49:14 -0400 Subject: [PATCH 2/2] Move `/etc/motd` generation to `packages-openshift.yaml` The MOTD message is strongly associated with OpenShift, so let's make it part of `packages-openshift.yaml`. Note here that the postprocess script in `packages-openshift.yaml` is run *before* the ones in the parent manifests, which is why they have access to e.g. `OPENSHIFT_VERSION`. --- manifest-c9s.yaml | 29 +++++------------------------ manifest-rhel-9.4.yaml | 29 +++++------------------------ packages-openshift.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 48 deletions(-) diff --git a/manifest-c9s.yaml b/manifest-c9s.yaml index b05696c65..9d7641e90 100644 --- a/manifest-c9s.yaml +++ b/manifest-c9s.yaml @@ -42,8 +42,7 @@ postprocess: set -xeo pipefail # Tweak /usr/lib/os-release - grep -v "OSTREE_VERSION" /etc/os-release > /usr/lib/os-release.stream - OCP_RELEASE="4.16" + grep -v -e "OSTREE_VERSION" -e "OPENSHIFT_VERSION" /etc/os-release > /usr/lib/os-release.stream ( . /etc/os-release cat > /usr/lib/os-release < /etc/motd < /usr/lib/os-release.rhel - OCP_RELEASE="4.16" + grep -v -e "OSTREE_VERSION" -e "OPENSHIFT_VERSION" /etc/os-release > /usr/lib/os-release.rhel ( . /etc/os-release cat > /usr/lib/os-release < /etc/motd <> /usr/lib/os-release < /etc/motd <