balena-os / wifi-connect

Easy WiFi setup for Linux devices from your mobile phone or laptop
Apache License 2.0
1.29k stars 363 forks source link

Failing to start on Raspberry Pi Zero W running Bullseye: D-Bus failure #416

Open oznu opened 2 years ago

oznu commented 2 years ago

After updating to Raspberry Pi OS Bullseye, wifi-connect will not launch Raspberry Pi Zero W. It does run fine on a Raspberry Pi 4.

Logs

[network_manager::device:WARN] Undefined device type: 30
WiFi device: wlan0
[network_manager::dbus_api:ERROR] Get org.freedesktop.NetworkManager.AccessPoint::RsnFlags property failed on /org/freedesktop/NetworkManager/AccessPoint/4: wrong property type
Error: Getting access points failed
  caused by: D-Bus failure: Get org.freedesktop.NetworkManager.AccessPoint::RsnFlags property failed on /org/freedesktop/NetworkManager/AccessPoint/4: wrong property type
crzdg commented 2 years ago

I guess this is connected with.

https://github.com/balena-os/wifi-connect/issues/397

I ran into the same problem as well. I did some extensive debugging and found out that this error is caused if an access point in the list is present which supports WPA3 security profile. My iOS15 device personal hotspot feature was turned on and as WPA3 security was added to iOS15 the personal hotspot access point does show up as such. If I do turn off the personal hotspot the error vanishes and wifi-connect does work as expected.

This page states,

https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NM80211ApSecurityFlags

the WPA3 RsnFlag is supported since NetworkManager v1.30, the default on Ubuntu20.04 is 1.22.10-9. I guess the same error does occur if an access point is present which supports the WPA/RSN Opportunistic Wireless Encryption transition mode is supported which is supported since NetworkManager v1.26. See the provided link for details on the different RsnFlags.

So I guess, the solution would be to use NetworkManager >v1.30. As this is not the stable version for Ubuntu @balenaio should fix the error handling of unknown RsnFlags in the wifi-connect source.

crzdg commented 2 years ago

Maybe a bump of the NetworkManager bindings as in https://github.com/balena-os/wifi-connect/pull/156 will do the trick.

mailuminatti commented 2 years ago

How did you guys get this solved? I'm having the same issue but can't figure out how to overcome it

e13h commented 2 years ago

I did some extensive debugging and found out that this error is caused if an access point in the list is present which supports WPA3 security profile. My iOS15 device personal hotspot feature was turned on and as WPA3 security was added to iOS15 the personal hotspot access point does show up as such. If I do turn off the personal hotspot the error vanishes and wifi-connect does work as expected.

Words do not express my gratitude for this 😅 🙌🏼

I was using wifi-connect on my raspberry pi zero, and I wanted to connect it to a "hotspot" created by my MacBook using the "internet sharing" feature in system preferences, when all of a sudden it seemed like I bricked the networking interface or something, and all I was getting was wrong property type errors. After turning off my internet sharing and waiting a minute or so, wifi-connect started working again.

Edit: I should add that I'm running Raspberry Pi OS (Debian Bullseye), and I am running NetworkManager 1.30.0 (installed using the raspbian-install.sh script, so it seems like the issue is not fixed in NetworkManager yet?

ash-vd commented 1 year ago

This issue still persists with NetworkManager 1.32.12 and wifi-connect 4.4.6. I'm running OpenBalena 2.106.2 on a Raspberry Pi 4, but I can't get wifi-connect running because of the error above. Is there a workaround? Is there a way to load the module in the PR above into BalenaOS to see if that fixes this issue?

asutoshpalai commented 1 year ago

Note on how I solved it:

Sheng2216 commented 1 year ago

Note on how I solved it:

  • Cloned the repo git clone https://github.com/balena-os/wifi-connect/; cd wifi-connect.
  • Checked out v4.4.6, git checkout v4.4.6.
  • Cloned network-manager to a directory in the repo: git clone https://github.com/balena-io-modules/network-manager.
  • Edited Cargo.toml to build the local network-manager: network-manager = { path = "network-manager" }.
  • Edited src/wifi.rs to include the new flags for NM80211ApSecurityFlags:
diff --git a/src/wifi.rs b/src/wifi.rs
index 0cf5e42..a9d52c9 100644
--- a/src/wifi.rs
+++ b/src/wifi.rs
@@ -163,6 +163,14 @@ bitflags! {
         const AP_SEC_KEY_MGMT_PSK            = 0x0000_0100;
         // 802.1x authentication and key management is supported
         const AP_SEC_KEY_MGMT_802_1X         = 0x0000_0200;
+        // WPA/RSN Simultaneous Authentication of Equals is supported
+        const NM_802_11_AP_SEC_KEY_MGMT_SAE = 0x0000_0400;
+        // WPA/RSN Opportunistic Wireless Encryption is supported
+        const NM_802_11_AP_SEC_KEY_MGMT_OWE = 0x0000_0800;
+        // WPA/RSN Opportunistic Wireless Encryption transition mode is supported. Since: 1.26.
+        const NM_802_11_AP_SEC_KEY_MGMT_OWE_TM = 0x0000_1000;
+        // WPA3 Enterprise Suite-B 192 bit mode is supported. Since: 1.30.
+        const NM_802_11_AP_SEC_KEY_MGMT_EAP_SUITE_B_192 = 0x0000_2000;
     }
 }
  • Built the new wifi-connect version with rustup run 1.23 cargo build.

I followed your guide and I managed to build the binary, but I got the following error, did you get the same error?

image

Sheng2216 commented 1 year ago

but I got the following error I realized that I forget to add the ui directory. It works. Unsurprisingly, it doesn't support AP that implements WPA3 certification.

jellyfish-bot commented 1 year ago

[vipulgupta2048] This has attached https://jel.ly.fish/0ee3908d-df0e-4452-94c1-9a24c9d1fc40

majorz commented 1 year ago

This is now fixed in v4.11.1.

Sheng2216 commented 1 year ago

it works, it won't crash when there is a WPA3 access point around, but the new version still cannot connect to WPA3 wifi. I tested it on a Raspberry Pi 4B. Here is the error message:

user@raspberrypi:~ $ sudo wifi-connect
[sudo] password for rak: 
WiFi device: wlan0
Access points: [ "xiaomi",  "Raytron/Iray", "Univista_Guest", "Univista_Group"]
Starting access point...
Access point 'WiFi Connect' created
Starting HTTP server on 192.168.42.1:80
User connected to the captive portal
Stopping access point 'WiFi Connect'...
Access point 'WiFi Connect' stopped
Access points: ["xiaomi", "MAXHUB-489", "MAXHUB-389", "TP-LINK_0F31", "Univista_Group"]
Connecting to access point 'xiaomi'...
[wifi_connect::network:WARN] Connection to access point not activated 'xiaomi': Activating
Error: Getting access points failed
  caused by: D-Bus failure: Get org.freedesktop.NetworkManager.AccessPoint::RsnFlags property failed on /org/freedesktop/NetworkManager/AccessPoint/107: No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/NetworkManager/AccessPoint/107
  caused by: "No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/NetworkManager/AccessPoint/107"

user@raspberrypi:~ $ sudo wifi-connect -V
wifi-connect 4.11.1

image

majorz commented 1 year ago

Is this failing each time? Also when you try to connect with nmcli to the same access point do you see the same issue (again each time)?

$ sudo nmcli dev wifi connect xiaomi password "password-here"
Sheng2216 commented 1 year ago

seems debian/raspberry pi is using a version of NetworkManager that may not support WPA3 image

majorz commented 1 year ago

In their packages repo they include now very recent version of NetworkManager - 1.42.0: http://archive.raspbian.org/raspbian/pool/main/n/network-manager/. You may try upgrading all the packages on the system.

ndmgrphc commented 1 year ago

Seeing this regardless of whether or not a WPA3 network is present in nmcli device wifi list.

[network_manager::dbus_api:ERROR] Get org.freedesktop.NetworkManager.AccessPoint::RsnFlags property failed on /org/freedesktop/NetworkManager/AccessPoint/31: wrong property type

It will happen a few times when starting wifi-connect from a systemd unit which is here. start-wifi.connect.sh is using iwgetid -r to decide whether to start. I also put a sleep 20 above that. So altogether it's taking about 120 seconds or more at times to spawn the AP.

[Unit]
Description=Wifi connect service
After=NetworkManager.service

[Service]
Type=simple
EnvironmentFile=/etc/environment
ExecStart=/home/fw-dist/wifi-connect/start-wifi-connect.sh
Restart=on-failure
StandardOutput=file:/home/ds/wifi-connect-stdout.log
StandardError=file:/home/ds/wifi-connect-stderr.log
Type=idle
User=root

[Install]
WantedBy=multi-user.target

It will fail and restart 2 or 3 times. Wondering if After=NetworkManager.service is not ready. Also wondering if this is related.

This has me stuck at 4.4.6:

curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh | sed 's/\*rpi/*aarch64/' | bash

nmcli --version is 1.36.6

Armbian 22.04.1 LTS (Jammy Jellyfish) aarch64

majorz commented 1 year ago

@ndmgrphc are you using wifi-connect 4.4.6 or 4.11.1? With 4.11.1 you should not observe the RsnFlags error. For aarch64 you may get the aarch release from here: https://github.com/balena-os/wifi-connect/releases/tag/v4.11.1 as the Raspbian installer currently does not support that version.

ndmgrphc commented 1 year ago

@ndmgrphc are you using wifi-connect 4.4.6 or 4.11.1? With 4.11.1 you should not observe the RsnFlags error. For aarch64 you may get the aarch release from here: https://github.com/balena-os/wifi-connect/releases/tag/v4.11.1 as the Raspbian installer currently does not support that version.

Okay thanks -- let me see if I can figure out how to upgrade. I can't seem to get NetworkManager over 1.36.6 without building it manually and was afraid this dependency version was bumped up. This is on a Pine64 SOQuartz and I believe my wireless chip is the broadcom 43455. It works eventually; just seems hung up by this error causing an exit and systemd restarting the process a few times which is effectively 25 seconds per attempt.

majorz commented 1 year ago

You should be fine with using older NetworkManager versions - whatever comes as default to the OS.

ndmgrphc commented 1 year ago

Successfully installed tag v4.11.1 and the error is gone and wifi-connect starts via systemd on the first try. THANKS!

Mattssmith94 commented 1 year ago

I'm still running into this issue even after upgrading to Wifi-Connect v4.11.1. Any help with this? @majorz Edit to tag Majorz, just in case they didn't get notified of the new comment :)


 wifi-connect  [network_manager::device:WARN] Undefined device type: 30
 wifi-connect  WiFi device: wlan0
 wifi-connect  [network_manager::dbus_api:ERROR] Get org.freedesktop.NetworkManager.AccessPoint::RsnFlags property failed on /org/freedesktop/NetworkManager/AccessPoint/2: wrong property type
 wifi-connect  Error: Getting access points failed
 wifi-connect    caused by: D-Bus failure: Get org.freedesktop.NetworkManager.AccessPoint::RsnFlags property failed on /org/freedesktop/NetworkManager/AccessPoint/2: wrong property type