summaryrefslogtreecommitdiff
path: root/units
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-09-14 12:39:10 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-09-15 14:59:11 +0200
commit7c0e2b555968d70ac563a37e32a6931ee90961a6 (patch)
treea7262ff4b30c99fa410111e4505711c6e34d2c18 /units
parentd5fd07cdeef104fdf4e1e1f9e60ff7ccb4669623 (diff)
downloadsystemd-7c0e2b555968d70ac563a37e32a6931ee90961a6.tar.gz
units: add ordering dependencies on initrd-switch-root.target
For shutdown, we queue shutdown.target/start, so in every unit which should be stopped *before* shutdown, we need both Conflicts and an ordering dependency with shutdown.target (either Before= or After= would work, because stop jobs are always ordered before start jobs). For initrd transition, we queue initrd-switch-root.service/isolate. This automatically creates a /stop job for every running unit without IgnoreOnIsolate. But no ordering dependency is created, unless the unit has a (possibly transitive) ordering dependency on initrd-switch-root.service. Since most units must stop before the transition, we should add the ordering dependency. It is nicer to use Before=initrd-switch-root.target for this. initrd-switch-root.target is ordered before initrd-switch-root.service, so the effect it the same when both are in a transaction. Fixes #23745. To also cover the case where somebody is emergency mode in the initrd and queues initrd-switch-root.service/start (not isolate), also add Conflicts=initrd-switch-root.target, so various units are stopped properly. This extends 2525682565b372b9b83c848bfe89c025fed47a1d to cover all the other services that are touched. It could be consider "operator error", but it's easy to make and it's nicer if we can make this more foolproof.
Diffstat (limited to 'units')
-rw-r--r--units/ldconfig.service4
-rw-r--r--units/systemd-ask-password-console.service4
-rw-r--r--units/systemd-boot-system-token.service4
-rw-r--r--units/systemd-network-generator.service.in4
-rw-r--r--units/systemd-sysext.service4
-rw-r--r--units/systemd-sysusers.service4
-rw-r--r--units/systemd-tmpfiles-clean.service4
-rw-r--r--units/systemd-tmpfiles-setup-dev.service4
-rw-r--r--units/systemd-tmpfiles-setup.service4
9 files changed, 18 insertions, 18 deletions
diff --git a/units/ldconfig.service b/units/ldconfig.service
index cb887ae865..53c6d4ecb1 100644
--- a/units/ldconfig.service
+++ b/units/ldconfig.service
@@ -17,8 +17,8 @@ ConditionFileNotEmpty=|!/etc/ld.so.cache
DefaultDependencies=no
After=local-fs.target
Before=sysinit.target systemd-update-done.service
-Conflicts=shutdown.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
[Service]
Type=oneshot
diff --git a/units/systemd-ask-password-console.service b/units/systemd-ask-password-console.service
index 97c651f009..9360bf1d5a 100644
--- a/units/systemd-ask-password-console.service
+++ b/units/systemd-ask-password-console.service
@@ -16,8 +16,8 @@ ConditionPathExists=!/run/plymouth/pid
DefaultDependencies=no
After=plymouth-start.service systemd-vconsole-setup.service
Conflicts=emergency.service
-Conflicts=shutdown.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
[Service]
ExecStart=systemd-tty-ask-password-agent --watch --console
diff --git a/units/systemd-boot-system-token.service b/units/systemd-boot-system-token.service
index 56d3c8ad47..662a1fda04 100644
--- a/units/systemd-boot-system-token.service
+++ b/units/systemd-boot-system-token.service
@@ -12,9 +12,9 @@ Description=Store a System Token in an EFI Variable
Documentation=man:systemd-boot-system-token.service(8)
DefaultDependencies=no
-Conflicts=shutdown.target
After=local-fs.target systemd-random-seed.service
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
# Don't run this in a VM environment, because there EFI variables are not
# actually stored in NVRAM, independent of regular storage.
diff --git a/units/systemd-network-generator.service.in b/units/systemd-network-generator.service.in
index 41c27c50d8..2b79ca6b8a 100644
--- a/units/systemd-network-generator.service.in
+++ b/units/systemd-network-generator.service.in
@@ -14,8 +14,8 @@ Documentation=man:systemd-network-generator.service(8)
DefaultDependencies=no
Before=network-pre.target systemd-udevd.service
Wants=network-pre.target
-Conflicts=shutdown.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
[Service]
Type=oneshot
diff --git a/units/systemd-sysext.service b/units/systemd-sysext.service
index 245c0e5a0d..254de2b623 100644
--- a/units/systemd-sysext.service
+++ b/units/systemd-sysext.service
@@ -21,8 +21,8 @@ ConditionDirectoryNotEmpty=|/usr/lib/extensions
DefaultDependencies=no
After=local-fs.target
Before=sysinit.target systemd-tmpfiles.service
-Conflicts=shutdown.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
[Service]
Type=oneshot
diff --git a/units/systemd-sysusers.service b/units/systemd-sysusers.service
index 8b9335ff28..0eb40294b2 100644
--- a/units/systemd-sysusers.service
+++ b/units/systemd-sysusers.service
@@ -14,8 +14,8 @@ Documentation=man:sysusers.d(5) man:systemd-sysusers.service(8)
DefaultDependencies=no
After=systemd-remount-fs.service
Before=sysinit.target systemd-update-done.service
-Conflicts=shutdown.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
ConditionNeedsUpdate=|/etc
ConditionCredential=|sysusers.extra
diff --git a/units/systemd-tmpfiles-clean.service b/units/systemd-tmpfiles-clean.service
index 7f1b7ec594..4163aef729 100644
--- a/units/systemd-tmpfiles-clean.service
+++ b/units/systemd-tmpfiles-clean.service
@@ -12,9 +12,9 @@ Description=Cleanup of Temporary Directories
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
DefaultDependencies=no
-Conflicts=shutdown.target initrd-switch-root.service
After=local-fs.target time-set.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
[Service]
Type=oneshot
diff --git a/units/systemd-tmpfiles-setup-dev.service b/units/systemd-tmpfiles-setup-dev.service
index d202a7568f..c65539aa79 100644
--- a/units/systemd-tmpfiles-setup-dev.service
+++ b/units/systemd-tmpfiles-setup-dev.service
@@ -14,8 +14,8 @@ Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
DefaultDependencies=no
After=systemd-sysusers.service
Before=sysinit.target local-fs-pre.target systemd-udevd.service
-Conflicts=shutdown.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
[Service]
Type=oneshot
diff --git a/units/systemd-tmpfiles-setup.service b/units/systemd-tmpfiles-setup.service
index baed27df75..7e11eb9414 100644
--- a/units/systemd-tmpfiles-setup.service
+++ b/units/systemd-tmpfiles-setup.service
@@ -12,10 +12,10 @@ Description=Create Volatile Files and Directories
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
DefaultDependencies=no
-Conflicts=shutdown.target initrd-switch-root.service
After=local-fs.target systemd-sysusers.service systemd-journald.service
Before=sysinit.target
-Before=shutdown.target
+Conflicts=shutdown.target initrd-switch-root.target
+Before=shutdown.target initrd-switch-root.target
RefuseManualStop=yes
[Service]