Goodbye Network Manager
Sun, 17 Nov 2024 13:28:55 -0500
I've been using a 2017 MacBook Air as my daily driver running Void Linux. It's been a surprisingly good experience; however, I have had constant issues with Networking. MacBook devices ship with Broadcom wireless chips which are notorious for having compatibility issues with the Linux kernel. In particular, they don't play nice with wpa_supplicant, and as a result, every time I've update my kernel, there's a chance that I'll have to troubleshoot my wifi.
Recently, I updated and rebooted my system only to find that my wifi card was not detecting any SSIDs. I was able to connect to Ethernet just fine, but NetworkManager was unable to detect any wireless signals. I tried re-loading the proprietary Broadcom drivers using sudo rmmod wl and sudo modprobe wl and rebooting my system to no avail. I also preformed some generic troubleshooting that didn't give me much insight into my problem. NetworkManager was able to detect my chip, lsmod was successfully able to load my driver.
I did some reading and found out that NetworkManager was still having issues with Broadcom chips because NetworkManager is basically a wrapper for wpa_supplicant. As an alternative the iwd program created by Intel is a superior alternative. You can change the wifi backend of NetworkManager
It is important to note that iwd is not a full blown network management software. It only is a wireless deamon. If you need something that controls wifi, Ethernet, and Bluethooth all in one program, it is best to use a fully featured program like Connman or NetworkManager. However, in my case, I have no use for Ethernet or Bluetooth, so iwd has been a minimal and lightweight solution for my networking needs.
Installation
First, if you are running NetworkManager, make sure to disable it by removing the symbolic link.
# rm /var/service/NetworkManager
Second, if you are installing this from scratch (i.e. you have never used any networking manager on this system), make sure to disable both wpa_supplicant and dhcpd.
# rm /var/service/wpa\_supplicant && rm /var/service/dhcpd
Next, install the iwd package. You can also install the iwgtk package if you'd like a graphical wrapper.
# xbps-install -S iwd
To make sure it iwd starts up at runtime, created a symbolic link.
# ln -s /etc/sv/iwd /var/service/
Connecting to a network
Next, we can use the command line utility iwctl to establish a connection with your wifi network. iwd uses psk authentication by default.
$ iwctl
This command will drop you into a shell that you can use to scan for available wireless networks, check the wireless hardware on your device, and connect to a local network. It should also be noted that iwctl has fantastic tab autocomplete and a useful help menu.
To get the name of available devices use the following command (abbreviated as <wlan> hereon out).
[iwd] # device list
To get the name of available networks use the following command.
[iwd] # station <wlan> get-networks
This will output a list of SSIDs that your given wlan was able to pickup. It will look something like this.
----------------------------------
Network name Security Signal
----------------------------------
<ssid0> psk ****
<ssid1> psk ****
<ssid2> psk ****
To connect to a network, run the following command.
[iwd] # station <wlan> connect <ssid>
You will be prompted for a password, and once this is done, you should be set to go. Finally, to check the status of you connection, you can use the following command to get the real time status of your wireless device.
[iwd] # station <wlan> show
Final comments
I have only been using iwd for a day, but thus far, it is been the most painless networking experience with a Broadcom chip that I've ever had. I hope that it stays that way! I've added some additional resources below for more detailed commands.