Attached is the updated patch following upstream review on PR #2845 (moved 
/etc/resolv.conf generation into ExecStartPost= in 99-wait-online-dracut.conf 
without touching initqueue).
From 759f0900f9b37dd8c81da5c0e4e1c37bb0dcfb7b Mon Sep 17 00:00:00 2001
From: Viktor Pashaiev <[email protected]>
Date: Fri, 27 Nov 2026 14:28:43 +0100
Subject: [PATCH] fix(systemd-networkd): populate /etc/resolv.conf in
 wait-online drop-in

When 11systemd-networkd is used instead of 35network-manager or
35network-legacy (for example in TEST-61-CHRONY on Debian and Ubuntu),
/etc/resolv.conf is never created in the initramfs, so chronyd fails to
resolve pool.ntp.org and chrony-wait.service times out.

Populate /etc/resolv.conf from kernel command-line nameserver= arguments
and /run/systemd/netif/state DNS= entries via ExecStartPost= in
99-wait-online-dracut.conf once systemd-networkd-wait-online finishes.

Fixes: https://github.com/dracut-ng/dracut/issues/2541
Bug-Debian: https://bugs.debian.org/1155542
Bug-Ubuntu: https://launchpad.net/bugs/2178220
Forwarded: https://github.com/dracut-ng/dracut/pull/2845
---
 modules.d/11systemd-networkd/99-wait-online-dracut.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules.d/11systemd-networkd/99-wait-online-dracut.conf b/modules.d/11systemd-networkd/99-wait-online-dracut.conf
index da90596..9a3652f 100644
--- a/modules.d/11systemd-networkd/99-wait-online-dracut.conf
+++ b/modules.d/11systemd-networkd/99-wait-online-dracut.conf
@@ -4,6 +4,7 @@ ConditionPathExists=/run/networkd/initrd/neednet
 
 [Service]
 TimeoutStartSec=120
+ExecStartPost=/bin/sh -c 'if [ ! -e /etc/resolv.conf ] && [ -r /run/systemd/netif/state ]; then . /lib/dracut-lib.sh; for s in $(getargs nameserver) $(sed -n "s/^DNS=//p" /run/systemd/netif/state); do echo "nameserver $s" >> /etc/resolv.conf; done; fi'
 
 [Install]
 WantedBy=initrd.target
-- 
2.43.0

Reply via email to