HowTo: Replace wpa_supplicant with iwd, a newer wireless daemon

:warning: Warning

While iwd is not really new, there will be reasons why it is still not the default.

Personally I had login issues with KDE Plasma and needed to switch back to wpa_supplicant.

There seem to be issues in combination with NetworkManager.

Always have a backup!


iwd is a more modern replacement for wpa_supplicant.

Pros

  • smaller codebase, less “spaghetti code”
  • more modern
  • linux only, using kernel features instead of large userspace libraries
  • very fast
  • not dependent on systemd (unlike NetworkManager, while it can also be used with NetworkManager)
  • WPS support
  • fast hotspot and multiple-AP-networks support

Cons

Installation

To install it, you can just add a package.

dnf Fedora

run0 dnf install iwd

# to keep wpa_supplicant and just disable it:
systemctl disable --now wpa_supplicant

# to remove it (only do so when you are sure!)
run0 dnf remove wpa_supplicant

Atomic Desktops

# pinning the current image, so you always have a rollback option
run0 ostree admin pin 0

# replacing the packages
rpm-ostree --reboot override remove wpa_supplicant --install iwd

# if you want to keep wpa_supplicant and only disable it
rpm-ostree install iwd && \
systemctl disable --now wpa_supplicant && \
reboot

Enabling iwd

On Atomic Desktops after a reboot, on dnf Fedora after the package change, you will have no wireless internet connectivity.

iwd needs to be enabled with systemd.

Adding this override config makes NetworkManager use iwd instead:

run0
# creating the override file
mkdir -Z /etc/NetworkManager/conf.d
cat > /etc/NetworkManager/conf.d/iwd.conf <<EOF
[device]
wifi.backend=iwd
EOF

# fixing the SELinux labels
restorecon -R /etc/NetworkManager
# if this does not work
chcon -R system_u:object_r:NetworkManager_etc_t:s0 /etc/NetworkManager/conf.d

# enabling the iwd service
# this is recommended against on the Arch wiki, NetworkManager might start iwd on its own
# systemctl enable --now iwd

# reloading NetworkManager
systemctl restart NetworkManager

Experience

I noticed a good speed increase and no problems to connect with various networks.

Passwords need to be entered again, there will me a way to autimatically convert the entries.

Nieche enterprise networks may cause problems, keep that in mind. But overall, iwd should even support more modern use cases.

Configuration tools

As iwd relies on NetworkManager to work in the GUIs of KDE, GNOME and other desktops, there are some tools you may want to use, when using it standalone.

  • the iwctl command line interface
  • impala, a iwd TUI, an interactive terminal user interface (Rust)
  • iwgtk, a GTK app to configure iwd (C)
  • iwmenu window manager menu integration for Rofi, Wofi, Fuzzel and dmenu (Rust)

Revert to wpa_supplicant

To revert back, you dont need to uninstall iwd but can. You need to reinstall wpa_supplicant, so it is best to not remove it.

On atomic desktops you can roll back to the deployment that you pinned

rpm-ostree status
# deployments are listed from 0 (latest) to 1,2,3... , example: one pinned, 2 normal

rpm-ostree rollback 2

Disable iwd and enable wpa_supplicant

systemctl disable iwd
systemctl enable --now wpa_supplicant

Change the config, you can just rename the override one

run0 mv /etc/NetworkManager/conf.d/iwd.conf /etc/NetworkManager/conf.d/iwd.conf.disabled

Reload Network Manager

systemctl restart NetworkManager
1 Like

You can. You just need to set up the link using iwctl. If you want to use systemd-boot you make a config file similar to

[Match]
Type=wlan

[Network]
DHCP=yes

Once the link is up, systemd-networkmanager will detect that and run the dhcp set-up and configure the resolver.

With NetworkManager, you set the configuration file os use iwd, and you use the normal NetworkManager methods to set up the link. I did that several years ago, but don’t remember the details. Now I use systemd-networkd instead.

1 Like

I installed iwd using the information on this link as a guide.

Once I did that and restarted NetworkManager, and later subsequent reboots, I started having problems with my wifi connections reconnecting after returning from suspend. I found myself having to regularly toggle Airplane Mode and having to re-select which wifi connection to use, etc. I didn’t find it painless.

There’s also the business of open issues that the above link points to here.

I’m confess to being a pretty unsophisticated user, but, in any case, I just dropped my efforts to use it. Maybe you pros will try it out, and I’ll learn what I was doing wrong.

1 Like

That sounds unfortunate. Havent rebooted yet :stuck_out_tongue:

edited above

1 Like

I’m curious how you missed the config directory:
NetworkManager.conf: NetworkManager configuration file | NetworkManager File Formats | Man Pages | ManKier

1 Like

What are the plans to make IWD default in fedora (atomic desktops)?

It would be great to have the enhanced speed and reliability OOTB.

Well it needs a lot of testing and bugfixing it seems. In my case I needed to switch back because I could not get it to work after a couple of reboots

It works fine on my machine, but yes there are some connection issues on my system, which get fixed for a while by toggling the WiFi in plasma-nm off&on.

Did ur issue get fixed by switching back to wpa_supplicant?

1 Like

yes totally. toggling wifi on and off did not solve anything and sounds like a weird workaround for an underlying problem

It did work for me.

It got fixed with today’s update.

You just use wpa_supplicant if iwd fails for you.

1 Like

What update?

https://bodhi.fedoraproject.org/updates/FEDORA-2024-256818da09

that is pretty long ago

I don’t know if you’re still messing around with this, but in your How-To you discuss manually enabling iwd.service using systemctl. I only mention this because, as I replied at the time, I’d used this Arch link when I set it up. That link explicitly states that you shouldn’t do that. From the link:

Note:

  • Do not enable iwd.service or manually configure iwd. NetworkManager will start and manage it itself.
  • Consider existing issues before switching to iwd.

I ended up with something that worked fine across reboots, but had to be massaged a bit to use across Suspend/Unsuspend cycles. I didn’t use it across enough different wifi networks to learn how it worked over a variety of them.

Maybe someone with more knowledge on iwd and Wi-Fi networking than I can give us a defnitive answer on why that might be?

1 Like

Interesting! I will modify the howto then

Nice tip, i gave it a try on Workstation and it seems to work well so far.

The only steps i took were these:

$ sudo dnf install iwd
$ sudo systemctl mask wpa_supplicant.service

Create /etc/NetworkManager/conf.d/wifi_backend.conf

[device]
wifi.backend=iwd

Reboot, remove existing wifi login and recreate.