From: Jo Zzsi Date: Thu, 8 Jan 2026 16:01:47 +0000 (-0500) Subject: fix(systemd-networkd): ensure zzzz-dracut-default.network cleanup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da3353f022cc7b930dd532e2f1e06af4e86999d3;p=thirdparty%2Fdracut-ng.git fix(systemd-networkd): ensure zzzz-dracut-default.network cleanup zzzz-dracut-default.network should be only installed when systemd-network-generator does not generate any files in files in /run/systemd/network . Place dracut-default.network in /usr/lib/dracut/ and do not change /usr as part of managing .network files in initramfs. Follow-up to 523c9b0 . --- diff --git a/modules.d/11systemd-networkd/99-default.network b/modules.d/11systemd-networkd/dracut-default.network similarity index 100% rename from modules.d/11systemd-networkd/99-default.network rename to modules.d/11systemd-networkd/dracut-default.network diff --git a/modules.d/11systemd-networkd/module-setup.sh b/modules.d/11systemd-networkd/module-setup.sh index 7aa346628..61d73a099 100755 --- a/modules.d/11systemd-networkd/module-setup.sh +++ b/modules.d/11systemd-networkd/module-setup.sh @@ -63,8 +63,7 @@ install() { inst_simple "$moddir"/99-wait-online-dracut.conf \ "$systemdsystemunitdir"/systemd-networkd-wait-online.service.d/99-dracut.conf - inst_simple "$moddir"/99-default.network \ - "$systemdnetwork"/zzzz-dracut-default.network + inst_simple "$moddir"/dracut-default.network /usr/lib/dracut/dracut-default.network inst_hook cmdline 99 "$moddir"/networkd-config.sh inst_hook initqueue/settled 99 "$moddir"/networkd-run.sh diff --git a/modules.d/11systemd-networkd/networkd-config.sh b/modules.d/11systemd-networkd/networkd-config.sh index db6f4282a..89556ef15 100755 --- a/modules.d/11systemd-networkd/networkd-config.sh +++ b/modules.d/11systemd-networkd/networkd-config.sh @@ -8,6 +8,7 @@ systemctl start systemd-network-generator.service # Customizations for systemd-network-generator generated networks. # We need to request certain DHCP options, and there is no way to # tell the generator to add those. +generated=0 for f in /run/systemd/network/*.network; do [ -f "$f" ] || continue @@ -19,10 +20,15 @@ for f in /run/systemd/network/*.network; do echo "RequestOptions=59 60" } >> "$f" - # Remove the default network if at least one was generated - rm -f "$systemdnetworkconfdir"/zzzz-dracut-default.network + # at least one was generated + generated=1 done +# Add the default network if none was generated +if [ "$generated" -eq "0" ]; then + cp -a /usr/lib/dracut/dracut-default.network /run/systemd/network/zzzz-dracut-default.network +fi + # Just in case networkd was already running systemctl try-reload-or-restart systemd-networkd.service