Fix iwd network installation and setup (#4271)

* Fix 4223 - IWD

* Update

* Update
This commit is contained in:
Daniel Girtler 2026-03-21 17:56:41 +11:00 committed by GitHub
parent cfdcebcacd
commit 8e34303175
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 47 deletions

View File

@ -31,8 +31,6 @@ class DesktopProfile(Profile):
'openssh',
'htop',
'wget',
'iwd',
'wireless_tools',
'smartmontools',
'xdg-utils',
]

View File

@ -805,14 +805,6 @@ class Installer:
return True
def configure_nm_iwd(self) -> None:
# Create NetworkManager config directory and write iwd backend conf
nm_conf_dir = self.target / 'etc/NetworkManager/conf.d'
nm_conf_dir.mkdir(parents=True, exist_ok=True)
iwd_backend_conf = nm_conf_dir / 'wifi_backend.conf'
iwd_backend_conf.write_text('[device]\nwifi.backend=iwd\n')
def mkinitcpio(self, flags: list[str]) -> bool:
for plugin in plugins.values():
if hasattr(plugin, 'on_mkinitcpio'):

View File

@ -3,40 +3,45 @@ from archinstall.lib.models.network import NetworkConfiguration, NicType
from archinstall.lib.models.profile import ProfileConfiguration
class NetworkHandler:
def install_network_config(
self,
network_config: NetworkConfiguration,
installation: Installer,
profile_config: ProfileConfiguration | None = None,
) -> None:
match network_config.type:
case NicType.ISO:
_ = installation.copy_iso_network_config(
enable_services=True, # Sources the ISO network configuration to the install medium.
)
case NicType.NM | NicType.NM_IWD:
# Install NetworkManager package for both cases
packages = ['networkmanager']
# Default back-end only for non-iwd
if network_config.type == NicType.NM:
packages.append('wpa_supplicant')
def install_network_config(
network_config: NetworkConfiguration,
installation: Installer,
profile_config: ProfileConfiguration | None = None,
) -> None:
match network_config.type:
case NicType.ISO:
_ = installation.copy_iso_network_config(
enable_services=True, # Sources the ISO network configuration to the install medium.
)
case NicType.NM | NicType.NM_IWD:
packages = ['networkmanager']
installation.add_additional_packages(packages)
if network_config.type == NicType.NM:
packages.append('wpa_supplicant')
else:
packages.append('iwd')
# Desktop profile -> Always add applet
if profile_config and profile_config.profile:
if profile_config.profile.is_desktop_profile():
installation.add_additional_packages('network-manager-applet')
if profile_config and profile_config.profile:
if profile_config.profile.is_desktop_profile():
packages.append('network-manager-applet')
installation.enable_service('NetworkManager.service')
if network_config.type == NicType.NM_IWD:
# NM_IWD special handling
installation.configure_nm_iwd()
installation.disable_service('iwd.service')
installation.add_additional_packages(packages)
installation.enable_service('NetworkManager.service')
case NicType.MANUAL:
for nic in network_config.nics:
installation.configure_nic(nic)
installation.enable_service('systemd-networkd')
installation.enable_service('systemd-resolved')
if network_config.type == NicType.NM_IWD:
_configure_nm_iwd(installation)
installation.disable_service('iwd.service')
case NicType.MANUAL:
for nic in network_config.nics:
installation.configure_nic(nic)
installation.enable_service('systemd-networkd')
installation.enable_service('systemd-resolved')
def _configure_nm_iwd(installation: Installer) -> None:
nm_conf_dir = installation.target / 'etc/NetworkManager/conf.d'
nm_conf_dir.mkdir(parents=True, exist_ok=True)
iwd_backend_conf = nm_conf_dir / 'wifi_backend.conf'
_ = iwd_backend_conf.write_text('[device]\nwifi.backend=iwd\n')

View File

@ -16,7 +16,7 @@ from archinstall.lib.mirrors import MirrorListHandler
from archinstall.lib.models import Bootloader
from archinstall.lib.models.device import DiskLayoutType, EncryptionType
from archinstall.lib.models.users import User
from archinstall.lib.network.network_handler import NetworkHandler
from archinstall.lib.network.network_handler import install_network_config
from archinstall.lib.output import debug, error, info
from archinstall.lib.packages.util import check_version_upgrade
from archinstall.lib.profile.profiles_handler import profile_handler
@ -118,7 +118,7 @@ def perform_installation(
installation.add_bootloader(config.bootloader_config.bootloader, config.bootloader_config.uki, config.bootloader_config.removable)
if config.network_config:
NetworkHandler().install_network_config(
install_network_config(
config.network_config,
installation,
config.profile_config,

View File

@ -8,7 +8,7 @@ from archinstall.lib.menu.util import delayed_warning
from archinstall.lib.models import Bootloader
from archinstall.lib.models.profile import ProfileConfiguration
from archinstall.lib.models.users import Password, User
from archinstall.lib.network.network_handler import NetworkHandler
from archinstall.lib.network.network_handler import install_network_config
from archinstall.lib.output import debug, error, info
from archinstall.lib.profile.profiles_handler import profile_handler
from archinstall.lib.translationhandler import tr
@ -40,7 +40,7 @@ def perform_installation(arch_config_handler: ArchConfigHandler) -> None:
installation.add_bootloader(Bootloader.Systemd)
if config.network_config:
NetworkHandler().install_network_config(
install_network_config(
config.network_config,
installation,
config.profile_config,