diff --git a/dracut/30ignition/ignition-ask-var-mount.service b/dracut/30ignition/ignition-ask-var-mount.service index 3a0b647..902869b 100644 --- a/dracut/30ignition/ignition-ask-var-mount.service +++ b/dracut/30ignition/ignition-ask-var-mount.service @@ -9,6 +9,7 @@ Description=Ask OSTree to mount /var in initramfs DefaultDependencies=false After=basic.target Before=ostree-prepare-root.service +Before=ignition-complete.target [Service] Type=oneshot diff --git a/dracut/30ignition/ignition-complete.target b/dracut/30ignition/ignition-complete.target new file mode 100644 index 0000000..655dd39 --- /dev/null +++ b/dracut/30ignition/ignition-complete.target @@ -0,0 +1,15 @@ +# This target is reached when Ignition finishes running. Note that it gets +# activated *only* on first boot (or if ignition.firstboot=1 is provided). +# Thus, it is also an API for units to use so that they are activated only on +# first boot. Simply add a link under ignition-complete.target.requires in the +# initrd. +[Unit] +Description=Ignition Complete + +# Make sure we stop all the units before switching root +Conflicts=initrd-switch-root.target umount.target +Conflicts=dracut-emergency.service emergency.service emergency.target + +# This ensures that we fail the boot if the stopping units fails +OnFailure=emergency.target +OnFailureJobMode=isolate diff --git a/dracut/30ignition/ignition-disks.service b/dracut/30ignition/ignition-disks.service index 50811eb..07eca47 100644 --- a/dracut/30ignition/ignition-disks.service +++ b/dracut/30ignition/ignition-disks.service @@ -1,6 +1,7 @@ [Unit] Description=Ignition (disks) DefaultDependencies=false +Before=ignition-complete.target # This stage runs between `basic.target` and `initrd-root-fs.target`, # see https://www.freedesktop.org/software/systemd/man/bootup.html @@ -12,9 +13,8 @@ After=basic.target Before=initrd-root-fs.target Before=sysroot.mount -# Require and run after ignition-setup has run because ignition-setup +# Run after ignition-setup has run because ignition-setup # may copy in new/different ignition configs for us to consume. -Requires=ignition-setup.service After=ignition-setup.service # Network may be used to fetch userdata content. diff --git a/dracut/30ignition/ignition-files.service b/dracut/30ignition/ignition-files.service index 7d4c133..cb4ee95 100644 --- a/dracut/30ignition/ignition-files.service +++ b/dracut/30ignition/ignition-files.service @@ -1,18 +1,17 @@ [Unit] Description=Ignition (files) DefaultDependencies=false +Before=ignition-complete.target # Ignition files stage starts after /sysroot is mounted. Requires=initrd-root-fs.target After=initrd-root-fs.target -# Require and run after ignition-setup has run because ignition-setup +# Run after ignition-setup has run because ignition-setup # may copy in new/different ignition configs for us to consume. -Requires=ignition-setup.service After=ignition-setup.service # Make sure root filesystem is mounted read-write -Requires=ignition-remount-sysroot.service After=ignition-remount-sysroot.service # Run before initrd-parse-etc so that we can drop files it then picks up. diff --git a/dracut/30ignition/ignition-generator b/dracut/30ignition/ignition-generator index 921f0d6..ab57b98 100755 --- a/dracut/30ignition/ignition-generator +++ b/dracut/30ignition/ignition-generator @@ -39,33 +39,7 @@ add_requires() { # starts the unit's dependencies. We want to start networking only on first # boot. if $(cmdline_bool 'ignition.firstboot' 0); then - add_requires ignition-disks.service - add_requires ignition-files.service - add_requires ignition-ask-var-mount.service - - # Write ignition-setup.service customized for PXE/ISO or regular boot - cat > ${UNIT_DIR}/ignition-setup.service <