From d9bae8d2503e0139a31ac2172b4e0b0fb94a74c9 Mon Sep 17 00:00:00 2001 From: David Cassany Date: Fri, 7 Jun 2024 15:12:37 +0200 Subject: [PATCH 1/3] Update example OSes to more recent versions Signed-off-by: David Cassany --- examples/blue/Dockerfile | 10 +- ...e-restore-compatibility-with-earlier.patch | 29 ------ ...s-split-overlayfs-mount-in-two-steps.patch | 91 ------------------- examples/orange/Dockerfile | 12 +-- ...e-restore-compatibility-with-earlier.patch | 29 ------ ...s-split-overlayfs-mount-in-two-steps.patch | 91 ------------------- 6 files changed, 3 insertions(+), 259 deletions(-) delete mode 100644 examples/blue/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch delete mode 100644 examples/blue/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch delete mode 100644 examples/orange/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch delete mode 100644 examples/orange/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch diff --git a/examples/blue/Dockerfile b/examples/blue/Dockerfile index 91c5a62f958..400a3ad9bce 100644 --- a/examples/blue/Dockerfile +++ b/examples/blue/Dockerfile @@ -4,7 +4,7 @@ ARG VERSION FROM ${TOOLKIT_REPO}:${VERSION} as TOOLKIT # OS base image of our choice -FROM fedora:39 as OS +FROM fedora:40 as OS ARG REPO ARG VERSION ENV VERSION=${VERSION} @@ -53,14 +53,6 @@ RUN mkdir -p /oem /system # Just add the elemental cli COPY --from=TOOLKIT /usr/bin/elemental /usr/bin/elemental -# This is patches are fix upstream dracut, see https://github.com/dracutdevs/dracut/pull/2525 -ADD patches / - -RUN cd /usr/lib/dracut && \ - patch -p 1 -f -i /0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch && \ - patch -p 1 -f -i /0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch && \ - rm /*.patch - # This is for automatic testing purposes, do not do this in production. RUN echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/rootlogin.conf diff --git a/examples/blue/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch b/examples/blue/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch deleted file mode 100644 index 1f9908ec2cc..00000000000 --- a/examples/blue/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0e780720efe6488c4e07af39926575ee12f40339 Mon Sep 17 00:00:00 2001 -From: Laszlo Gombos -Date: Fri, 24 Feb 2023 01:57:19 +0000 -Subject: [PATCH] fix(dmsquash-live): restore compatibility with earlier - releases - -Follow-up to 40dd5c90e0efcb9ebaa9abb42a38c7316e9706bd . ---- - modules.d/90dmsquash-live/dmsquash-live-root.sh | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh -index 62d1b5e7..a98e258c 100755 ---- a/modules.d/90dmsquash-live/dmsquash-live-root.sh -+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh -@@ -403,6 +403,10 @@ fi - - ROOTFLAGS="$(getarg rootflags)" - -+if [ "$overlayfs" = required ]; then -+ echo "rd.live.overlay.overlayfs=1" > /etc/cmdline.d/dmsquash-need-overlay.conf -+fi -+ - if [ -n "$overlayfs" ]; then - if [ -n "$FSIMG" ]; then - mkdir -m 0755 -p /run/rootfsbase --- -2.35.3 - diff --git a/examples/blue/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch b/examples/blue/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch deleted file mode 100644 index f943b05c367..00000000000 --- a/examples/blue/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch +++ /dev/null @@ -1,91 +0,0 @@ -From bddffedae038ceca263a904e40513a6e92f1b558 Mon Sep 17 00:00:00 2001 -From: David Cassany -Date: Fri, 22 Sep 2023 16:28:48 +0200 -Subject: [PATCH] fix(overlayfs): split overlayfs mount in two steps - -This commit splits the creation of required overlayfs underlaying -directories and the actual overlayfs mount. This way it is still -possible to mount the overlayfs with the generated sysroot.mount that -dmsquash-live creates. - -The overlayfs tree is created in a pre-mount hook so it is executed -before sysroot.mount is started. Otherwise sysroot.mount starts and -fails before mount hooks are executed. - -Signed-off-by: David Cassany ---- - modules.d/90overlayfs/module-setup.sh | 1 + - modules.d/90overlayfs/mount-overlayfs.sh | 13 ------------- - modules.d/90overlayfs/prepare-overlayfs.sh | 21 +++++++++++++++++++++ - 3 files changed, 22 insertions(+), 13 deletions(-) - create mode 100755 modules.d/90overlayfs/prepare-overlayfs.sh - -diff --git a/modules.d/90overlayfs/module-setup.sh b/modules.d/90overlayfs/module-setup.sh -index 27aa7cfa..893e2dc3 100755 ---- a/modules.d/90overlayfs/module-setup.sh -+++ b/modules.d/90overlayfs/module-setup.sh -@@ -15,4 +15,5 @@ installkernel() { - - install() { - inst_hook mount 01 "$moddir/mount-overlayfs.sh" -+ inst_hook pre-mount 01 "$moddir/prepare-overlayfs.sh" - } -diff --git a/modules.d/90overlayfs/mount-overlayfs.sh b/modules.d/90overlayfs/mount-overlayfs.sh -index 7e2da1a8..e1d23fb4 100755 ---- a/modules.d/90overlayfs/mount-overlayfs.sh -+++ b/modules.d/90overlayfs/mount-overlayfs.sh -@@ -3,24 +3,11 @@ - type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh - - getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes" --getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes" - getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay="" - - ROOTFLAGS="$(getarg rootflags)" - - if [ -n "$overlayfs" ]; then -- if ! [ -e /run/rootfsbase ]; then -- mkdir -m 0755 -p /run/rootfsbase -- mount --bind "$NEWROOT" /run/rootfsbase -- fi -- -- mkdir -m 0755 -p /run/overlayfs -- mkdir -m 0755 -p /run/ovlwork -- if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then -- ovlfsdir=$(readlink /run/overlayfs) -- info "Resetting the OverlayFS overlay directory." -- rm -r -- "${ovlfsdir:?}"/* "${ovlfsdir:?}"/.* > /dev/null 2>&1 -- fi - if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then - ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase - else -diff --git a/modules.d/90overlayfs/prepare-overlayfs.sh b/modules.d/90overlayfs/prepare-overlayfs.sh -new file mode 100755 -index 00000000..87bcc196 ---- /dev/null -+++ b/modules.d/90overlayfs/prepare-overlayfs.sh -@@ -0,0 +1,21 @@ -+#!/bin/sh -+ -+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -+ -+getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes" -+getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes" -+ -+if [ -n "$overlayfs" ]; then -+ if ! [ -e /run/rootfsbase ]; then -+ mkdir -m 0755 -p /run/rootfsbase -+ mount --bind "$NEWROOT" /run/rootfsbase -+ fi -+ -+ mkdir -m 0755 -p /run/overlayfs -+ mkdir -m 0755 -p /run/ovlwork -+ if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then -+ ovlfsdir=$(readlink /run/overlayfs) -+ info "Resetting the OverlayFS overlay directory." -+ rm -r -- "${ovlfsdir:?}"/* "${ovlfsdir:?}"/.* > /dev/null 2>&1 -+ fi -+fi --- -2.35.3 - diff --git a/examples/orange/Dockerfile b/examples/orange/Dockerfile index 729f025380d..969fba17ee8 100644 --- a/examples/orange/Dockerfile +++ b/examples/orange/Dockerfile @@ -4,7 +4,7 @@ ARG VERSION FROM ${TOOLKIT_REPO}:${VERSION} as TOOLKIT # OS base image of our choice -FROM ubuntu:23.04 as OS +FROM ubuntu:24.04 as OS ARG REPO ARG VERSION ENV VERSION=${VERSION} @@ -61,14 +61,6 @@ RUN mkdir -p /oem /system # Just add the elemental cli COPY --from=TOOLKIT /usr/bin/elemental /usr/bin/elemental -# This is patches are fix upstream dracut, see https://github.com/dracutdevs/dracut/pull/2525 -ADD patches / - -RUN cd /usr/lib/dracut && \ - patch -p 1 -f -i /0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch && \ - patch -p 1 -f -i /0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch && \ - rm /*.patch - # Enable essential services RUN systemctl enable systemd-networkd.service @@ -95,7 +87,7 @@ ADD 05_network.yaml /system/oem/05_network.yaml # Arrange bootloader binaries into /usr/lib/elemental/bootloader # this way elemental installer can easily fetch them RUN mkdir -p /usr/lib/elemental/bootloader && \ - cp /usr/lib/grub/x86_64-efi-signed/gcdx64.efi.signed /usr/lib/elemental/bootloader/grubx64.efi && \ + cp /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed /usr/lib/elemental/bootloader/grubx64.efi && \ cp /usr/lib/shim/shimx64.efi.signed.latest /usr/lib/elemental/bootloader/shimx64.efi && \ cp /usr/lib/shim/mmx64.efi /usr/lib/elemental/bootloader/mmx64.efi diff --git a/examples/orange/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch b/examples/orange/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch deleted file mode 100644 index 1f9908ec2cc..00000000000 --- a/examples/orange/patches/0001-fix-dmsquash-live-restore-compatibility-with-earlier.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0e780720efe6488c4e07af39926575ee12f40339 Mon Sep 17 00:00:00 2001 -From: Laszlo Gombos -Date: Fri, 24 Feb 2023 01:57:19 +0000 -Subject: [PATCH] fix(dmsquash-live): restore compatibility with earlier - releases - -Follow-up to 40dd5c90e0efcb9ebaa9abb42a38c7316e9706bd . ---- - modules.d/90dmsquash-live/dmsquash-live-root.sh | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh -index 62d1b5e7..a98e258c 100755 ---- a/modules.d/90dmsquash-live/dmsquash-live-root.sh -+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh -@@ -403,6 +403,10 @@ fi - - ROOTFLAGS="$(getarg rootflags)" - -+if [ "$overlayfs" = required ]; then -+ echo "rd.live.overlay.overlayfs=1" > /etc/cmdline.d/dmsquash-need-overlay.conf -+fi -+ - if [ -n "$overlayfs" ]; then - if [ -n "$FSIMG" ]; then - mkdir -m 0755 -p /run/rootfsbase --- -2.35.3 - diff --git a/examples/orange/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch b/examples/orange/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch deleted file mode 100644 index f943b05c367..00000000000 --- a/examples/orange/patches/0001-fix-overlayfs-split-overlayfs-mount-in-two-steps.patch +++ /dev/null @@ -1,91 +0,0 @@ -From bddffedae038ceca263a904e40513a6e92f1b558 Mon Sep 17 00:00:00 2001 -From: David Cassany -Date: Fri, 22 Sep 2023 16:28:48 +0200 -Subject: [PATCH] fix(overlayfs): split overlayfs mount in two steps - -This commit splits the creation of required overlayfs underlaying -directories and the actual overlayfs mount. This way it is still -possible to mount the overlayfs with the generated sysroot.mount that -dmsquash-live creates. - -The overlayfs tree is created in a pre-mount hook so it is executed -before sysroot.mount is started. Otherwise sysroot.mount starts and -fails before mount hooks are executed. - -Signed-off-by: David Cassany ---- - modules.d/90overlayfs/module-setup.sh | 1 + - modules.d/90overlayfs/mount-overlayfs.sh | 13 ------------- - modules.d/90overlayfs/prepare-overlayfs.sh | 21 +++++++++++++++++++++ - 3 files changed, 22 insertions(+), 13 deletions(-) - create mode 100755 modules.d/90overlayfs/prepare-overlayfs.sh - -diff --git a/modules.d/90overlayfs/module-setup.sh b/modules.d/90overlayfs/module-setup.sh -index 27aa7cfa..893e2dc3 100755 ---- a/modules.d/90overlayfs/module-setup.sh -+++ b/modules.d/90overlayfs/module-setup.sh -@@ -15,4 +15,5 @@ installkernel() { - - install() { - inst_hook mount 01 "$moddir/mount-overlayfs.sh" -+ inst_hook pre-mount 01 "$moddir/prepare-overlayfs.sh" - } -diff --git a/modules.d/90overlayfs/mount-overlayfs.sh b/modules.d/90overlayfs/mount-overlayfs.sh -index 7e2da1a8..e1d23fb4 100755 ---- a/modules.d/90overlayfs/mount-overlayfs.sh -+++ b/modules.d/90overlayfs/mount-overlayfs.sh -@@ -3,24 +3,11 @@ - type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh - - getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes" --getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes" - getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay="" - - ROOTFLAGS="$(getarg rootflags)" - - if [ -n "$overlayfs" ]; then -- if ! [ -e /run/rootfsbase ]; then -- mkdir -m 0755 -p /run/rootfsbase -- mount --bind "$NEWROOT" /run/rootfsbase -- fi -- -- mkdir -m 0755 -p /run/overlayfs -- mkdir -m 0755 -p /run/ovlwork -- if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then -- ovlfsdir=$(readlink /run/overlayfs) -- info "Resetting the OverlayFS overlay directory." -- rm -r -- "${ovlfsdir:?}"/* "${ovlfsdir:?}"/.* > /dev/null 2>&1 -- fi - if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then - ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase - else -diff --git a/modules.d/90overlayfs/prepare-overlayfs.sh b/modules.d/90overlayfs/prepare-overlayfs.sh -new file mode 100755 -index 00000000..87bcc196 ---- /dev/null -+++ b/modules.d/90overlayfs/prepare-overlayfs.sh -@@ -0,0 +1,21 @@ -+#!/bin/sh -+ -+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -+ -+getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes" -+getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes" -+ -+if [ -n "$overlayfs" ]; then -+ if ! [ -e /run/rootfsbase ]; then -+ mkdir -m 0755 -p /run/rootfsbase -+ mount --bind "$NEWROOT" /run/rootfsbase -+ fi -+ -+ mkdir -m 0755 -p /run/overlayfs -+ mkdir -m 0755 -p /run/ovlwork -+ if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then -+ ovlfsdir=$(readlink /run/overlayfs) -+ info "Resetting the OverlayFS overlay directory." -+ rm -r -- "${ovlfsdir:?}"/* "${ovlfsdir:?}"/.* > /dev/null 2>&1 -+ fi -+fi --- -2.35.3 - From 040c05dd076595088f1ea0eb6c4b84505023a85e Mon Sep 17 00:00:00 2001 From: David Cassany Date: Fri, 7 Jun 2024 15:13:14 +0200 Subject: [PATCH 2/3] Always run tests for all distros Signed-off-by: David Cassany --- .github/workflows/build.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1cef1e806b1..21a197e1041 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,11 +28,7 @@ jobs: steps: - id: set-matrix run: | - if [ "${{ contains(github.event.pull_request.labels.*.name, 'all-distros') }}" == "true" ]; then - echo "flavor=['green', 'blue', 'orange']" >> $GITHUB_OUTPUT - else - echo "flavor=['green']" >> $GITHUB_OUTPUT - fi + echo "flavor=['green', 'blue', 'orange']" >> $GITHUB_OUTPUT - id: set-platform run: | if [ "${{ startsWith(github.event.ref, 'refs/tags/v') }}" == "true" ]; then From 89b9f7e5cca0ebfb72c7c8b5aa7b4a20994a26cf Mon Sep 17 00:00:00 2001 From: David Cassany Date: Fri, 7 Jun 2024 17:45:46 +0200 Subject: [PATCH 3/3] Fix smoke test for orange flavor Signed-off-by: David Cassany --- examples/orange/Dockerfile | 7 +++++++ tests/smoke/smoke_test.go | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/examples/orange/Dockerfile b/examples/orange/Dockerfile index 969fba17ee8..62af7d71f35 100644 --- a/examples/orange/Dockerfile +++ b/examples/orange/Dockerfile @@ -49,9 +49,16 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins patch \ netplan.io \ locales \ + kbd \ podman \ xz-utils +# Hack to prevent systemd-firstboot failures while setting keymap, this is known +# Debian issue (T_T) https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790955 +ARG KBD=2.6.4 +RUN curl -L https://mirrors.edge.kernel.org/pub/linux/utils/kbd/kbd-${KBD}.tar.xz --output kbd-${KBD}.tar.xz && \ + tar xaf kbd-${KBD}.tar.xz && mkdir -p /usr/share/keymaps && cp -Rp kbd-${KBD}/data/keymaps/* /usr/share/keymaps/ + # Symlink grub2-editenv RUN ln -sf /usr/bin/grub-editenv /usr/bin/grub2-editenv diff --git a/tests/smoke/smoke_test.go b/tests/smoke/smoke_test.go index 5bb5256dc94..700a50c6c4f 100644 --- a/tests/smoke/smoke_test.go +++ b/tests/smoke/smoke_test.go @@ -19,6 +19,7 @@ package elemental_test import ( "fmt" "math/rand" + "strings" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -100,10 +101,21 @@ var _ = Describe("Elemental Smoke tests", func() { }) It("has default localectl configuration from cloud-init", func() { - out, err := s.Command("localectl status") + var isUbuntu bool + + out, err := s.Command("source /etc/os-release && echo $NAME") + Expect(err).ToNot(HaveOccurred()) + if strings.Contains(out, "Ubuntu") { + isUbuntu = true + } + + out, err = s.Command("localectl status") Expect(err).ToNot(HaveOccurred()) Expect(out).Should(ContainSubstring("LANG=en_US.UTF-8")) - Expect(out).Should(ContainSubstring("VC Keymap: us")) + if !isUbuntu { + // Setting keymap is not supported in Debian via systemd (localectl) + Expect(out).Should(ContainSubstring("VC Keymap: us")) + } }) }) })