Skip to content

Commit 0907bfb

Browse files
DaanDeMeyerbluca
authored andcommitted
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 (cherry picked from commit 75efd16) (cherry picked from commit 2e10f88) (cherry picked from commit bc3bad0)
1 parent 27b90b6 commit 0907bfb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

units/systemd-networkd.service.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ ConditionCapability=CAP_NET_ADMIN
1515
DefaultDependencies=no
1616
# systemd-udevd.service can be dropped once tuntap is moved to netlink
1717
After=systemd-networkd.socket systemd-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service
18-
Before=network.target multi-user.target shutdown.target
19-
Conflicts=shutdown.target
18+
Before=network.target multi-user.target shutdown.target initrd-switch-root.target
19+
Conflicts=shutdown.target initrd-switch-root.target
2020
Wants=systemd-networkd.socket network.target
2121

2222
[Service]

units/systemd-resolved.service.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Documentation=https://www.freedesktop.org/wiki/Software/systemd/writing-resolver
1616

1717
DefaultDependencies=no
1818
After=systemd-sysusers.service
19-
Before=sysinit.target network.target nss-lookup.target shutdown.target
20-
Conflicts=shutdown.target
19+
Before=sysinit.target network.target nss-lookup.target shutdown.target initrd-switch-root.target
20+
Conflicts=shutdown.target initrd-switch-root.target
2121
Wants=nss-lookup.target
2222

2323
[Service]

0 commit comments

Comments
 (0)