From bb0df33556c1cfe6b3726726868725e8d0188966 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Mon, 27 Jul 2026 08:05:20 -0400 Subject: [PATCH] Deduplicate enabling systemd-resolved stub mode (#4669) --- archinstall/lib/installer.py | 15 ++++++++++----- archinstall/lib/network/network_handler.py | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 71d13241..96fa48d5 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -774,6 +774,15 @@ class Installer: with open(f'{self.target}/etc/systemd/network/10-{nic.iface}.network', 'a') as netconf: netconf.write(str(conf)) + def systemd_resolved_stub_mode(self) -> None: + """ + Enable systemd-resolved stub mode by (forcefully) setting a symlink + For further details see https://wiki.archlinux.org/title/Systemd-resolved#DNS + """ + resolv = self.target / 'etc/resolv.conf' + resolv.unlink(missing_ok=True) + resolv.symlink_to('/run/systemd/resolve/stub-resolv.conf') + def copy_iso_network_config(self, enable_services: bool = False) -> bool: # Copy (if any) iwd password and config files iwd_dir = LPath('/var/lib/iwd') @@ -802,11 +811,7 @@ class Installer: self.pacman.strap('iwd') self.enable_service('iwd') - # Enable systemd-resolved by (forcefully) setting a symlink - # For further details see https://wiki.archlinux.org/title/Systemd-resolved#DNS - resolv_config_path = self.target / 'etc/resolv.conf' - resolv_config_path.unlink(missing_ok=True) - resolv_config_path.symlink_to('/run/systemd/resolve/stub-resolv.conf') + self.systemd_resolved_stub_mode() # Copy (if any) systemd-networkd config files network_dir = LPath('/etc/systemd/network') diff --git a/archinstall/lib/network/network_handler.py b/archinstall/lib/network/network_handler.py index 09d2750c..60343a12 100644 --- a/archinstall/lib/network/network_handler.py +++ b/archinstall/lib/network/network_handler.py @@ -84,6 +84,4 @@ def _configure_iwd_standalone(installation: Installer) -> None: """) _ = wired_conf.write_text(wired_conf_content) - resolv = installation.target / 'etc/resolv.conf' - resolv.unlink(missing_ok=True) - resolv.symlink_to('/run/systemd/resolve/stub-resolv.conf') + installation.systemd_resolved_stub_mode()