WiFi back-ends in SteamOS 3.6
As of NetworkManager
v1.46.0 (and a very long while before that, since
1.12 released in 2018), there are two wifi.backend's
supported:
wpa_supplicant
(default), and iwd
(experimental).
iwd
is still considered experimental after these years, see the
list of issues with iwd
backend,
and specially this
one.
In SteamOS, however, the
default is iwd
. It works relatively well in most scenarios; and the
main advantage is that, when waking up the device (think of Steam Deck
returning from sleep, "suspended to RAM" or S3
sleeping state), it
regains network connectivity much faster -- typically 1-2 seconds
vs. 5+ for wpa_supplicant
.
However, if for some reason iwd
doesn't work properly in your case,
you can give wpa_supplicant
a try.
With steamos-wifi-set-backend
command
In 3.6, the back-end can be changed via command.
3.6 has been available in Main
channel since late March and in
Beta
/Preview
for several days, for example 20240509.100
.
If you haven't done this before, to be able to run it, one must be able to either log in via SSH (not available out of the box), or to switch to desktop-mode, open a terminal and be able to type commands.
Assuming that one wants to change from the default iwd
to
wpa_supplicant
, the command is:
steamos-wifi-set-backend wpa_supplicant
The script tries to ensure than things are in place in terms of some
systemd units being stopped and others brought up as appropriate.
After a few seconds, if it's able to connect correctly to the WiFi
network, the device should get connectivity (e.g. ping works). It is
not necessary to enter again the preferred networks and passwords,
NetworkManager
feeds the back-ends with the necessary config and
credentials.
It is possible to switch back and forth between back-ends by using
alternatively iwd
and wpa_supplicant
as many times as desired, and
without restarting the system.
The current back-end as per configuration can be obtained with:
steamos-wifi-set-backend --check
And finally, this is the output of changing to wpa_supplicant
and
back to iwd
(i.e., the output that you should expect):
(deck@steamdeck ~)$ steamos-wifi-set-backend --check
iwd
(deck@steamdeck ~)$ steamos-wifi-set-backend wpa_supplicant
INFO: switching back-end to 'wpa_supplicant'
INFO: stopping old back-end service and restarting NetworkManager,
networking will be disrupted (hopefully only momentary blip, max 10 seconds)...
INFO: restarting done
INFO: checking status of services ...
(sleeping for 2 seconds to catch-up with state)
INFO: status OK
(deck@steamdeck ~)$ steamos-wifi-set-backend --check
wpa_supplicant
(deck@steamdeck ~)$ ping -c 3 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=56 time=16.4 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=56 time=24.8 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=56 time=16.5 ms
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 16.370/19.195/24.755/3.931 ms
(deck@steamdeck ~)$ steamos-wifi-set-backend iwd
INFO: switching back-end to 'iwd'
INFO: stopping old back-end service and restarting NetworkManager,
networking will be disrupted (hopefully only momentary blip, max 10 seconds)...
INFO: restarting done
INFO: checking status of services ...
(sleeping for 2 seconds to catch-up with state)
INFO: status OK
(deck@steamdeck ~)$ steamos-wifi-set-backend --check
iwd
(deck@steamdeck ~)$ ping -c 3 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=56 time=16.0 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=56 time=16.5 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=56 time=21.3 ms
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 15.991/17.940/21.295/2.382 ms
By hand
⚠️ IMPORTANT ⚠️ : Please do this only if you know what you are doing, you don't fear minor breakage and you are confident that you can recover from the situation if something goes wrong. If unsure, better wait until the channel that you run supports the commands to handle this automatically.
If you are running a channel that still does not have this command,
e.g. Stable
at the time of writing this, you can achieve the same
effect by executing the instructions run by this script by hand.
Note, however, that you might easily loose network connectivity if you make some mistake or something goes wrong. So be prepared to restore things by hand by switching to desktop-mode and having a terminal ready.
Now, the actual instructions. In
/etc/NetworkManager/conf.d/wifi_backend.conf
, change the string of
wifi.backend
, for example comment out the default one with iwd
and
add a line using wpa_supplicant
as value:
[device]
#wifi.backend=iwd
wifi.backend=wpa_supplicant
wifi.iwd.autoconnect=yes
⚠️ IMPORTANT ⚠️ : Leave the other lines alone. If you don't have experience with the format you can easily cause the file to not be parseable, and then networking could stop working entirely.
After that, things get more complicated depending on the hardware on which the system runs.
If the device is the SteamDeck, there is a difference between the
original LCD and the newer OLED model. With the OLED model, when you
switch away from iwd
, typically the network device is destroyed, so
it's necessary to re-create it. This happens automatically when
booting the system, so the easiest way if the network doesn't come up
after 15 seconds after the following instructions, is to just restart
the whole system.
If you're running SteamOS on models of the SteamDeck that don't exist at the time of writing this, or on other types of computers, the situation can be similar to the OLED or even more complex, depending on the WiFi hardware and drivers. So, again, tread carefully.
In the simplest scenario, LCD model, execute the following commands as
root
(or prepending sudo
), with OLD_BACKEND
being either iwd
or wpa_supplicant
, the one that you want to migrate away from:
systemctl stop NetworkManager
systemctl disable --now OLD_BACKEND
systemctl restart NetworkManager
If you have the OLED model and switching from wpa_supplicant
to
iwd
, that should be enough as well.
But if you have the OLED model and you changed from iwd
to
wpa_supplicant
, as explained above, your system will not be able to
connect to the network, and the easiest is to restart the system.
However, if you want to try to solve the problem by hand without
restarting, then execute these commands as root
/sudo
:
systemctl stop NetworkManager
systemctl disable --now OLD_BACKEND
if ! iw dev wlan0 info &>/dev/null; then iw phy phy0 interface add wlan0 type station; fi
systemctl restart NetworkManager
In any case, if after trying to change the back-end by hand and rebooting it's still not being able to connect, perhaps the best thing to do is to restore the previous configuration and restart the system again, and wait until your channel is upgraded to include this command.
Change back-ends via UI?
In the future, it is conceivable that the UI allows to change WiFi backends with the help of this command or by other means, but this is not possible at the moment.