3

The initial situation is quite simple:

  • I create a hotspot in a Linux machine: nmcli dev wifi hotspot con-name "John" (see below for the complete script)

  • I show the password (and QR code) with: nmcli d w s (abbreviated from nmcli dev wifi show-password)

  • The hotspot appears on my (Android 11) phone, and asks for the password. I scan the QR code, but can't connect. (Just in case, I also tried typing the password).

I more or less eliminated the Broadcom BCM4313 issues I suspected previously, as I created two 'live' version of the OS (Slackware64-current) and both manage hotspots just fine (at least without passwords).

In case of the live-versions, I can't find how to password protect the Hotspot. Even after specifying a PW (and restarting the hotspot), the Access Point remains open (and connectable without password).

Also, I tried wihotspot - a script specialized in creating hotspots - but could not get it to work at all.

(A possibly related: Quite frequently, the Android QR code reader reports formatting errors. But, as mentioned, entering the password manually fails too.)

What could I be doing wrong here? Could this be a problem with certificates?

UPDATE Using the instructions on this page, I manage to get the hotspot running, but only if I don't specify a password (ie. if I don't include the two lines in Step 4)

As soon as I include a password, the phone disconnects, and asks me to enter a password. Neither using QR code nor entering the pw manually gets a connection.

Notably, the phone icon did detect that the site was now protected by changing the Wifi icon. (To be sure, I first deleted the previous definition using nmcli c del xxx)

UPDATE 2 A few data asked for in the comments:

  • I tried several passwords - with and without special characters. Ultimately even tried 'password'
  • I made Android forget any of the registered records
  • Even made the phone reset the networking completely
  • journalctl doesn't get installed in Slackware, but I check /var/log syslog, .../messages etc, no indications of problems.

ACTUAL STATE: I have this script:

#!/bin/sh
CON_NAME="XXYY"
IF_NAME="wlan0"

case "$1" in
    'down')
        nmcli c down $CON_NAME
    ;;
    *)  
    nmcli c down $CON_NAME
    nmcli c del $CON_NAME
    nmcli c a type wifi ifname $IF_NAME con-name $CON_NAME autoconnect y ssid $CON_NAME
    nmcli c m $CON_NAME 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
    #nmcli c m $CON_NAME wifi-sec.key-mgmt wpa-psk
    #nmcli c m $CON_NAME wifi-sec.psk SimplePassword
    nmcli c up $CON_NAME
    ;;

If the script as ./start_ap.sh, the hotspot runs, is connectable, but is 'open'. If I run ./start_ap.sh down, the hostspot is disabled. If I uncomment the two lines near the end and put the SimplePassword in the phone, I can't connect anymore.

Yet more strangeness

Friday, while I was at the university, I asked a student of mine

  • to connect with his Android 9 phone to the hotspot (which had a password set), and he connected without problems!
  • as he had his notebook, he also tried to connect from there, and it failed.

So, these two cases indicate just about the opposite from my experience.

Not a solution!

Considering:

  • The errors occur with some Android phones, but not all (v9 worked, v10 and v11 failed, but only one phone of each version tested),
  • The errors occur with some laptops as client, but not all (a Windows client failed),
  • All tests were done with (or without) the same (simple) password, with the hotspot on the same laptop, using the same Broadcom chip,

I seem to have to have to conclude that:

  • It is not a direct hardware problem
  • It is not driver compatibility problem - not as far as driver seems to 'drive' the hardware.
  • There is still some possibility that there are timing issues, but not really protocol problems.
jcoppens
  • 687
  • 4
  • 16
  • What does your phone say, just "bad password"? What kind of thing are you using as a password? There are requirements for wpa-psk to be "8 to 63 characters" and certain symbols could get eaten by the shell. Also make sure to delete/forget the SSID in android. Maybe try and check if anything is getting written to the networkmanager logs like: `journalctl -u NetworkManager.service` – Cpt.Whale May 16 '22 at 17:27
  • @Cpt.Whale, added an UPDATE 2 to the original post. Thanks for the suggestions – jcoppens May 17 '22 at 17:08
  • Try the following [method1](https://ubuntuhandbook.org/index.php/2019/10/fix-wi-fi-hotspot-not-working-ubuntu-18-04/) and [method2](https://askubuntu.com/questions/937179/unable-to-connect-to-ubuntu-16-04-wi-fi-hotspot-wont-accept-password) for creating the hotspot. What is your distro? – harrymc May 19 '22 at 18:58
  • @harrymc, Thanks - had already tested both methods. Couldn't really list them all in the original post, but have been at this for a time now! Just to be clear, I _can_ connect if no password is set in the hotspot. – jcoppens May 19 '22 at 19:13
  • What is the exact error you get when a password is defined? – harrymc May 19 '22 at 19:16
  • Nothing at all: The phone just times out and retries every 10 seconds or so. The SSID gets moved to the 'Saved' list. – jcoppens May 19 '22 at 19:17
  • Have you tried to add encryption? Example [link](https://gbatemp.net/threads/how-to-setup-a-wep-hotspot-on-ubuntu-19-10.558820/). – harrymc May 19 '22 at 20:16
  • @harrymc, Not sure what you mean by that... The link you gave sets WEP encryption, but that is not very secure, and superseded by WPA-PSK. – jcoppens May 19 '22 at 20:27
  • Use any encryption method you like, the question is whether you tried it. – harrymc May 19 '22 at 21:21
  • Yes... WPA, WPA2 and WPA3. Tried them all. No luck. – jcoppens May 20 '22 at 04:33
  • Do you know someone that can test the hotspot with an iPhone or another computer? – harrymc May 20 '22 at 08:01
  • No. Everybody I know has Android phones. I might be able to take the laptop (with the problematic hotspot) elsewhere later, but I had an emergency yesterday and have to make up for time lost. – jcoppens May 20 '22 at 13:10
  • This sometimes happen with some Android ROMs and hidden SSIDs, do your hotspot has a hidden SSID ? – X.LINK May 21 '22 at 01:42
  • Hi @X.LINK. No, the SSID is visible on the phone. I did add a couple of strange experiences to the original post... Thanks! – jcoppens May 22 '22 at 17:20
  • Seems like it's a matter of hardware or driver incompatibility. – harrymc May 28 '22 at 07:59

1 Answers1

0

We also encountered this problem, the troubleshooting steps are as follows:

  1. vi /lib/systemd/system/wpa_supplicant.service, add the -dd parameter to the wpa_supplicant command line, and refresh the configuration with systemctl daemon-reload && systemctl restart wpa_supplicant.

  2. vi /var/log/syslog can see that after executing nmcli con up SSID, there are several prompts such as "Failed to clear default encryption keys (ifname=xxx keyidx=n)", indicating that the driver layer cannot perform the necessary cleanup on the keys stored in the ram of the wlan network card.

We had this problem on an armbian 20.04 system, the same hardware works fine on OpenWRT 19.07. So it should be a linux kernel or driver problem.

Temporary solution: Completely power off and restart (cold boot) the device (this ensures that the WLAN card memory is initialized to an clean state), and then execute nmcli con up SSID, then enter the password on the phone to connect to the AP normally.

Completely solve this problem may need to wait for bug fixes at the Linux kernel or driver level.

===============================

UPDATE:

We have this problem with two identical hardware boxes (NanoPi R1), one of the boxes has armbian installed, and the other has the official Uubntu 20.04 from the hardware manufacturer.

We tried disabling Network Manager (nmcli dev set wlan0 managed no) on both systems and then starting hostapd to take over the WLAN device (hostapd -dd /etc/hostapd/wlan0_ap.conf):

  • On armbian, hostapd fails to start and exits with an ioctl error.
  • On ubuntu provided by the box manufacturer, hostapd can be started normally, and the password problem of nmcli is perfectly solved.

Further observation found that on the ubuntu provided by the box manufacturer, there is an additional daemon named brcm_patchram_plus, whose startup command line is something like: /bin/brcm_patchram_plus -d --patchram /lib/firmware/ap6212 ..... We suspect that this daemon is responsible for the difference in performance between the two systems.

ASBai
  • 111
  • 2
  • Thanks for the suggestion and info! I think you mean 'Completely power of and restart the device' you mean the cell phone (I can't reboot the PC - it's in use for routing). I checked the syslog, but did not find any references to encryption. – jcoppens Jun 15 '22 at 20:45
  • I mean you need to power off and restart (cold boot) the **AP** device. You need to add the `-dd` argument to the wpa_supplicant service to see the log output. – ASBai Jun 15 '22 at 21:58
  • Ok... The 'AP device' is NM, on my home computer, which also runs as a router for other users, so I cannot switch the machine off at any time. At the beginning of my experiments I did this a couple of times but didn't notice any difference. I did not use the -dd option, so maybe I'll do a few more tests over the weekend. – jcoppens Jun 16 '22 at 01:19
  • @jcoppens I updated my answer, maybe you can try `hostapd`? – ASBai Jun 17 '22 at 19:13