]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units/initrd-cleanup.service: Conflict with emergency.target
authorFabian Vogt <fvogt@suse.de>
Tue, 8 Jul 2025 11:02:47 +0000 (13:02 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 9 Jul 2025 08:28:29 +0000 (10:28 +0200)
This is very similar to 327cd2d3db703555f8d572b4cd055fbe55e1068b:

If emergency.target is started while initrd-cleanup.service/start is queued,
the initrd-cleanup job did not get canceled. In parallel to the emergency
units, it eventually runs the service, which in turn isolates and starts
initrd-switch-root.target. This stops the emergency units and effectively
starts the initrd boot process again, which likely fails again like the
initial attempt. The system is thus stuck in a loop, never really reaching
emergency.target.

This can be triggered if a service in between initrd-parse-etc.service
and initrd.target fails.

With this conflict added, starting emergency.target automatically cancels
initrd-cleanup.service/start, avoiding the loop.

units/initrd-cleanup.service

index 08ab5039627fc693abfd4d500f88baac5ebc5879..cfe7b4cb0248a7744fe7a45dd2bf72d2cc4af2be 100644 (file)
@@ -14,6 +14,7 @@ AssertPathExists=/etc/initrd-release
 OnFailure=emergency.target
 OnFailureJobMode=replace-irreversibly
 After=initrd-root-fs.target initrd-fs.target initrd.target
+Conflicts=emergency.target
 
 [Service]
 Type=oneshot