WPA supplicant dropping/disconnecting NIC in hotel wifi

authenticationnetworkingraspbianwifiwpa-supplicant

TL;DR

WPA Supplicant intermittently fails on my Raspberry Pi 3 when using a USB Wifi dongle. It appears to do this when "reconnecting" to or changing access points in the hotel.

WPA GUI states: "wpa_gui could not get status from wpa_supplicant" and the icon for the wireless connection changes from the connected "waves" to two monitors that state "no wireless interfaces found".

How do I stop my wifi card from disconnecting?

Configs / Things I have tried:

  • Connecting the USB wifi dongle, by itself, to a powered, external USB hub (usb 3.0, 4 amp power supply)
  • Switching "power management" to "off" in the /etc/network/interfaces file for wlan1 (the dongle) by using the term "wireless-power off" and restarting the networking service
  • Modifying the /etc/default/crda file to change the variable "REGDOMAIN" equal to "US" from a blank value
  • Using a directional panel antenna with a 10dbi gain value pointed towards the access point

Information about the Pi & dongle:

  • Running Raspbian Jessie Kernel version 4.1 (March 18, 2016 release)
  • uname -a indicates "Linux raspberrypi 4.1.19-v7+" #858 SMP Tue Mar 15 15:56:00
  • lsusb indicates an RT5730 wireless chipset; this card is supposed to be natively supported by raspbian
  • Dongle currently has a 2dbi gain omnidirectional antenna attached.

Additional Information about the problem:

  • The wireless card is connecting to a hotel wifi network with multiple access points and many other users.
  • There are a minimum of 18 different access points around me with the strongest broadcasting around -47db. Signal strength does not appear to be the problem though interference might be.
  • The problem seems to occur when the unit reauthenticates or (perhaps) changes to a different access point on the same network (different ap on the same ESS)
  • After the problem occurs ifconfig still shows wlan1 (the problem card) but there is no ip address assigned to it.
  • After the problem occurs iwconfig still shows wlan1 and states that it is not associated to an access point.
  • The problem can be resolved temporarily by uplugging/plugging the USB wifi dongle back into the pi or the USB hub.
  • The pi is running the internal card as an access point for my personal use
  • Traffic from wlan1 (the dongle) is NATed and then bridged to wlan0 (the AP)
  • The pi's AP network card is broadcasting at approximately -27 dbi in 802.11g mode (I assume at 2.4 ghz)
  • The pi handles captive portal authentication on the hotel network via the epiphany browser
  • The hub and USB wifi dongle are approximately 1 foot away from the pi
  • The connection sometimes stays up for 30 seconds, other times 4 hours. Varies widely.

Syslog at time of disconnect (Sorry this is a bit long. No hide/unhide ability in markdown)

Apr 28 02:35:58 raspberrypi wpa_supplicant[4587]: wlan1: SME: Trying to authenticate with 24:c9:a1:36:d7:e8 (SSID='Hyatt' freq=2412 MHz)
Apr 28 02:35:58 raspberrypi rsyslogd-2007: action 'action 18' suspended, next retry is Thu Apr 28 02:36:58 2016 [try http://www.rsyslog.com/e/2007 ]
Apr 28 02:35:58 raspberrypi kernel: [ 3397.175336] wlan1: authenticate with 24:c9:a1:36:d7:e8
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: carrier lost
Apr 28 02:35:58 raspberrypi wpa_supplicant[4587]: wlan1: Trying to associate with 24:c9:a1:36:d7:e8 (SSID='Hyatt' freq=2412 MHz)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.197559] wlan1: send auth to 24:c9:a1:36:d7:e8 (try 1/3)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.198411] cfg80211: Calling CRDA to update world regulatory domain
Apr 28 02:35:58 raspberrypi kernel: [ 3397.200688] wlan1: authenticated
Apr 28 02:35:58 raspberrypi kernel: [ 3397.204852] wlan1: associate with 24:c9:a1:36:d7:e8 (try 1/3)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.208157] wlan1: RX AssocResp from 24:c9:a1:36:d7:e8 (capab=0x421 status=0 aid=3)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212839] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212863] cfg80211: World regulatory domain updated:
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212869] cfg80211:  DFS Master region: unset
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212874] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212882] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212889] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212895] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212903] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212911] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212918] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212924] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.212931] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.213813] cfg80211: Calling CRDA for country: GB
Apr 28 02:35:58 raspberrypi wpa_supplicant[4587]: wlan1: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Apr 28 02:35:58 raspberrypi wpa_supplicant[4587]: wlan1: Associated with 24:c9:a1:36:d7:e8
Apr 28 02:35:58 raspberrypi wpa_supplicant[4587]: wlan1: CTRL-EVENT-CONNECTED - Connection to 24:c9:a1:36:d7:e8 completed [id=5 id_str=]
Apr 28 02:35:58 raspberrypi kernel: [ 3397.214789] wlan1: associated
Apr 28 02:35:58 raspberrypi wpa_supplicant[4587]: wlan1: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=GB
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227388] cfg80211: Regulatory domain changed to country: GB
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227406] cfg80211:  DFS Master region: ETSI
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227412] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227420] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227428] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227435] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227442] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
Apr 28 02:35:58 raspberrypi kernel: [ 3397.227448] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: deleting address fe80::53dd:8f07:3be8:9d0a
Apr 28 02:35:58 raspberrypi dnsmasq[2376]: no servers found in /var/run/dnsmasq/resolv.conf, will retry
Apr 28 02:35:58 raspberrypi avahi-daemon[638]: Withdrawing address record for fe80::53dd:8f07:3be8:9d0a on wlan1.
Apr 28 02:35:58 raspberrypi avahi-daemon[638]: Leaving mDNS multicast group on interface wlan1.IPv6 with address fe80::53dd:8f07:3be8:9d0a.
Apr 28 02:35:58 raspberrypi avahi-daemon[638]: Interface wlan1.IPv6 no longer relevant for mDNS.
Apr 28 02:35:58 raspberrypi avahi-daemon[638]: Withdrawing address record for 172.17.187.9 on wlan1.
Apr 28 02:35:58 raspberrypi avahi-daemon[638]: Leaving mDNS multicast group on interface wlan1.IPv4 with address 172.17.187.9.
Apr 28 02:35:58 raspberrypi avahi-daemon[638]: Interface wlan1.IPv4 no longer relevant for mDNS.
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: deleting route to 172.17.0.0/16
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: deleting default route via 172.17.1.1
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: carrier acquired
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: adding address fe80::53dd:8f07:3be8:9d0a
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: IAID b0:20:34:21
Apr 28 02:35:58 raspberrypi dhcpcd[658]: wlan1: rebinding lease of 172.17.187.9
Apr 28 02:35:59 raspberrypi dhcpcd[658]: wlan1: soliciting an IPv6 router
Apr 28 02:35:59 raspberrypi ntpd[873]: Deleting interface #11 wlan1, 172.17.187.9#123, interface stats: received=33, sent=33, dropped=0, active_time=234 secs
Apr 28 02:35:59 raspberrypi ntpd[873]: 204.2.134.162 interface 172.17.187.9 -> (none)
Apr 28 02:35:59 raspberrypi ntpd[873]: 198.144.194.12 interface 172.17.187.9 -> (none)
Apr 28 02:35:59 raspberrypi ntpd[873]: 204.9.54.119 interface 172.17.187.9 -> (none)
Apr 28 02:35:59 raspberrypi ntpd[873]: 45.127.113.2 interface 172.17.187.9 -> (none)
Apr 28 02:35:59 raspberrypi ntpd[873]: Deleting interface #10 wlan1, fe80::53dd:8f07:3be8:9d0a#123, interface stats: received=0, sent=0, dropped=0, active_time=240 secs
Apr 28 02:35:59 raspberrypi ntpd[873]: peers refreshed
Apr 28 02:35:59 raspberrypi avahi-daemon[638]: Joining mDNS multicast group on interface wlan1.IPv6 with address fe80::53dd:8f07:3be8:9d0a.
Apr 28 02:35:59 raspberrypi avahi-daemon[638]: New relevant interface wlan1.IPv6 for mDNS.
Apr 28 02:35:59 raspberrypi avahi-daemon[638]: Registering new address record for fe80::53dd:8f07:3be8:9d0a on wlan1.*.
Apr 28 02:35:59 raspberrypi dhcpcd[658]: wlan1: ipv6nd_sendrsprobe: sendmsg: Operation not permitted
Apr 28 02:36:02 raspberrypi dhcpcd[4979]: sending commands to master dhcpcd process
Apr 28 02:36:02 raspberrypi dhcpcd[658]: control command: /sbin/dhcpcd -k wlan1
Apr 28 02:36:02 raspberrypi dhcpcd[658]: wlan1: removing interface
Apr 28 02:36:02 raspberrypi kernel: [ 3401.226725] wlan1: deauthenticating from 24:c9:a1:36:d7:e8 by local choice (Reason: 3=DEAUTH_LEAVING)
Apr 28 02:36:02 raspberrypi wpa_supplicant[4587]: wlan1: CTRL-EVENT-DISCONNECTED bssid=24:c9:a1:36:d7:e8 reason=3 locally_generated=1
Apr 28 02:36:02 raspberrypi avahi-daemon[638]: Interface wlan1.IPv6 no longer relevant for mDNS.
Apr 28 02:36:02 raspberrypi avahi-daemon[638]: Leaving mDNS multicast group on interface wlan1.IPv6 with address fe80::53dd:8f07:3be8:9d0a.
Apr 28 02:36:02 raspberrypi kernel: [ 3401.313626] cfg80211: Calling CRDA to update world regulatory domain
Apr 28 02:36:02 raspberrypi avahi-daemon[638]: Withdrawing address record for fe80::53dd:8f07:3be8:9d0a on wlan1.
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331043] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331067] cfg80211: World regulatory domain updated:
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331075] cfg80211:  DFS Master region: unset
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331080] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331087] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331094] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331100] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331108] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331116] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331122] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331128] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.331136] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.579305] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
Apr 28 02:36:02 raspberrypi kernel: [ 3401.579353] cfg80211: Calling CRDA for country: GB
Apr 28 02:36:02 raspberrypi wpa_supplicant[4587]: wlan1: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=GB
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595533] cfg80211: Regulatory domain changed to country: GB
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595548] cfg80211:  DFS Master region: ETSI
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595554] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595562] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595570] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595577] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595584] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
Apr 28 02:36:02 raspberrypi kernel: [ 3401.595590] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
Apr 28 02:36:02 raspberrypi wpa_supplicant[4587]: wlan1: CTRL-EVENT-TERMINATING
Apr 28 02:36:12 raspberrypi dhcpcd[5086]: sending commands to master dhcpcd process
Apr 28 02:36:12 raspberrypi dhcpcd[658]: control command: /sbin/dhcpcd -k eth0
Apr 28 02:36:12 raspberrypi kernel: [ 3411.753638] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
Apr 28 02:36:12 raspberrypi kernel: [ 3411.825436] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
Apr 28 02:36:12 raspberrypi kernel: [ 3411.825930] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Apr 28 02:36:13 raspberrypi kernel: [ 3412.149174] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
Apr 28 02:39:32 raspberrypi hostapd: wlan0: STA 16:39:db:60:cb:bf WPA: group key handshake completed (RSN)
Apr 28 02:39:32 raspberrypi rsyslogd-2007: action 'action 18' suspended, next retry is Thu Apr 28 02:40:32 2016 [try http://www.rsyslog.com/e/2007 ]
Apr 28 02:39:32 raspberrypi hostapd: wlan0: STA a4:77:33:51:31:9e WPA: group key handshake completed (RSN)
Apr 28 02:49:32 raspberrypi hostapd: wlan0: STA a4:77:33:51:31:9e WPA: group key handshake completed (RSN)
Apr 28 02:49:32 raspberrypi hostapd: wlan0: STA 16:39:db:60:cb:bf WPA: group key handshake completed (RSN)
Apr 28 02:49:32 raspberrypi rsyslogd-2007: action 'action 18' suspended, next retry is Thu Apr 28 02:51:02 2016 [try http://www.rsyslog.com/e/2007 ]
Apr 28 02:59:32 raspberrypi hostapd: wlan0: STA 16:39:db:60:cb:bf WPA: group key handshake completed (RSN)
Apr 28 02:59:32 raspberrypi hostapd: wlan0: STA a4:77:33:51:31:9e WPA: group key handshake completed (RSN)
Apr 28 02:59:32 raspberrypi rsyslogd-2007: action 'action 18' suspended, next retry is Thu Apr 28 03:01:02 2016 [try http://www.rsyslog.com/e/2007 ]
Apr 28 03:08:34 raspberrypi rsyslogd-2007: action 'action 18' suspended, next retry is Thu Apr 28 03:10:04 2016 [try http://www.rsyslog.com/e/2007 ]
Apr 28 03:08:34 raspberrypi systemd[1]: Starting Session c3 of user pi.
Apr 28 03:08:34 raspberrypi systemd[1]: Started Session c3 of user pi.
Apr 28 03:09:32 raspberrypi hostapd: wlan0: STA 16:39:db:60:cb:bf WPA: group key handshake completed (RSN)
Apr 28 03:09:32 raspberrypi hostapd: wlan0: STA a4:77:33:51:31:9e WPA: group key handshake completed (RSN)
Apr 28 03:10:29 raspberrypi rsyslogd-2007: action 'action 18' suspended, next retry is Thu Apr 28 03:11:59 2016 [try http://www.rsyslog.com/e/2007 ]
Apr 28 03:10:29 raspberrypi systemd[1]: Starting Session c4 of user pi.
Apr 28 03:10:29 raspberrypi systemd[1]: Started Session c4 of user pi.
  • wlan1: deauthenticating ... by local choice (Reason: 3=DEAUTH_LEAVING) is of interest to me (look towards the bottom 3/4 of the log).
  • CTRL-EVENT-TERMINATING is of interest to me also.

    WPA Supplicant Debug Logs

It appears that the AP (8c:0c:90:01:12:88) is generating the deauth:

CTRL_IFACE: GET_NETWORK id=0 name='disabled'
nl80211: Drv Event 20 (NL80211_CMD_DEL_STATION) received for wlan1
nl80211: Delete station 8c:0c:90:01:12:88
nl80211: Drv Event 39 (NL80211_CMD_DEAUTHENTICATE) received for wlan1
nl80211: Deauthenticate event
wlan1: Event DEAUTH (12) received       <-----
wlan1: Deauthentication notification    <-----
wlan1:  * reason 3 (locally generated)  <-----
wlan1:  * address 8c:0c:90:01:12:88     <-----
Deauthentication frame IE(s) - hexdump(len=0): [NULL]
wlan1: CTRL-EVENT-DISCONNECTED bssid=8c:0c:90:01:12:88 reason=3 locally_generated=1
CTRL_IFACE monitor sent successfully to /tmp/libdhcpcd-wpa-7751.50\x00
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_11606-5471\x00
wlan1: Auto connect enabled: try to reconnect (wps=0/0 wpa_state=9)
wlan1: Setting scan request: 0.100000 sec
Added BSSID 8c:0c:90:01:12:88 into blacklist
wlan1: Another BSS in this ESS has been seen; try it next
BSSID 8c:0c:90:01:12:88 blacklist count incremented to 2

Solution

I installed network-manager and network-manager-gnome and dropped my wlan1 card out of /etc/network/interfaces. The card remained stably connected for over 20 hours and only disconnected when I shut down the raspberry pi. The WPA Gui says "cannot get status from wpa_supplicant" but the card works anyway.

Looks like nm-applet has problems with permissions. I have to sudo pkill nm-applet and then sudo nm-applet in order to get network-manager-gnome to connect to the wireless. I will have to work out the bugs.

Best Answer

Create a new file /etc/modprobe.d/rt2800usb.conf with the following line :

options rt2800usb nohwcrypt=1

Reboot

Or blacklist the defaut drivers and use the nl80211driver to connect through wpa_supplicant:

nano /etc/modprobe.d/blacklist.conf

add the following lines:

blacklist rt2800usb
blacklist rt2x00lib
blacklist rt2x00usb

Connect through the command line :

wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

If you need a GUI , Install WICD , choose your interface then go to preferences and select nl80211

Related Question