]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(systemd-networkd): check if units exist before enabling them
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Mon, 9 Feb 2026 07:42:41 +0000 (08:42 +0100)
committerBenjamin Drung <bdrung@ubuntu.com>
Mon, 9 Feb 2026 22:42:34 +0000 (23:42 +0100)
`systemd-networkd-resolve-hook.socket` was introduced in systemd-v259, so dracut
throws an error with previous systemd versions:

```
dracut[I]: *** Including module: systemd-networkd ***
Failed to enable unit: Unit systemd-networkd-resolve-hook.socket does not exist
```

Follow-up for 84c05fc661fa2ec01cfb341e73569542d46938d7

modules.d/11systemd-networkd/module-setup.sh

index 61d73a0992988fc639ebfce9f1f19b16e1a12420..97f46a158d7e5944279d7101a6eca681aec70961 100755 (executable)
@@ -75,7 +75,9 @@ install() {
         systemd-networkd-resolve-hook.socket \
         systemd-network-generator.service \
         systemd-networkd-wait-online.service; do
-        $SYSTEMCTL -q --root "$initdir" enable "$i"
+        if [[ -e "$initdir$systemdsystemunitdir"/"$i" ]]; then
+            $SYSTEMCTL -q --root "$initdir" enable "$i"
+        fi
     done
 
     # Install the hosts local user configurations if enabled.