netplan type wifis needs a device option

Bug #1814012 reported by Gordon Harris
30
This bug affects 7 people
Affects Status Importance Assigned to Milestone
netplan
High
Steve Langasek
netplan.io (Ubuntu)
High
Unassigned

Bug Description

Some wifi adaptors need to use the -Ddrivername argument for wpa_supplicant to successfully associate with an AP.

The netplan yaml spec doesn't currently support an optional driver property for the wifis type.

For instance, here's my 01-netcfg.yaml:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens32:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.222/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]
  wifis:
    wlx4cedfb37602e:
      optional: true
      dhcp4: no
      dhcp6: no
      addresses: [192.168.1.222/24]
      access-points:
        "myssid":
          password: "mywpapsk"

This isn't currently enough to get the wifi interface to associate. I have to hand-edit:

/<email address hidden>

..to include the proper driver name. E.g.:

[Service]
Type=simple
ExecStart=/sbin/wpa_supplicant -c /run/netplan/wpa-%I.conf -i%I -Dnl80211

Once that edit has been made and systemctl daemon-reload run, the wifi interface associates.

It would be nice if netplan included a..

  driver: "drivername"

..option for the yaml file that would add the -Ddrivername to the unit file.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

That's not quite the device, but a driver value though. I wonder if it wouldn't be best to either always set -Dnl80211 on wireless (and -Dwired for 802.1x on ethernet...), or to make it possible to use an alternative value if matching by driver.

For example:

wifis:
  wlan1:
    match:
      driver: wext
      name: wlan1
    access-points:
       [...]
    dhcp4: yes

Changed in netplan:
status: New → Triaged
importance: Undecided → High
Changed in netplan.io (Ubuntu):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Triaged; we will need some input from Steve though to figure out how to addess this in the netplan schema.

It's Triaged High as it actually does potentially impact many devices. There are sadly still lots of devices that either don't do wext, or don't do nl80211, and maybe it wouldn't hurt to be explicit when enabling 802.1x on wired.

Changed in netplan:
assignee: nobody → Steve Langasek (vorlon)
Revision history for this message
Steve Langasek (vorlon) wrote :

What is the range of possible values for this -D option, and why would you ever want to specify it in the netplan yaml instead of inferring it?

Revision history for this message
Gordon Harris (wgordonharris) wrote :

Re range of possible values for -D option:

From man wpa_supplicant:

AVAILABLE DRIVERS
       A summary of available driver backends is below. Support for each of the driver backends is
       chosen at wpa_supplicant compile time. For a list of supported driver backends that may be used
       with the -D option on your system, refer to the help output of wpa_supplicant (wpa_supplicant -h).

       wext Linux wireless extensions (generic).

       wired wpa_supplicant wired Ethernet driver

       roboswitch
              wpa_supplicant Broadcom switch driver

       bsd BSD 802.11 support (Atheros, etc.).

       ndis Windows NDIS driver.

from wpa_supplicant --help on my system:

drivers:
  nl80211 = Linux nl80211/cfg80211
  wext = Linux wireless extensions (generic)
  wired = Wired Ethernet driver
  none = no driver (RADIUS server/WPS ER)

description: updated
Revision history for this message
Steve Langasek (vorlon) wrote :

I'm afraid I still don't understand from this why one would specify a -D option by hand

Revision history for this message
Gordon Harris (wgordonharris) wrote :

Here's one (e.g. my) case:

Asus AC1200 USB-AC53 Nano wifi adapter. No linux driver available from the manufacturer. But there are open-source drivers available that work well, but that require the -D parameter in order to be able to use wpa_supplicant.

Quoting https://github.com/jeremyb31/rtl8822bu/blob/master/README.md

NOTES
This driver allows use of wpa_supplicant by using the nl80211 driver wpa_supplicant -Dnl80211

Revision history for this message
Marco Confalonieri (marco.confalonieri) wrote :

This bug affects me too: to be able to use my RTL-8188EUS on Ubuntu Server 18.04.4 I have to pass -Dwext as parameter to wpa_supplicant. My workaround up to now has been to create a wrapper script named wpa_supplicant renaming the original executable.

Revision history for this message
Newell Jensen (newell-jensen) wrote :

This also affects me: the wireless dongle I am using needs wext driver but by default netplan is trying to use the nl80211 driver. If I specify -Dwext as seen in this paste I can get a connection:

https://paste.ubuntu.com/p/gxDb7PcFnP/

Revision history for this message
DanyChen (danychen) wrote :

I have this problem too, I think netplan is garbage, because it has no config for some networkd config(such as mdns and ipv6 prefix delegation), it only have is a basic network config, I don't know why bother use netplan but it's integrated in ubuntu as essential(ubuntu-minimal and cloud-init all depends on it). I don't know why this isn't an option to to user, and they have many ancient bug that are still open.

Revision history for this message
Matt Buckland (matj) wrote :

Same here. Also using rtl8188 chipset which only works with wext.

Revision history for this message
stevecam (stevecam) wrote :

This bug affects me
tested on two different adaptors
/sbin/wpa_supplicant -c /run/netplan/wpa-wlxd037453da72a.conf -iwlxd037453da72a -Dwext
will work for me
lsusb reports 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
however running
/sbin/wpa_supplicant -c /run/netplan/wpa-wlxd037453da72a.conf -iwlxd037453da72a -Dnl80211
will not work
same with
/sbin/wpa_supplicant -c /run/netplan/wpa-wlxd037453da72a.conf -iwlxd037453da72a
which appears to corrospond with how netplan is attempting to initialise the usb adapter
this option works for one adaptor that does not use nl80211 drivers

my other device will work regardless
/sbin/wpa_supplicant -c /run/netplan/wpa-wlx00198611c22e.conf -iwlx00198611c22e
/sbin/wpa_supplicant -c /run/netplan/wpa-wlx00198611c22e.conf -iwlx00198611c22e -Dnl80211
/sbin/wpa_supplicant -c /run/netplan/wpa-wlx00198611c22e.conf -iwlx00198611c22e -Dwext
lsusb reports
0bda:818b Realtek Semiconductor Corp. RTL8192EU 802.11b/g/n WLAN Adapter

It appears that there is a problem with the way wpa_supplicant/kernel drivers are detecting hardware, I agree with Steve Langasek in that it is unclear why the -D should be used to resolve this issue
wext is deprecated and is replaced by nl80211

Revision history for this message
SEN (sendel2000) wrote :

I have this trouble too!!!!!!! Please fix it!

Revision history for this message
Kees Cook (kees) wrote :

> What is the range of possible values for this -D option, and why would you ever want to specify it in the netplan yaml instead of inferring it?

It would be best if wpa_supplicant selected the correct driver, but it seems it doesn't do a good job with this. It does support fallbacks, though, which seems like a reasonable default behavior for wpa_supplicant ("-Dnl80211,wext"), but sometimes different drivers have different behaviors/abilities, so explicitly choosing one is useful.

I see two issues:
- wpa_supplicant makes no attempt to automatically pick a working driver
- netplan doesn't have a way to choose a driver if wpa_supplicant's default (nl80211) doesn't work

Revision history for this message
Kees Cook (kees) wrote :

For example, fallback (-Dnl80211,wext) is used for the wpa_supplicant systemd service:

https://salsa.debian.org/debian/wpa/-/blob/debian/unstable/debian/patches/networkd-driver-fallback.patch

But it isn't present in the netplan networkd renderer.

Revision history for this message
Kees Cook (kees) wrote :
Revision history for this message
Lukas Märdian (slyon) wrote :

A related change to automatically fallback inside wpa_supplicant itself just landed: https://launchpad.net/ubuntu/+source/wpa/2:2.9.0-23

Lukas Märdian (slyon)
Changed in netplan:
status: Triaged → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers