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
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]
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]