From: Daan De Meyer Date: Thu, 25 May 2023 16:13:02 +0000 (+0200) Subject: units: Shut down networkd and resolved on switch-root X-Git-Tag: v254-rc1~375 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75efd16fb001ba19d12362198ba5c44cb6f40d04;p=thirdparty%2Fsystemd.git 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 --- diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in index 585bbe5e6d3..9f0af57fdc6 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 b4227ffd429..10ce49345e5 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]