From fca3d904c2af5c6dee79ef607e6eefbcdff346c9 Mon Sep 17 00:00:00 2001 From: David Cassany Date: Wed, 14 Feb 2024 11:58:12 +0100 Subject: [PATCH 1/3] Adapt bootlargs file to support btrfs snapshotter Signed-off-by: David Cassany --- .obs/specfile/elemental.spec | 3 +++ framework/files/etc/cos/bootargs.cfg | 26 ++++++++++++++++--- .../etc/elemental/config.d/snapshotter.yaml | 3 +++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 framework/files/etc/elemental/config.d/snapshotter.yaml diff --git a/.obs/specfile/elemental.spec b/.obs/specfile/elemental.spec index 08b1c2090..d157a584c 100644 --- a/.obs/specfile/elemental.spec +++ b/.obs/specfile/elemental.spec @@ -142,6 +142,9 @@ rm -rf %{buildroot}/usr/libexec/.placeholder %defattr(-,root,root,-) %doc README.md %license LICENSE +%dir %{_sysconfdir}/elemental +%dir %{_sysconfdir}/elemental/config.d +%config %{_sysconfdir}/elemental/config.d/snapshotter.yaml %dir %{_sysconfdir}/cos %config %{_sysconfdir}/cos/bootargs.cfg %dir %{_sysconfdir}/dracut.conf.d diff --git a/framework/files/etc/cos/bootargs.cfg b/framework/files/etc/cos/bootargs.cfg index 0f4ce9868..526339bbf 100644 --- a/framework/files/etc/cos/bootargs.cfg +++ b/framework/files/etc/cos/bootargs.cfg @@ -1,7 +1,27 @@ -set kernel=/boot/vmlinuz +# bootargs.cfg inherits from grub.cfg several context variables: +# 'img' => defines the image path to boot from. Active img is statically defined, does not require a value +# 'state_label' => label of the state partition filesystem +# 'oem_label' => label of the oem partition filesystem +# 'recovery_label' => label of the recovery partition filesystem +# 'snapshotter' => snapshotter type, assumes loopdevice type if undefined +# +# In addition bootargs.cfg is responsible of setting the following variables: +# 'kernelcmd' => essential kernel command line parameters (all elemental specific and non elemental specific) +# 'kernel' => kernel binary path within the target image +# 'initramfs' => initramfs binary path within the target image + +if [ -n "${img}" ]; then + set img_arg="elemental.image=${img}" +fi + if [ "${mode}" == "recovery" ]; then - set kernelcmd="console=tty1 root=LABEL=$recovery_label elemental.image=${img} rd.neednet=0 elemental.oemlabel=$oem_label" + set kernelcmd="console=tty1 root=LABEL=${recovery_label} ${img_arg} elemental.mode=${mode} rd.neednet=0 elemental.oemlabel=${oem_label}" else - set kernelcmd="console=tty1 root=LABEL=$state_label elemental.image=${img} panic=5 rd.neednet=0 elemental.oemlabel=$oem_label fsck.mode=force fsck.repair=yes" + if [ "${snapshotter}" == "btrfs" ]; then + set snap_arg="elemental.snapshotter=btrfs" + fi + set kernelcmd="console=tty1 root=LABEL=${state_label} ${img_arg} ${snap_arg} elemental.mode=${mode} panic=5 rd.neednet=0 elemental.oemlabel=${oem_label} fsck.mode=force fsck.repair=yes" fi + set initramfs=/boot/initrd +set kernel=/boot/vmlinuz diff --git a/framework/files/etc/elemental/config.d/snapshotter.yaml b/framework/files/etc/elemental/config.d/snapshotter.yaml new file mode 100644 index 000000000..8c4cff629 --- /dev/null +++ b/framework/files/etc/elemental/config.d/snapshotter.yaml @@ -0,0 +1,3 @@ +snapshotter: + type: btrfs + max-snaps: 4 From b0cc5e76a7ae9d3e7f4e00c2470d90a3f8da74a8 Mon Sep 17 00:00:00 2001 From: David Cassany Date: Mon, 19 Feb 2024 08:05:33 +0100 Subject: [PATCH 2/3] Include transactional update scripts and utilities Signed-off-by: David Cassany --- .obs/dockerfile/slem-base-os/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.obs/dockerfile/slem-base-os/Dockerfile b/.obs/dockerfile/slem-base-os/Dockerfile index 0a21e1210..7d9600ebe 100644 --- a/.obs/dockerfile/slem-base-os/Dockerfile +++ b/.obs/dockerfile/slem-base-os/Dockerfile @@ -44,6 +44,9 @@ RUN zypper --installroot /osimage in --no-recommends -y apparmor-parser # add elemental RUN zypper --installroot /osimage in --no-recommends -y elemental +# add transactional updates utilities +RUN zypper --installroot /osimage in --no-recommends -y transactional-update + # end of mandatory package installs for SLE Micro # make derived containers possible From 6edd43f03cad965c1d237de7c09155a477a017d4 Mon Sep 17 00:00:00 2001 From: David Cassany Date: Wed, 21 Feb 2024 12:00:12 +0100 Subject: [PATCH 3/3] Revert "Include transactional update scripts and utilities" This reverts commit a3435cf9cfb21998af8d4eebc86df1430ca1c05a. --- .obs/dockerfile/slem-base-os/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/.obs/dockerfile/slem-base-os/Dockerfile b/.obs/dockerfile/slem-base-os/Dockerfile index 7d9600ebe..0a21e1210 100644 --- a/.obs/dockerfile/slem-base-os/Dockerfile +++ b/.obs/dockerfile/slem-base-os/Dockerfile @@ -44,9 +44,6 @@ RUN zypper --installroot /osimage in --no-recommends -y apparmor-parser # add elemental RUN zypper --installroot /osimage in --no-recommends -y elemental -# add transactional updates utilities -RUN zypper --installroot /osimage in --no-recommends -y transactional-update - # end of mandatory package installs for SLE Micro # make derived containers possible