]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units: Shut down networkd and resolved on switch-root
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 25 May 2023 16:13:02 +0000 (18:13 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 25 May 2023 22:54:56 +0000 (06:54 +0800)
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

units/systemd-networkd.service.in
units/systemd-resolved.service.in

index 585bbe5e6d3f47267a64aa064e85300d6ae7fe56..9f0af57fdc6834cda36e916d54229f731b656709 100644 (file)
@@ -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]
index b4227ffd429298d70085bd87597ca6651e2ad54b..10ce49345e506b70f95c35544f59aa64cbb6d2fe 100644 (file)
@@ -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]