summaryrefslogtreecommitdiffstats
path: root/units
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-25 18:13:02 +0200
committerMike Yuan <me@yhndnzj.com>2023-05-26 00:54:56 +0200
commit75efd16fb001ba19d12362198ba5c44cb6f40d04 (patch)
tree54b07baa26d43f767ac3a367989431130d36905a /units
parentrules: add rule for accel devices (diff)
downloadsystemd-75efd16fb001ba19d12362198ba5c44cb6f40d04.tar.xz
systemd-75efd16fb001ba19d12362198ba5c44cb6f40d04.zip
units: Shut down networkd and resolved on switch-root
Let's explicitly order these against initrd-switch-root.target, so that they are properly shut down before we switch root. Otherwise, there's a race condition where networkd might only shut down after switching root and after we've already we've loaded the unit graph, meaning it won't be restarted in the rootfs. Fixes #27718
Diffstat (limited to 'units')
-rw-r--r--units/systemd-networkd.service.in4
-rw-r--r--units/systemd-resolved.service.in4
2 files changed, 4 insertions, 4 deletions
diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in
index 585bbe5e6d..9f0af57fdc 100644
--- a/units/systemd-networkd.service.in
+++ b/units/systemd-networkd.service.in
@@ -15,8 +15,8 @@ ConditionCapability=CAP_NET_ADMIN
DefaultDependencies=no
# systemd-udevd.service can be dropped once tuntap is moved to netlink
After=systemd-networkd.socket systemd-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service
-Before=network.target multi-user.target shutdown.target
-Conflicts=shutdown.target
+Before=network.target multi-user.target shutdown.target initrd-switch-root.target
+Conflicts=shutdown.target initrd-switch-root.target
Wants=systemd-networkd.socket network.target
[Service]
diff --git a/units/systemd-resolved.service.in b/units/systemd-resolved.service.in
index b4227ffd42..10ce49345e 100644
--- a/units/systemd-resolved.service.in
+++ b/units/systemd-resolved.service.in
@@ -16,8 +16,8 @@ Documentation=https://www.freedesktop.org/wiki/Software/systemd/writing-resolver
DefaultDependencies=no
After=systemd-sysusers.service
-Before=sysinit.target network.target nss-lookup.target shutdown.target
-Conflicts=shutdown.target
+Before=sysinit.target network.target nss-lookup.target shutdown.target initrd-switch-root.target
+Conflicts=shutdown.target initrd-switch-root.target
Wants=nss-lookup.target
[Service]