- ignition-mount-initrd-fstab.service:

- Don't ignore errors in loops
  - Unmount mount points recursively - a new submount may have
    appeared
  - Split umount part into own service file:
- ignition-umount-initrd-fstab.service:
  - Unmounts the additional mounts as soon as they are not
    required for Ignition any more; the ExecStop operation is
    running quite late in initrd and may unmount essential mount
    points flagged with "x-initrd.mount" (e.g. when storing /usr on
    a separate mount point). In theory this will also affect
    Ignition itself, but it hasn't been reported as a problem so
    far.

OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/ignition?expand=0&rev=91
This commit is contained in:
Ignaz Forster 2022-04-06 17:10:21 +00:00 committed by Git OBS Bridge
parent 93209cb94e
commit a71d5e1ac3
7 changed files with 34 additions and 6 deletions

View File

@ -1,6 +1,6 @@
Changes for openSUSE / SLE:
* ignition-mount-initrd-fstab.service:
* ignition-mount-initrd-fstab.service / ignition-umount-initrd-fstab.service:
Upstream Ignition will only mount partitions or subvolumes explicitly
mentioned in the Ignition configuration. A default SUSE system, however,
is split over several subvolumes, and most users won't want to define

View File

@ -17,7 +17,4 @@ Before=ignition-files.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c 'eval $(awk '"'"'$4 ~ /x-initrd.mount/ && $1 !~ /^#/ {print "if ! findmnt /sysroot" $2 " >/dev/null; then mount -t " $3 " -o " $4 " " $1 " /sysroot" $2 "; fi;" }'"'"' /sysroot/etc/fstab)'
ExecStop=/bin/sh -c 'if [ -f /sysroot/etc/systemd/system-preset/20-ignition.preset ]; then while read line; do systemctl --root=/sysroot $line; done < /sysroot/etc/systemd/system-preset/20-ignition.preset; fi'
ExecStop=/usr/bin/umount -a -O "x-initrd.mount"
ExecStart=/bin/sh -e -c 'eval $(awk '"'"'$4 ~ /x-initrd.mount/ && $1 !~ /^#/ {print "if ! findmnt /sysroot" $2 " >/dev/null; then mount -t " $3 " -o " $4 " " $1 " /sysroot" $2 "; fi;" }'"'"' /sysroot/etc/fstab)'

View File

@ -9,6 +9,7 @@ set -e
. /run/ignition.env
add_requires ignition-mount-initrd-fstab.service ignition-files.service
add_requires ignition-umount-initrd-fstab.service ignition-files.service
add_requires ignition-enable-network.service ignition-fetch.service
if [ -z "${PLATFORM_ID}" ]; then

View File

@ -0,0 +1,10 @@
[Unit]
Description=Unmount initrd fstab entries for Ignition
DefaultDependencies=false
Before=ignition-complete.target
After=ignition-files.service
[Service]
Type=oneshot
ExecStart=/bin/sh -e -c 'if [ -f /sysroot/etc/systemd/system-preset/20-ignition.preset ]; then while read line; do systemctl --root=/sysroot $line; done < /sysroot/etc/systemd/system-preset/20-ignition.preset; fi'
ExecStart=/bin/sh -e -c 'eval $(awk '"'"'$4 ~ /x-initrd.mount/ && $1 !~ /^#/ {print "if findmnt /sysroot" $2 " >/dev/null; then umount -R /sysroot" $2 "; fi;" }'"'"' /sysroot/etc/fstab)'

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Apr 5 14:57:20 UTC 2022 - Ignaz Forster <iforster@suse.com>
- ignition-mount-initrd-fstab.service:
- Don't ignore errors in loops
- Unmount mount points recursively - a new submount may have
appeared
- Split umount part into own service file:
- ignition-umount-initrd-fstab.service:
- Unmounts the additional mounts as soon as they are not
required for Ignition any more; the ExecStop operation is
running quite late in initrd and may unmount essential mount
points flagged with "x-initrd.mount" (e.g. when storing /usr on
a separate mount point). In theory this will also affect
Ignition itself, but it hasn't been reported as a problem so
far.
-------------------------------------------------------------------
Mon Apr 4 17:23:10 UTC 2022 - Ignaz Forster <iforster@suse.com>

View File

@ -25,6 +25,7 @@ Group: System/Management
URL: https://github.com/coreos/ignition
Source: %{name}-%{version}.tar.xz
Source1: ignition-mount-initrd-fstab.service
Source2: ignition-umount-initrd-fstab.service
Source3: ignition-suse-generator
Source4: module-setup.sh
Source5: 02_ignition_firstboot
@ -88,7 +89,7 @@ which creates firstboot_happened after the first boot.
mkdir dracut/30ignition-microos grub systemd_suse
chmod +x %{SOURCE3} %{SOURCE4} %{SOURCE8} %{SOURCE12}
cp %{SOURCE1} %{SOURCE3} %{SOURCE4} %{SOURCE8} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE13} %{SOURCE14} dracut/30ignition-microos/
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE8} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE13} %{SOURCE14} dracut/30ignition-microos/
%ifarch aarch64 %{arm}
cp %{SOURCE21} dracut/30ignition-microos/ignition-userconfig-timeout.conf
%else

View File

@ -21,6 +21,8 @@ install() {
"$systemdsystemunitdir/ignition-enable-network.service"
inst_simple "$moddir/ignition-mount-initrd-fstab.service" \
"$systemdsystemunitdir/ignition-mount-initrd-fstab.service"
inst_simple "$moddir/ignition-umount-initrd-fstab.service" \
"$systemdsystemunitdir/ignition-umount-initrd-fstab.service"
inst_simple "$moddir/ignition-userconfig-timeout.conf" \
"$systemdsystemunitdir/dev-disk-by\x2dlabel-ignition.device.d/ignition-userconfig-timeout.conf"
inst_simple "$moddir/ignition-touch-selinux-autorelabel.conf" \