shellcheck / shellcheck (push) Failing after 14s
archinstall's "Copy ISO network configuration", which a user who connected with iwctl may pick, turns on iwd and systemd-networkd. CoreDesktop then turns on NetworkManager too, and after a restart two services fight over the Wi-Fi card. system/wifi.sh disables iwd and systemd-networkd, without stopping them, when NetworkManager is enabled and isn't set to use iwd itself. install.sh runs it, and a migration runs it on existing machines. The README tells users to choose NetworkManager in archinstall. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.8 KiB
Bash
40 lines
1.8 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Purpose : Leave Wi-Fi to NetworkManager alone. archinstall's "copy ISO network
|
|
# configuration" turns on iwd and systemd-networkd, so a machine set
|
|
# up with iwctl from the Arch ISO can have them running alongside
|
|
# NetworkManager, which CoreDesktop turns on. Then two services fight
|
|
# over the Wi-Fi card: connections drop, or Wi-Fi is missing from
|
|
# GNOME.
|
|
#
|
|
# This disables iwd and systemd-networkd without stopping them, so the network
|
|
# stays up until the next boot; after it, NetworkManager runs Wi-Fi and wired
|
|
# connections. iwd's saved Wi-Fi passwords don't carry over: choose the network
|
|
# once in GNOME's top-right menu.
|
|
#
|
|
# Changes nothing when NetworkManager isn't enabled, or when it is set up to
|
|
# use iwd itself (wifi.backend=iwd in /etc/NetworkManager/conf.d/).
|
|
|
|
systemctl is-enabled -q NetworkManager.service 2> /dev/null || exit 0
|
|
systemctl is-enabled -q iwd.service 2> /dev/null || exit 0
|
|
|
|
# Unset settings print commented out, so this matches only one someone set
|
|
if NetworkManager --print-config 2> /dev/null \
|
|
| grep -qE '^[[:space:]]*wifi\.backend[[:space:]]*=[[:space:]]*iwd[[:space:]]*$'; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "Turning off iwd, so that NetworkManager runs Wi-Fi from the next restart..."
|
|
sudo systemctl disable iwd.service || exit 1
|
|
|
|
# archinstall turns systemd-networkd on with iwd. Its wait-online would hold up
|
|
# boot with nothing for it to wait for.
|
|
if systemctl is-enabled -q systemd-networkd.service 2> /dev/null; then
|
|
echo "Turning off systemd-networkd, so that NetworkManager runs the network..."
|
|
sudo systemctl disable systemd-networkd.service systemd-networkd.socket \
|
|
systemd-networkd-wait-online.service || exit 1
|
|
fi
|
|
|
|
echo "After you restart, choose your Wi-Fi network in GNOME's top-right menu"
|
|
echo "and enter its password once. The network stays up until then."
|