FS#29946 - [netcfg] wifi-menu failing to find networks

Attached to Project: Arch Linux
Opened by Douglas McFadzean (ninian) - Saturday, 19 May 2012, 10:20 GMT
Last edited by Jouke Witteveen (jouke) - Thursday, 14 June 2012, 12:42 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture i686
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description:

Computer #1: Dell Inspiron 1525 laptop with PRO/Wireless 3945ABG [Golan] wifi, using the driver: iwl3945
If already connected to a network, wifi-menu scans and shows networks correctly.
But if not already connected, wifi-menu finds no networks.
(NetworkManager appears to work perfectly.)

Computer #2: Asus Eee PC 701SD netbook with Realtek RTL8187SE wifi, using driver: r8187se
wifi-menu finds no networks when trying to scan.
(NetworkManager appears to work perfectly.)

Additional info:
wifi-menu from netcfg 2.8.2
4 users currently report similar problems (https://bbs.archlinux.org/viewtopic.php?id=141476)

Steps to reproduce:
Try using wifi-menu to scan for networks, when 1) disconnected completely and 2) connected
This task depends upon

Closed by  Jouke Witteveen (jouke)
Thursday, 14 June 2012, 12:42 GMT
Reason for closing:  Fixed
Additional comments about closing:  2e15a please mark the bbs thread as [SOLVED]
Comment by Jouke Witteveen (jouke) - Sunday, 20 May 2012, 08:56 GMT
Any error messages to work with?
Basically wifi-menu brings the interface up and calls `wpa_cli scan`. I just noticed that the code paths used are currently not used by any other part of netcfg.
Is it possible that these cards are just plain slow?
Please report whether `wpa_cli -i wlan0 scan; sleep <time>; wpa_cli -i wlan0 scan_results` returns something useful for different values of <time> (suggestion: 1, 1.5, 2, 2.5, 3, 4, 5).
Comment by Douglas McFadzean (ninian) - Sunday, 20 May 2012, 12:29 GMT
On computer #2: the suggested wpa_cli scan command (regardless of the sleep time) reports the error (twice):
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

But wifi-select DOES scan and show the networks; 'iwlist wlan0 scan' works also
Comment by Jouke Witteveen (jouke) - Sunday, 20 May 2012, 12:44 GMT
That's because you didn't start wpa_supplicant beforehand ;-).
Try to precede testing by running something along the lines of `wpa_supplicant -B -i wlan0 -D nl80211,wext -C /run/wpa_supplicant`.
You can later kill the supplicant with `wpa_cli -i wlan0 terminate`.

The point of wifi-menu is to use netcfg and netcfg doesn't use iwlist as it is advised against using wireless_tools on a modern set-up.
Comment by Douglas McFadzean (ninian) - Sunday, 20 May 2012, 13:07 GMT
Righto - I get the desire to avoid using wireless_tools now.

On running your wpa_supplicant command, it worked but produced the message: nl80211: 'nl80211' generic netlink not found
Then trying the wpa_cli scan command for the first time, with sleep 1, I got:
OK
bssid / frequency / signal level / flags / ssid
but no networks were listed, just these headers.
However, on retrying with sleep 1 and above, the networks displayed okay.
Killed the supplicant and tried again: failed the first 3 times with sleep 1, and just showed headers with no networks. Seems okay now and with sleep 2 and above.
Comment by Jouke Witteveen (jouke) - Friday, 01 June 2012, 10:29 GMT
So it doesn't look like the timeout is to blame, which is strange because if scan_results produces a list of networks, I see no reason why wifi-menu would not.
Comment by Damien Gombault (Desintegr) - Wednesday, 06 June 2012, 08:46 GMT
I have the same problem with netcfg 2.8.3-1.

My computer is a Dell Latitude e5520 with Intel Corporation Centrino Advanced-N 6205 :
02:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)

I use the iwlwifi module.

I write a script to debug :

#/bin/bash
wpa_supplicant -B -P /run/wpa_supplicant_wlan0.pid -i wlan0 -D nl80211,wext -C/run/wpa_supplicant
sleep 1
wpa_cli -p /run/wpa_supplicant -i wlan0 scan
sleep 2.5
wpa_cli -p /run/wpa_supplicant -i wlan0 scan_results
wpa_cli -p /run/wpa_supplicant -i wlan0 terminate

sleep 2.5 is the current value used in wpa_supplicant_scan_info() function.

With this 2.5 value, I get no scan result.

I replace 2.5 with 3.5 (3 does not work) then I get this :

bssid / frequency / signal level / flags / ssid
00:26:3e:c8:4c:04 2412 -67 [WPA-EAP-TKIP+CCMP][WPA2-EAP-TKIP+CCMP][ESS] XXX
00:26:3e:c8:4c:02 2412 -69 [WPA-EAP-TKIP+CCMP][WPA2-EAP-TKIP+CCMP][ESS] XXX
f4:ca:e5:c6:34:b8 2417 -85 [WPA-PSK-CCMP][ESS] XXX
00:26:3e:c8:4c:05 5180 -86 [WPA-EAP-TKIP+CCMP][WPA2-EAP-TKIP+CCMP][ESS] XXX
00:26:3e:c8:4c:03 5180 -87 [WPA-EAP-TKIP+CCMP][WPA2-EAP-TKIP+CCMP][ESS] XXX
00:26:3e:c8:4c:00 2412 -69 [ESS] XXX
00:1a:c1:15:bd:c2 2462 -85 [ESS] XXX
00:26:3e:c8:4c:01 5180 -86 [ESS] XXX

I think there is a better method than sleep to wait for results because the right value (3.5 for me) will change with other wifi nics or modules.

`wpa_cli -p /run/wpa_supplicant -i wlan0 status` returns wpa_state=SCANNING while scanning.
A better solution is maybe to check the value of wpa_state.
When the scan is finished, the wpa_state is INACTIVE.

I suggest to replace plain sleep with something like :

while [[ "$(wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" status 2> /dev/null | grep "wpa_state=" | sed "s/^wpa_state=//")" == "SCANNING" ]]; do
sleep 0.5
done
Comment by Jouke Witteveen (jouke) - Thursday, 07 June 2012, 09:56 GMT
Unfortunately, scanning is not guaranteed to be finished when the state is no longer "SCANNING". New scan results can be added in the background, depending on the driver, meaning we can be out of "SCANNING" with very little scan results. I might work out some more complicated logic before the next release. Good to hear that the timeout probably is at fault after all.
Comment by Jouke Witteveen (jouke) - Thursday, 07 June 2012, 20:59 GMT
Please test the attached file (replace /usr/lib/network/8021x with it).
   8021x (7.9 KiB)
Comment by Damien Gombault (Desintegr) - Friday, 08 June 2012, 08:09 GMT
I replaced /usr/lib/network/8021x with the new file, it works for me.

I run wifi-menu with 'set -x' and I get this log.
The new loop works, it waited 2+1+1 seconds and I get scan results.

++ wpa_supplicant_scan_info wlan0 3,4,5
++ local INTERFACE=wlan0 fields=3,4,5 spawned_wpa=0 essids scan_wait
++ [[ -z wlan0 ]]
+++ mktemp --tmpdir essid.XXXXXXXX
++ essids=/tmp/essid.1wxEUhYE
+++ wpa_cli -p /run/wpa_supplicant -i wlan0 ping
++ [[ '' != \P\O\N\G ]]
++ start_wpa wlan0 '' nl80211,wext
++ local INTERFACE=wlan0 WPA_CONF= WPA_DRIVER=nl80211,wext
++ shift 3
++ local WPA_OPTS=
++ [[ -n '' ]]
++ WPA_CONF=-C/run/wpa_supplicant
++ wpa_supplicant -B -P /run/wpa_supplicant_wlan0.pid -i wlan0 -D nl80211,wext -C/run/wpa_supplicant
++ sleep 1
++ [[ ! -f /run/wpa_supplicant_wlan0.pid ]]
++ spawned_wpa=1
++ wpa_cli -p /run/wpa_supplicant -i wlan0 scan
++ sleep 2
++ (( scan_wait = 2 ))
++ (( scan_wait < 10 ))
++ wpa_cli -p /run/wpa_supplicant -i wlan0 status
++ grep -q wpa_state=SCANNING
++ sleep 1
++ (( scan_wait++ ))
++ (( scan_wait < 10 ))
++ wpa_cli -p /run/wpa_supplicant -i wlan0 status
++ grep -q wpa_state=SCANNING
++ sleep 1
++ (( scan_wait++ ))
++ (( scan_wait < 10 ))
++ wpa_cli -p /run/wpa_supplicant -i wlan0 status
++ grep -q wpa_state=SCANNING
++ break
++ wpa_cli -p /run/wpa_supplicant -i wlan0 scan_results
++ grep -v '^Selected'
++ grep -v '^bssid'
++ sort -rn -k3
++ sort -u -k5
++ sort -rn -k3
++ cut -f3,4,5
++ (( 1 == 1 ))
++ stop_wpa wlan0
++ wpa_cli -p /run/wpa_supplicant -i wlan0 terminate
Comment by Douglas McFadzean (ninian) - Saturday, 09 June 2012, 12:15 GMT
Your updated /usr/lib/network/8021x seems to make wifi-menu work for me on my desktop system (with USB wifi dongle) and on netbook system #2 in the original post. Will test the Dell laptop system #1 later. Thanks for your work on this.

Loading...