From 2fd857145b56afd684bcfc119d3e6b15d7d4fba8 Mon Sep 17 00:00:00 2001 From: mozempk Date: Thu, 23 Apr 2026 08:56:46 +0200 Subject: [PATCH] fix: set fallback DNS 8.8.8.8 in live-setup.sh at boot When the DHCP-provided nameserver fails (QEMU 10.0.2.3, slow/broken DNS), first-login.sh would spin forever waiting for network. Add a live-setup.sh step that replaces 10.0.2.3 with 8.8.8.8/1.1.1.1 so first-login always has working DNS immediately on login. --- iso/build-live-iso.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/iso/build-live-iso.sh b/iso/build-live-iso.sh index 7f0ca8c..631e415 100755 --- a/iso/build-live-iso.sh +++ b/iso/build-live-iso.sh @@ -130,6 +130,17 @@ if [ -f /etc/nsswitch.conf ]; then echo "live-setup: removed mdns from nsswitch.conf (hosts line)" fi +# ── DNS: ensure a working nameserver is configured ─────────────────────── +# NetworkManager will overwrite resolv.conf once DHCP completes. +# If the DHCP-provided nameserver is broken (e.g. QEMU's 10.0.2.3), add +# 8.8.8.8 as a fallback. We write it now so first-login.sh can reach the +# internet immediately after login without waiting for NM to settle. +if ! grep -q '^nameserver' /etc/resolv.conf 2>/dev/null || \ + grep -q '^nameserver 10\.0\.2\.3' /etc/resolv.conf 2>/dev/null; then + printf 'nameserver 8.8.8.8\nnameserver 1.1.1.1\n' > /etc/resolv.conf + echo "live-setup: set fallback DNS (8.8.8.8, 1.1.1.1)" +fi + # ── D-Bus session socket for the live user's login session ─────────────── # dbus-launch is called by lightdm-session / Xsession automatically. # Ensure dbus system bus is accessible (needed by nix and Cinnamon).