Bug 270994

Summary: Atheros scan failed with wpa_supplicant
Product: Base System Reporter: Henrich Hartzer <henrichhartzer>
Component: wirelessAssignee: Bjoern A. Zeeb <bz>
Status: Closed FIXED    
Severity: Affects Only Me CC: Alexander88207, bane.ivosev, bz, cy, euan
Priority: ---    
Version: 13.2-RELEASE   
Hardware: amd64   
OS: Any   

Description Henrich Hartzer 2023-04-21 23:07:44 UTC
Hi!

I'm having issues connecting to WPA wireless networks with wpa_supplicant. I have a AR93XX device. Running 13.2-RELEASE.

I can do `ifconfig wlan0 scan`, and it scans fine and detects the network.

But I see this "CTRL-EVENT-SCAN-FAILED" error over and over in /var/log/messages, or if I run `wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf` directly.

Successfully initialized wpa_supplicant
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1

It was able to connect at one point, when I ran wpa_supplicant directly. It worked very well and was very stable. I have other wifi devices on this network and don't suspect it's an issue with the network.

Would appreciate any ideas or let me know if I should share anything else.

I couldn't find a matching bug report, but maybe there is one.

Thanks!
Comment 1 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-04-22 17:52:46 UTC
This was recently likely fixed in main [2][3];  the changes haven't made it back to stable/13 yet;  I got no feedback on as requested on freebsd-wireless [1].

[1] https://lists.freebsd.org/archives/freebsd-wireless/2023-March/001182.html
[2] https://cgit.FreeBSD.org/src/commit/?id=bfb202c4554a72383202a1a401d80721935b8c95
[3] https://cgit.FreeBSD.org/src/commit/?id=052211e08c0e227277d0c4dc603bba2253eb3d73


If you have any chances to apply them locally and let us know if they help (do not forget to mergemaster/etcupdate! so that /etc/rc.d really gets updated) that would be great!
Comment 2 Henrich Hartzer 2023-04-23 21:42:30 UTC
Hi Bjoern,

I applied the patches, did `make buildkernel buildworld`, `make installkernel`, and `make installworld`, and `etcupdate`.

I haven't even rebooted and this is already working. It connected right away to my wireless network.

Should I also reboot to test the new drivers and report back?

Thank you so much! Really happy to have wifi again.

I hope this can be released as an update to 13.2 if this affects a lot of other users, too.

Thanks!

-Henrich
Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-04-23 22:18:50 UTC
(In reply to Henrich Hartzer from comment #2)

I'll try to MFC them next week when I am back home and I'll drop re@ an email and hopefully we can push an EN out for this.
A lot of thanks also go to Cy and also enweiwu.  I've just been the one adding logging to the change and commit it and enweiwu probably got very close to an actual root cause.

Can I kindly ask you to add debugging to wpa_supplicant and check the following (from my original freebsd-wireless email):

Could you check if you then see any log lines including "(changed)"  [beware most should be "(no change)" along with IFF_UP in the line from wpa_supplicant?
Comment 4 Henrich Hartzer 2023-04-24 16:53:17 UTC
(In reply to Bjoern A. Zeeb from comment #3)

How should I turn on debugging?

I added `-d` to `command_args` in `/etc/rc.d/wpa_supplicant`.

I did `service restart netif` and haven't seen any "(changed)" or "(no change)" logs. The logs look like how they did before.

That said, I haven't rebooted to use the new driver yet. Might that be the reason why?

Thanks!
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-04-24 17:13:29 UTC
(In reply to Henrich Hartzer from comment #4)

I cannot remember how many -ddd are needed.  Just beware that at some point it'll log credentials to syslog ( see the man page ).  Sorry for being sparse as I am travelling at the moment.  Let me know if you can get it setup or get output or not with -dd or -ddd.  Otherwise I'll get back to you towards the end of week.  There should be no need to reboot.
Comment 6 Henrich Hartzer 2023-04-24 22:20:09 UTC
(In reply to Bjoern A. Zeeb from comment #5)

Thank you! I tried `-dd` and `-ddd`, and am not seeing any kind of "changed"-related output in the logs.
Comment 7 Bane Ivosev 2023-04-25 07:14:32 UTC
I have a similar problem, tried on several Thinkpad's, both with iwn and iwm. After upgrade to 13.2-RELEASE wireless is working only after booting. For example, if I try to connect to another SSID and do /etc./rc.d/netif restart, then I have the same situation like Henrich, WLAN can't associate with AP anymore, with the same errors. Only a reboot helps.
Comment 8 Henrich Hartzer 2023-11-18 17:54:40 UTC
Hi again!

Not sure where we are with this, if we can still get it into stable/13.

Thanks!
Comment 9 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-11-18 18:27:18 UTC
(In reply to Henrich Hartzer from comment #8)

I am sorry.  I thought I had MFCed them.
There's one more to them nowadays.

If it's not done by the end of next week, can you politely remind me again?
I'll try to get all the other changes lined up to MFC then as well.
Comment 10 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-11-28 17:58:22 UTC
(In reply to Bjoern A. Zeeb from comment #9)

They were MFCed in June already:
https://cgit.freebsd.org/src/commit/?h=stable/13&id=ded53e898c7be6d610e94c1746fd22304f5c5988

Do you still see an issue on stable/13 ?
Comment 11 Henrich Hartzer 2023-11-29 07:04:40 UTC
(In reply to Bjoern A. Zeeb from comment #10)

Ah, thank you! So they should be fixed in 13.3? I'm on release/13.2, so that probably explains why it's still not working for me. I have to `ifconfig wlan0 up` after starting netif, and then it usually works fine.

Not quite sure if I want to move to stable/13.
Comment 12 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-11-29 15:56:31 UTC
(In reply to Henrich Hartzer from comment #11)

This particular problem should be fixed in 13.3-R then, yes.

If I were to give you a wpa_supplicant binary and and a startup script file to replace (save the current ones as .orig) to test, would you do that (at least temporary to know that things should be fixed)?

Or should we close this PR until 13.3-R comes out and only re-open in case there will be issues?
Comment 13 Henrich Hartzer 2023-12-30 01:51:29 UTC
I'm sorry for the wait. I ended up updating to 14.0 which is working great!

Can probably close this when 13.3 comes out, unless someone else wants to test.
Comment 14 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-01-29 15:36:13 UTC
Should be fixed in 13.3 or otherwise.
In case someone hits this again please re-open.
Comment 15 Euan Thoms 2024-02-12 11:47:20 UTC
Thanks Bjoern, the links to the patch saved me another lengthy upgrade to 14-RELEASE. I have just finished upgrading 2 machines from 12.4-RELEASE to 13.2-RELEASE and everything went smooth except the one machine on wifi (Atheros AR9462). It was not able to connect in WPA mode, but did in open mode. I had the same output from wpa_supplicant as Henrich. After patching and 'make buildworld; make buildkernel; make installkernel; make installworld; etcupdate' it worked right away, even before rebooting.

I am just reporting back that this has fixed the issue very nicely for me, and not signs of any issues yet. I'd like to add that on boot my mini-PCIe card not connects much faster than it did in 12.X-RELEASE. And I think it is much more stable as well. It is on the edge of the house wifi range. Where it would sometimes drop out when someone of something was placed in direct line of the AP, now it does not. I was about to sling and long cat5e cable through various attic spaces from another bedroom that does have wired wall sockets, but now I don't think I'll bother.

Thanks to everyone working on the Wifi stack, It's making FreeBSD much more viable is certain use cases. I look forward to testing the same Atheros cards in my home-made APs (using hostapd), I think they will also be more robust.
Comment 16 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-02-12 14:49:36 UTC
(In reply to Euan Thoms from comment #15)

Thanks for the feedback.  Much appreciated!