# Can't associate WPA supplicant RPi2B RT5370 ARM

## dspahn

I have a RT5370 sub dongle plugged into a RPi2B. I'm running Gentoo for ARM and have the following output running WPA Supplicant with -dd:

```
wlan0: Event SCAN_RESULTS (3) received

Received 2389 bytes of scan results (5 BSSes)

wlan0: BSS: Start scan result update 26

BSS: last_scan_res_used=5/32

wlan0: New scan results available (own=0 ext=0)

CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_5848-1\x00

wlan0: Radio work 'scan'@0xc386a0 done in 1.275744 seconds

wlan0: Selecting BSS from priority group 10

wlan0: 0: 68:7f:74:2f:e6:b2 ssid='myssid ' wpa_ie_len=28 rsn_ie_len=24 caps=0x11 level=-73 wps

wlan0:    skip - disabled temporarily for 39 second(s)

wlan0: 1: 20:aa:4b:c8:bd:ec ssid='Another's did ' wpa_ie_len=28 rsn_ie_len=24 caps=0x11 level=-73 wps

wlan0:    skip - disabled temporarily for 39 second(s)

wlan0: 2: 00:18:0a:22:0a:c5 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 level=-43

wlan0:    skip - SSID not known

wlan0: 3: 0e:18:0a:22:0a:c5 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 level=-45

wlan0:    skip - SSID not known

wlan0: 4: 12:18:0a:22:0a:c5 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 level=-47

wlan0:    skip - SSID not known

wlan0: No suitable network found

wlan0: Setting scan request: 5.000000 sec

wlan0: Starting AP scan for wildcard SSID

wlan0: Add radio work 'scan'@0xc386a0

wlan0: First radio work item in the queue - schedule start immediately

wlan0: Starting radio work 'scan'@0xc386a0 after 0.000081 second wait

Scan requested (ret=0) - scan timeout 30 seconds

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

WEXT: if_removed already cleared - ignore event

Wireless event: cmd=0x8b19 len=8

wlan0: Event SCAN_RESULTS (3) received

Received 2391 bytes of scan results (5 BSSes)

wlan0: BSS: Start scan result update 27

BSS: last_scan_res_used=5/32

wlan0: New scan results available (own=0 ext=0)

CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_5848-1\x00

wlan0: Radio work 'scan'@0xc386a0 done in 1.283815 seconds

wlan0: Selecting BSS from priority group 10

wlan0: 0: 68:7f:74:2f:e6:b2 ssid='myssid' wpa_ie_len=28 rsn_ie_len=24 caps=0x11 level=-73 wps

wlan0:    skip - disabled temporarily for 33 second(s)

wlan0: 1: 20:aa:4b:c8:bd:ec ssid='Another's did ' wpa_ie_len=28 rsn_ie_len=24 caps=0x11 level=-73 wps

wlan0:    skip - disabled temporarily for 33 second(s)

wlan0: 2: 00:18:0a:22:0a:c5 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 level=-43

wlan0:    skip - SSID not known

wlan0: 3: 0e:18:0a:22:0a:c5 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 level=-45

wlan0:    skip - SSID not known

wlan0: 4: 12:18:0a:22:0a:c5 ssid='' wpa_ie_len=0 rsn_ie_len=0 caps=0x1 level=-47

wlan0:    skip - SSID not known

wlan0: No suitable network found

wlan0: Setting scan request: 5.000000 sec

Scan SSID - hexdump_ascii(len=8):

     44 53 46 41 4d 2d 30 31                           DSFAM-01        

wlan0: Starting AP scan for wildcard SSID (Interleave with specific)

wlan0: Add radio work 'scan'@0xc386a0

wlan0: First radio work item in the queue - schedule start immediately

wlan0: Starting radio work 'scan'@0xc386a0 after 0.000078 second wait

Scan requested (ret=0) - scan timeout 30 seconds

```

I have defined a network block in wpa_supplicant for the myssid network and no other networks. This card works on Raspbian and the WPA_supplicant network block was pasted from another machine on the network. The ssidis a 2.4 GHz network- I heard this might be an issue with this card. RFKILL support is compiled as a module and there are No blocks on the card. Any ideas?

----------

## charles17

 *dspahn wrote:*   

> 
> 
> ```
> wlan0: No suitable network found
> ```
> ...

 

Could you also post your output of ifconfig and of  *Quote:*   

> $ wpa_cli list_networks

 

----------

## dspahn

Fixing another issue with my Pi, so it's at work right now- scanning for wireless networks from here may not help but it will show what's explicitly defined in wpa_supplicant.conf.

ifconfig doesn't show the wireless, but ifconfig -a yields:

```
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.3.31  netmask 255.255.255.0  broadcast 192.168.3.255

        inet6 fe80::ba27:ebff:fe44:6515  prefixlen 64  scopeid 0x20<link>

        ether b8:27:eb:44:65:15  txqueuelen 1000  (Ethernet)

        RX packets 51040  bytes 10923620 (10.4 MiB)

        RX errors 0  dropped 4598  overruns 0  frame 0

        TX packets 3835  bytes 500773 (489.0 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 0  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 00:0f:60:06:fc:01  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

 wpa_cli list_networks shows this:

```
Selected interface 'wlan0'

network id / ssid / bssid / flags

0       myssid        any

```

 also, /etc/conf.d/net contains:

```
cat /etc/conf.d/net

modules="wpa_supplicant"

#wpa_supplicant_wlan0="-Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf"

wpa_supplicant_wlan0="-Dwext -dd -c /etc/wpa_supplicant/wpa_supplicant.conf -f /var/log/wpa_supplicant.log"

```

 and /etc/wpa_supplicant/wpa_supplicant.conf:

```
 cat /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

update_config=1

# ctrl_interface=/var/run/wpa_supplicant

ap_scan=1

fast_reauth=1

network={

        scan_ssid=1

        priority=10

#        mode=0

        key_mgmt=WPA-PSK

        ssid="myssid"

        psk=alonghexstring

}

```

I generated the psk line- it's not a quoted string. Otherwise this comes straight out of a computer that uses NetworkManager for wireless. Problem is that, running mainly headless, I don't want to use NetworkManager for this.

Let me know if any other info will be helpful- I appreciate your help!

----------

## charles17

 *dspahn wrote:*   

> Let me know if any other info will be helpful- I appreciate your help!

 

What is the reason for using that strange long line in /etc/conf.d/net?  

And why do you think you need the deprecated Wext driver?

What if you completely deleted the network = {...} section and then tried to connect using wpa_cli?

----------

## dspahn

Great questions! I have not setup Gentoo in a couple of years and everything has just worked on that machine since- I am probably using old methods and parameters. Should I change the parameter to the nl80211 driver? I use the strange long line because I had a quoted strong for the WPA-PSK and as part of troubleshooting I used an iw command to generate the key manually. I'll try running wpa_cli and post the result.

----------

## charles17

 *dspahn wrote:*   

> Should I change the parameter to the nl80211 driver? 

 

Remove it.  Remove that line completely and try as described in the wiki.

----------

## khayyam

 *dspahn wrote:*   

> wpa_cli list_networks shows this:
> 
> ```
> Selected interface 'wlan0'
> 
> ...

 

dspahn ... was the machine in the vacinity of the AP when this was run? It should list the BSSID ... it doesn't, but it does in the above wpa_supplicant.log. Anyhow, try the following:

/etc/conf.d/net

```
modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dnl80211 -qq"

# or for logging:

#wpa_supplicant_wlan0="-Dnl80211 -dd -f /var/log/wpa_supplicant.log"
```

/etc/wpa_supplicant/wpa_supplicant.conf:

```
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

update_config=1

ap_scan=1

fast_reauth=1

network={

        ssid="myssid"

        bssid=68:7F:74:2F:E6:B2

        scan_ssid=0

        psk=alonghexstring

}
```

I'm not sure why its not scanning correctly, but it's most likely your use of '-Dwext' (unless you have CONFIG_CFG80211_WEXT=y ... which is not enabled by default). If the problem persists then post the following:

```
# awk '{RS="Cell"}/myssid/' <(iwlist wlan0 scan)
```

... and the relevent section of 'wpa_supplicant.log' ... with '-dd' (debug) rather than '-qq' (quiet).

best ... khay

----------

## dspahn

I noticed this in my wpa_supplicant.log:

```
Removed BSSID 68:7f:74:2f:e6:b2 from blacklist (clear)

```

and it came after a full scan that included this as well:

```
wlan0: 0: 68:7f:74:2f:e6:b2 ssid='myssid' wpa_ie_len=28 rsn_ie_len=24 caps=0x411 level=-63 wps

wlan0:    skip - blacklisted (count=1 limit=0)
```

what does this mean, is it relevant, and if so, how do I solve it?

Thanks!

----------

## dspahn

Seeing a well-versed group like the people who have helped out here stumped on this issue got me thinking- All here have strong knowledge of getting WPA_Supplicant to work. I appreciate all the help. The problem is not WPA_Supplicant, nor is it the driver nor the configuration- it's at the kernel level. I looked up some messages I was getting and took advice given from this thread- I ended up running just wpa_cli and letting it sit for a minute. I started seeing messages about authentication failures trying to connect to the AP- which is the source of the blacklisting I posted about earlier. Apparently, others have had the same problem when the appropriate crypto libraries (80211ccmp and 80211tkip) are not compiled either directly or as modules. I am working on what to add, but it's tricky because I would have thought that the RTLLIB river would support this, however the Kernel version of this driver says that the driver only supports one card of some model I am not dealing with... If anyone can suggest which options/modules I should compile in to the kernel, I'd appreciate it- for now it's trial and error. I have found that I can cut the compile time down by paring back the modules and options being loaded- apparently the RPi is so extensible that the kernel defaults to a number of options to simplify setup of some of those things. I appreciate any suggestions on what to enable.

Thanks!

----------

## charles17

 *dspahn wrote:*   

> ... same problem when the appropriate crypto libraries (80211ccmp and 80211tkip) are not compiled either directly or as modules. I am working on what to add, but it's tricky ...

 

Guess you need following in your kernel

```
LIB80211_CRYPT_CCMP=y

RTLLIB_CRYPTO_CCMP=y

LIB80211_CRYPT_TKIP=y

RTLLIB_CRYPTO_TKIP=y

```

----------

## khayyam

 *dspahn wrote:*   

> Seeing a well-versed group like the people who have helped out here stumped on this issue got me thinking- All here have strong knowledge of getting WPA_Supplicant to work. I appreciate all the help. The problem is not WPA_Supplicant, nor is it the driver nor the configuration- it's at the kernel level.

 

dspahn ... I wouldn't say I'm "stumped", I just don't have the information I requested above. Anyhow, yes, I am "well versed", and I can tell you that *regardless* of how the kernel is configured (more on that bellow) if the BSSID isn't showing in 'wpa_cli list_networks' then your problem could be one of many things. Getting at the problem requires you provide information on request ... and not simply jump to the next thing that catches your attention (ie, "blacklisted" ... more on that later).

 *dspahn wrote:*   

> I looked up some messages I was getting and took advice given from this thread- I ended up running just wpa_cli and letting it sit for a minute. I started seeing messages about authentication failures trying to connect to the AP- which is the source of the blacklisting I posted about earlier.

 

That doesn't make sense, 'wpa_cli' will simply enter "interactive mode", so where these "messages" are coming from I simply do not know, perhaps you mean 'iw event -f'? Anyhow, if you're are seeing messages about 'authentication failure' then I'd suggest you check the 'psk' string.

The 'blacklisting' is simply wpa_supplicant having reached its limit for the number tries at ASSOC ... if these fail then the AP is placed in a blacklist and it moves on to the next network (if) configured. After a certain amount of time (assuming no other connection) it will return to the blacklisted AP's ... just think of it as a timeout. So, there is nothing unusual in this happening. 

 *dspahn wrote:*   

> Apparently, others have had the same problem when the appropriate crypto libraries (80211ccmp and 80211tkip) are not compiled either directly or as modules. I am working on what to add, but it's tricky because I would have thought that the RTLLIB river would support this, however the Kernel version of this driver says that the driver only supports one card of some model I am not dealing with...

 

If the driver requires LIB80211_CRYPT_* or RTLLIB_CRYPTO_* is should enable them when the driver is selected ... unless of course this is an out of tree driver. Please provide details of the card, driver, firmware (if any), and 'modinfo <driver>'. If, as you say, this driver is not for your *specific* card, then this is probably the thing to focus on ... but, again, without details we can only guess.

best ... khay

----------

