Pack3tL0ss / ConsolePi

Raspberry Pi Based Serial Console Server, with PushBullet Notification of IP changes, Automatic VPN termination, custom menu, Power Outlet Control, and a lot more
MIT License
193 stars 16 forks source link

AutoHotSpot not working on Raspbian 12? #204

Closed jango22 closed 1 month ago

jango22 commented 2 months ago

I have installed the script on fresh raspbian installs twice now, initially with the wireless network configured in the image creation tool and the other time with the wireless network configured using nmtui after booting and both ways the autohotspot script seems to either skip attempting to connect to the configured network manager ssid or it doesnt wait long enough. also nothing shows in the log file at /var/log/ConsolePi/Consolepi.log about the attempt to connect to the configured SSID so I can't see if its failing or connecting and getting removed after.

here is all that is present in the consolepi.log:

08/07/2024 11:16:43 AM [2523][WARNING]: No ser2net configuration found to extract serial port settings from, using defaults
08/07/2024 11:16:51 AM [2549][WARNING]: No ser2net configuration found to extract serial port settings from, using defaults
Aug 07 11:26:38 [633][DEBUG][NM-dispatcher:none:hostname:] ignoring hostname event on none
Aug 07 11:26:39 [754][DEBUG][NM-dispatcher::connectivity-change:] ignoring connectivity-change event on nul
Aug 07 11:26:39 [815][DEBUG][NM-dispatcher:lo:up:lo] ignoring up event on lo
Aug 07 11:26:52 [905][INFO][NM-dispatcher:wlan0:up:hotspot] [stash_new_ip] wlan0 IP change detected from undefined to 10.110.0.1
Aug 07 11:26:52 [905][INFO][NM-dispatcher:wlan0:up:hotspot] NM hotspot up starting hotspot DHCP
Aug 07 11:26:52 [905][INFO][NM-dispatcher:wlan0:up:hotspot] Domain will not be advertised to hotspot clients.  No domain on eth0.
Aug 07 11:26:53 [905][INFO][NM-dispatcher:wlan0:up:hotspot] Bringing up hotspot with no gateway. No connection to the internet.
Aug 07 11:26:53 [905][WARNING][NM-dispatcher:wlan0:up:hotspot] hotspot DHCP startup returned non-zero return code: 5
Aug 07 11:26:55 [1191][DEBUG][NM-dispatcher::connectivity-change:] ignoring connectivity-change event on nul
08/07/2024 11:27:00 AM [833][INFO]: No Remotes found in Local Cache
08/07/2024 11:27:00 AM [833][INFO]: [MDNS DSCVRY] Discovering ConsolePis via mdns - Debug Enabled: False
jango22 commented 2 months ago

I am running headless on a zero 2 w with wifi as the primary intended connection no ethernet is connected.

jango22 commented 2 months ago

I think this may be fixed by increasing the priority of the wifi connection. nmcli connection modify SSID connection.autoconnect-priority 10 I'll need to test if auto hotspot is even enabled at the moment I might have ended up with it staying disabled. it takes some fiddling to know if its working when the ssid is available.

Pack3tL0ss commented 2 months ago

@jango22 I had to re-write all the auto-hotspot stuff for Raspbian 12, given the changes. The automatic fallback is now handled by NetworkManager as it has the capability.

The hotspot priority is set to 1. I think there was some logic to it being set, but I can't recall what. Either way any profiles created has to have a priority set higher than the hotspot. If I leave it at default, and new SSIDs are created without a priority, then I don't think it's predictable what profile will be applied (hotspot needs to be the lowest priority).

That's likely the issue. I'll make sure the docs/readme, and installer both spell that out clearly, I'm pretty sure I forgot to highlight that important detail after the overhaul for Raspbian 12.

jango22 commented 2 months ago

Ah I gotcha. It seems to work as intended once I added the priority value so that makes sense. Thanks for the confirmation. :)

Pack3tL0ss commented 1 month ago

Marking this as a bug, the AutoHotspot template for NetworkManager installs should have the autoconnect-priority=-999. NetworkManager defaults to priority 0, but allows for negative priority, using a negative number will ensure any user created connections are attempted prior to falling back to hotspot.