diff --git a/TODO b/TODO index 2ef618dda9..a09db24912 100644 --- a/TODO +++ b/TODO @@ -1225,10 +1225,6 @@ Features: * fstab-generator: default to tmpfs-as-root if only usr= is specified on the kernel cmdline -* initrd-parse-etc.service: can we skip daemon-reload if /sysroot/etc/fstab is missing? - Note that we start initrd-fs.target and initrd-cleanup.target there, so a straightforward - ConditionPathExists= is not enough. - * docs: bring https://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime up to date * add a job mode that will fail if a transaction would mean stopping diff --git a/units/initrd-parse-etc.service b/units/initrd-parse-etc.service.in similarity index 56% rename from units/initrd-parse-etc.service rename to units/initrd-parse-etc.service.in index 38df728355..5ac7a24bb0 100644 --- a/units/initrd-parse-etc.service +++ b/units/initrd-parse-etc.service.in @@ -8,17 +8,24 @@ # (at your option) any later version. [Unit] -Description=Reload Configuration from the Real Root +Description=Mountpoints Configured in the Real Root +AssertPathExists=/etc/initrd-release + DefaultDependencies=no Requires=initrd-root-fs.target After=initrd-root-fs.target + OnFailure=emergency.target OnFailureJobMode=replace-irreversibly -AssertPathExists=/etc/initrd-release [Service] Type=oneshot -ExecStartPre=-systemctl daemon-reload -# we have to retrigger initrd-fs.target after daemon-reload -ExecStart=-systemctl --no-block start initrd-fs.target + +ExecStart={{ROOTLIBEXECDIR}}/systemd-sysroot-fstab-check + +# We want to enqueue initrd-cleanup.service/start after we finished the part +# above. It can't be part of the initial transaction, because non-oneshot units +# use Conflicts=initrd-cleanup.service to be terminated before we switch root. +# Effectively, initrd-parse-etc.service acts as a synchronization point after +# which cleanup of the initrd processes starts. ExecStart=systemctl --no-block start initrd-cleanup.service diff --git a/units/meson.build b/units/meson.build index 40f784ec68..2010a5566f 100644 --- a/units/meson.build +++ b/units/meson.build @@ -36,7 +36,6 @@ units = [ ['suspend-then-hibernate.target', 'ENABLE_HIBERNATE'], ['initrd-cleanup.service', 'ENABLE_INITRD'], ['initrd-fs.target', 'ENABLE_INITRD'], - ['initrd-parse-etc.service', 'ENABLE_INITRD'], ['initrd-root-device.target', 'ENABLE_INITRD'], ['initrd-root-fs.target', 'ENABLE_INITRD'], ['initrd-switch-root.service', 'ENABLE_INITRD'], @@ -179,6 +178,7 @@ in_units = [ ['emergency.service', ''], ['getty@.service', '', 'autovt@.service'], + ['initrd-parse-etc.service', 'ENABLE_INITRD'], ['kmod-static-nodes.service', 'HAVE_KMOD ENABLE_TMPFILES', 'sysinit.target.wants/'], ['quotaon.service', 'ENABLE_QUOTACHECK'],