WPA2 passphrase with special characters fails to associate

I have a problem with my wifi network not connecting with the latest OSMC update on a Raspberry Pi 2. It works fine after multiple reboots subsequent to the initial install, but fails to connect after the OTA update has completed. Immediately after the OTA update, things work, but wifi fails to connect after the first (and subsequent) reboot.

My wifi ssid contains a ‘-’ character, but no spaces.
My wifi passphrase contains both special characters (/, |, , !), and spaces.
I noticed in /var/lib/connman/*/settings, the \ character is escaped, so it shows up as \\.

Any attempts to connect via GUI fail, as do manual connection attempts using connmanctl over ssh. Purging the relevant directory in /var/lib/connman/ also fails to kickstart things.

I’ve successfully added a wifi network without spaces or special characters in either SSID or passphrase to work around this for now.

Are you certain that you cannot connect via connmanctl using agent on and entering the passphrase when prompted ?

I’m certain. :slightly_smiling:

Subsequent to my earlier post, I’ve also noticed that a new library scan is taking far longer than they did when I first installed OSMC - I’m going to pick up a new microSD card and check whether that is contributing to the problem(s).

A system journal taken after attempting to connect to wifi might show something.

If connmanctl also fails to connect to the network then it may be a bug in either connman or wpa_supplicant. I would have thought we’d have heard other complaints if it was unable to connect to any network with a hyphen in the password though.

I can reproduce this issue with a new microSD card - wifi will not connect when booting my Raspberry Pi 2. OSMC 2016.01 works flawlessly up until I install the latest updates, subsequently to the updates it is broken. Interestingly, connmanctl or wpa_supplicant is not one of the updates. :slight_smile:

My Realtek 8178 wifi adapter is detected ok:

Feb 18 20:18:10 osmc kernel: usb 1-1.3: new high-speed USB device number 4 using dwc_otg
Feb 18 20:18:10 osmc kernel: usb 1-1.3: New USB device found, idVendor=0bda, idProduct=8178
Feb 18 20:18:10 osmc kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 18 20:18:10 osmc kernel: usb 1-1.3: Product: 802.11n WLAN Adapter
Feb 18 20:18:10 osmc kernel: usb 1-1.3: Manufacturer: Realtek
Feb 18 20:18:10 osmc kernel: usb 1-1.3: SerialNumber: 00e04c000001

Firmware is loaded OK:

Feb 18 20:18:10 osmc kernel: CHIP TYPE: RTL8188C_8192C
Feb 18 20:18:10 osmc kernel: register rtw_netdev_ops to netdev_ops
Feb 18 20:18:10 osmc kernel: Chip Version ID: VERSION_NORMAL_TSMC_CHIP_92C.
Feb 18 20:18:10 osmc kernel: RF_Type is 2!!
Feb 18 20:18:10 osmc kernel: EEPROM type is E-FUSE
Feb 18 20:18:10 osmc kernel: ====> ReadAdapterInfo8192C
Feb 18 20:18:10 osmc kernel: Boot from EFUSE, Autoload OK !
<snip>
Feb 18 20:18:12 osmc wpa_supplicant[308]: Successfully initialized wpa_supplicant
Feb 18 20:18:12 osmc kernel: +871x_drv - drv_open, bup=0
Feb 18 20:18:12 osmc kernel:  ===> FirmwareDownload91C() fw:Rtl819XFwImageArray_TSMC
Feb 18 20:18:12 osmc kernel: FirmwareDownload92C accquire FW from embedded image
Feb 18 20:18:12 osmc kernel: fw_ver=v88, fw_subver=2, sig=0x88c0
Feb 18 20:18:12 osmc kernel: fw download ok!
Feb 18 20:18:12 osmc kernel: Set RF Chip ID to RF_6052 and RF type to 2.

Wifi association failed:

Feb 18 20:18:14 osmc connmand[254]: Skipping disconnect of 73742d61726d616e64_managed_psk, network is connecting.
Feb 18 20:18:14 osmc connmand[254]: ipconfig state 2 ipconfig method 1
Feb 18 20:18:14 osmc wpa_supplicant[308]: wlan0: Trying to associate with 94:10:3e:a5:ca:96 (SSID='st-armand' freq=2417 MHz)
Feb 18 20:18:14 osmc wpa_supplicant[308]: wlan0: Association request to the driver failed

Looks like a success… ?

Feb 18 20:18:14 osmc connmand[254]: wlan0 {add} route fe80:: gw :: scope 0 <UNIVERSE>
Feb 18 20:18:14 osmc wpa_supplicant[308]: wlan0: Associated with 00:23:6a:70:ca:87
Feb 18 20:18:14 osmc connmand[254]: wlan0 {update} flags 102403 <UP,LOWER_UP>
Feb 18 20:18:14 osmc connmand[254]: wlan0 {newlink} index 3 address 00:13:EF:15:13:A1 mtu 1500
Feb 18 20:18:14 osmc connmand[254]: wlan0 {newlink} index 3 operstate 5 <DORMANT>

Bang… disconnected.

Feb 18 20:18:14 osmc wpa_supplicant[308]: wlan0: WPA: IE in 3/4 msg does not match with IE in Beacon/ProbeResp (src=00:23:6a:70:ca:87)
Feb 18 20:18:14 osmc wpa_supplicant[308]: WPA: RSN IE in Beacon/ProbeResp - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
Feb 18 20:18:14 osmc wpa_supplicant[308]: WPA: RSN IE in 3/4 msg - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00
Feb 18 20:18:14 osmc wpa_supplicant[308]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:23:6a:70:ca:87 reason=17 locally_generated=1

… This repeats several times until I plug in my ethernet adapter to my laptop with internet sharing (before you ask - a real wired connection is not possible in this location :slight_smile: )

When I attempt manually (with /, , |, ', !, and space in my passphrase):

Agent ReportError wifi_0013ef1513a1_73742d61726d616e64_managed_psk
  invalid-key
Error /net/connman/service/wifi_0013ef1513a1_73742d61726d616e64_managed_psk: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Retry (yes/no)? yes

With this in the logs from wpa_supplicant:

Feb 18 20:49:26 osmc wpa_supplicant[308]: wlan0: WPA: IE in 3/4 msg does not match with IE in Beacon/ProbeResp (src=00:23:6a:70:ca:87)
Feb 18 20:49:26 osmc wpa_supplicant[308]: WPA: RSN IE in Beacon/ProbeResp - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
Feb 18 20:49:26 osmc wpa_supplicant[308]: WPA: RSN IE in 3/4 msg - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00
Feb 18 20:49:26 osmc wpa_supplicant[308]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:23:6a:70:ca:87 reason=17 locally_generated=1
Feb 18 20:49:26 osmc wpa_supplicant[308]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=4 ssid="st-armand" auth_failures=4 duration=60 reason=CONN_FAILED
Feb 18 20:49:26 osmc connmand[254]: ipconfig state 7 ipconfig method 1

Wow. So I rebooted again and the thing works perfectly, without changing a single thing.
Rebooted a third time, and it fails just like the post above.
Reboot a fourth time - it works perfectly.

So at least I have a sort-of solution of “reboot until it works”. It’s now simply a PITA instead of a blocking issue. :slightly_smiling: