[SOLVED] Can't get wpa_supplicant to associate/connect w/ my AP; used to work reliably...
Linux - Wireless NetworkingThis forum is for the discussion of wireless networking in Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can't get wpa_supplicant to associate/connect w/ my AP; used to work reliably...
Greetings! Last night, my ISP, Comcast, went down for a couple hours. I have wireless interface that is properly configured to use wpa_supplicant, and it has been working smoothly for some time now. However, after Comcast came back up, I haven't been able to get things working since then. (I've rebooted the router, rebooted my laptop, nothing works...) It tries to connect w/ my WPA2 protected network AP (HOME-6C53-2.4), but fails after a short period (~10secs), and then rescans and finds another open network AP (xfinitywifi) in the neighborhood and connects with that. This happened once before, unbeknownst to me, and for a long time, I couldn't figure out why I couldn't print documents on a printer that was connected to my AP. Finally, I rebooted the router and discovered that I had been connected not to my protected AP, but to the open AP!
I'm running Slackware 14.0, and start the wireless interface via '/etc/rc.d/rc.inet1 restart'. I actually have a short script that mimics each step produced by rc.inet1 (and rc.wireless), which does the following:
sudo /sbin/dhcpcd -k -d wlan0
sudo killall wpa_supplicant
sleep 1
sudo /sbin/ifconfig wlan0 down
sudo /usr/sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
i=0
ns=1
while true ; do
i=$((i+1))
sts=$(/usr/sbin/wpa_cli -iwlan0 status | \
egrep '^ssid=|wpa_state=')
echo "sts($i): $sts"
echo $sts | grep -q "wpa_state=COMPLETED" && break
sleep $ns
done
sudo /sbin/ifconfig wlan0 up
sudo /sbin/dhcpcd -d -t 20 wlan0
sudo /sbin/iwconfig wlan0
The (abbreviated) output for these steps is the following:
sts(1): wpa_state=DISCONNECTED
sts(2): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(3): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(4): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(5): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(6): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(7): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(8): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(9): ssid=HOME-6C53-2.4
wpa_state=4WAY_HANDSHAKE
sts(10): wpa_state=DISCONNECTED
sts(11): ssid=xfinitywifi
wpa_state=COMPLETED
....
Also, I've noticed that if I wait less time (e.g., 0.2secs) between the calls to wpa_cli, I see a value of wpa_state=SCANNING before it switches to ssid=xfinitywifi. Also, I sometimes see wpa_state=ASSOCIATING and wpa_state=ASSOCIATED. I don't remember seeing 'wpa_state=4WAY_HANDSHAKE' before, although I didn't used to check the wpa_state values returned by the wpa_cli commands (except for wpa_state=COMPLETED). As shown above, wpa_supplicant spends most of its time trying to do a 4WAY_HANDSHAKE.
I've looked at the /var/log/debug, and it shows that the AP (bssid=20:25:64:e2:3f:d0) is being authenticated and associated, then it is disassociated and deauthenticated:
Jan 9 13:36:18 werz kernel: [12267.310305] wlan0: authenticate with 20:25:64:e2:3f:d0 (try 1)
Jan 9 13:36:18 werz kernel: [12267.312596] wlan0: authenticated
Jan 9 13:36:18 werz kernel: [12267.312647] wlan0: associate with 20:25:64:e2:3f:d0 (try 1)
Jan 9 13:36:18 werz kernel: [12267.316962] wlan0: RX AssocResp from 20:25:64:e2:3f:d0 (capab=0x431 status=0 aid=2)
Jan 9 13:36:18 werz kernel: [12267.316971] wlan0: associated
Jan 9 13:36:22 werz kernel: [12271.318762] wlan0: disassociated from 20:25:64:e2:3f:d0 (Reason: 2)
Jan 9 13:36:22 werz kernel: [12271.357889] wlan0: deauthenticating from 20:25:64:e2:3f:d0 by local choice (reason=3)
Also, I've tried doing 'sudo iwconfig wlan0 essid HOME-6C53-2.4' before the call to wpa_supplicant, but that doesn't help much -- it tries, then after a period of time, rescans and connects to 'xfinitywifi' instead. I can block connecting to open AP's by editing the /etc/wpa_supplicant.conf file, but I'd rather not do that. (I like being able to connect while in coffee shops that have open networks, but I'm aware that it's an open AP.)
I booted into Windows 7, and it connected to HOME-6C53-2.4 no problem (so at least I have a fall-back when I need a secure connection). This is one of those cases where "it used to work, now it doesn't"...
I'm really stumped here! Don't want to have to become an expert in wpa_supplicant, and the whole handshaking process when an AP connects. Hopefully, someone can help me out here!
Hi there. My mac address is 20:25:64:e2:3f:d0, as shown in the /var/log/debug lines shown above, or by using iwlist as stated above. Don't know what good that will do, except to locate the proper lines in some of the /var/log lines.
An IT friend suggested that when the router rebooted, it may have updated the firmware to the latest version. Assuming this is true, Windows 7 seems to handle this firmware update okay, whereas Linux/wpa_supplicant doesn't. (Is this true???) Rich said this has happened to him in the past, and he's had to spend some time on the phone w/ Comcast to remedy the situation. I'm hesitant to get on the phone w/ Comcast tech support, since more likely than not, they'd respond w/ "We don't support Linux..." Similarly, sometime last year, Comcast/Xfinity upgrade their upgraded to viewer to require v. 11.8.0 or later of Adobe Flash. (My Firefox has v. 11.2.202.) If you go onto Adobe's website, there's a note saying "Adobe Flash Player 11.2 will be the last version to target Linux as a supported platform. Adobe will continue to provide security backports to Flash Player 11.2 for Linux." My workaround is to use Google Chrome instead of Firefox if/when I want to use their viewer. My point is that Comcast has dumped lots of Linux customers in their decision to move forward. So I'm not very encouraged in calling tech support. But plan to bite the bullet and call them this afternoon... Thing is, I really don't have the technical expertise to diagnose the problem; thus this post.
Has anyone had similar experience w/ Comcast routers, that may have been recently upgraded and resulted in incompatibilities w/ wpa_supplicant? Or, do I need to grab the most recent version of wpa_supplicant that may better handle wpa_state=4WAY_HANDSHAKE? At this point, I'm (very cautiously) using the open network 'xfinitywifi'. I reboot into Windows 7 to do work that requires a secure connection (e.g., financial crap) or to print documents. Actually, I just thought of something -- I'm going to try to connect thru an ethernet cable; I don't mind sitting close to the router.
One other thing -- I'm not averse to installing another Linux distro, or using a live Linux distro DVD, to see if the problem is handled better by another. Also, could be time to update my version of Slackware; I've been using Slackware forever (since 1995?) and am comfortable (lazy?) with that. I should probably someday try other flavors of Linux.
Just found a web site that stated that if I'm getting wpa_state=4WAY_HANDSHAKE, that means that password authentication is wrong. The thing is that a) I haven't changed it since it was working smoothly, and b) it works under Windows 7.
Thanks @business_kid, I tried what you said, got the following:
wpa_supplicant -c/etc/wpa_supplicant.conf -i wlan0 -Dwext &&
> iwconfig wlan0 essid your_essid ap 20:25:64:E2:3F0
wlan0: Trying to associate with 20:25:64:e2:3f:d0 (SSID='HOME-6C53-2.4' freq=2437 MHz)
wlan0: Associated with 20:25:64:e2:3f:d0
wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wlan0: CTRL-EVENT-DISCONNECTED bssid=20:25:64:e2:3f:d0 reason=0
wlan0: Trying to associate with 20:25:64:e2:3f:d0 (SSID='HOME-6C53-2.4' freq=2437 MHz)
wlan0: Associated with 20:25:64:e2:3f:d0
wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wlan0: CTRL-EVENT-DISCONNECTED bssid=20:25:64:e2:3f:d0 reason=0
wlan0: Trying to associate with 06:3e:0c:9d:49:f0 (SSID='xfinitywifi' freq=2412 MHz)
wlan0: Associated with 06:3e:0c:9d:49:f0
wlan0: CTRL-EVENT-CONNECTED - Connection to 06:3e:0c:9d:49:f0 completed (auth) [id=16 id_str=]
I even tried using the 256bit psk produced by wpa_passphrase, same result. The thing is, as stated in my 1st post, this used to work fine up until the Comcast outage. After they came back up, it's never worked -- always fails doing the 4-Way Handshake. I spent 1.5hrs yesterday on the phone w/ a tech support person from Comcast, and we couldn't resolve the issue. (Granted, she wasn't that familiar w/ Linux...) She couldn't even tell me if the router had been flashed w/ an update to the router's firmware (which is what I suspect happened...). So, I'm off to Comcast to swap the router. Hope that helps!
Well, went to Comcast to exchange the router/modem. Works now, so the issue is moot. Somehow, after the Comcast outage, things changed with the router. Windows seems to have dealt okay w/ the change (Comcast probably tested the change against Windows & Macs), whereas Linux didn't. I probably will never know what really happened. Oh well...
Thanks, @business_guy, for the suggestions, especially running wpa_supplicant in foreground mode -- it became clear what was happening.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.