fix: harden NetworkManager hotspot creation to prevent supplicant-timeout errors on Pi 3B
This commit is contained in:
@ -141,24 +141,27 @@ echo "Configuring Networking..."
|
|||||||
rfkill unblock wlan || true
|
rfkill unblock wlan || true
|
||||||
|
|
||||||
if command -v nmcli > /dev/null; then
|
if command -v nmcli > /dev/null; then
|
||||||
echo "NetworkManager detected. Configuring hotspot (WiFi-Safe)..."
|
echo "NetworkManager detected. Configuring stable hotspot..."
|
||||||
# Clean up any existing MPVJ connection
|
# Clean up existing profiles
|
||||||
nmcli con delete MPVJ-AP 2>/dev/null || true
|
nmcli con delete MPVJ-AP 2>/dev/null || true
|
||||||
|
|
||||||
# Create the Access Point profile (but don't activate it yet)
|
# Ensure wlan0 is not connected to anything else (prevents supplicant-timeout)
|
||||||
|
nmcli device set wlan0 autoconnect no
|
||||||
|
nmcli device disconnect wlan0 2>/dev/null || true
|
||||||
|
|
||||||
|
# Create the Access Point with specific 2.4GHz settings for Pi 3B stability
|
||||||
nmcli con add type wifi ifname wlan0 mode ap con-name MPVJ-AP autoconnect yes ssid "$WIFI_SSID"
|
nmcli con add type wifi ifname wlan0 mode ap con-name MPVJ-AP autoconnect yes ssid "$WIFI_SSID"
|
||||||
nmcli con modify MPVJ-AP 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
|
nmcli con modify MPVJ-AP 802-11-wireless.mode ap 802-11-wireless.band bg
|
||||||
|
nmcli con modify MPVJ-AP ipv4.method shared ipv4.addresses 192.168.4.1/24
|
||||||
nmcli con modify MPVJ-AP wifi-sec.key-mgmt wpa-psk
|
nmcli con modify MPVJ-AP wifi-sec.key-mgmt wpa-psk
|
||||||
nmcli con modify MPVJ-AP wifi-sec.psk "$WIFI_PASS"
|
nmcli con modify MPVJ-AP wifi-sec.psk "$WIFI_PASS"
|
||||||
nmcli con modify MPVJ-AP ipv4.addresses 192.168.4.1/24
|
|
||||||
nmcli con modify MPVJ-AP connection.autoconnect-priority 100
|
nmcli con modify MPVJ-AP connection.autoconnect-priority 100
|
||||||
|
|
||||||
# Ensure hostapd/dnsmasq are disabled
|
# Ensure legacy services are out of the way
|
||||||
systemctl stop hostapd dnsmasq 2>/dev/null || true
|
systemctl stop hostapd dnsmasq 2>/dev/null || true
|
||||||
systemctl disable hostapd dnsmasq 2>/dev/null || true
|
|
||||||
systemctl mask hostapd dnsmasq 2>/dev/null || true
|
systemctl mask hostapd dnsmasq 2>/dev/null || true
|
||||||
|
|
||||||
echo "NetworkManager Hotspot 'MPVJ-AP' configured."
|
echo "Stable NetworkManager Hotspot configured."
|
||||||
else
|
else
|
||||||
echo "Using legacy hostapd/dnsmasq logic..."
|
echo "Using legacy hostapd/dnsmasq logic..."
|
||||||
# hostapd
|
# hostapd
|
||||||
|
|||||||
Reference in New Issue
Block a user