Fix wpa_supplicant conflict and firstboot robustness

- Remove generic wpa_supplicant.service symlink when wpa_supplicant@wlan0 is enabled — both services fight over wlan0 causing WiFi instability and SSH drops
- Add udev rule to disable WiFi power saving (aw859a drops connections under load with power save on)
- Drop set -e from firstboot script so a failing step does not kill the whole run
- Guard setup.sh call — skip gracefully if not present (dev/test scenario)

Fixes #295 and #296
This commit is contained in:
Cobra
2026-04-07 21:50:51 -04:00
parent 1803c54182
commit d66b547045
+18 -4
View File
@@ -534,6 +534,16 @@ EOF
"${WPA_WANTS}/wpa_supplicant@wlan0.service"
fi
# Disable the generic wpa_supplicant.service — it conflicts with @wlan0 instance
# Both would fight over wlan0, causing WiFi instability and SSH drops
rm -f "${MOUNT_POINT}/etc/systemd/system/multi-user.target.wants/wpa_supplicant.service"
# Disable WiFi power saving — aw859a driver drops under load with power save on
mkdir -p "${MOUNT_POINT}/etc/udev/rules.d"
cat > "${MOUNT_POINT}/etc/udev/rules.d/70-wifi-pm.rules" << 'EOF'
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*", RUN+="/usr/sbin/iw dev %k set power_save off"
EOF
info "WiFi profile written (SSID: ${WIFI_SSID})"
fi
@@ -665,9 +675,9 @@ step "Installing first-boot service..."
cat > "${MOUNT_POINT}/root/bb-firstboot-run.sh" << 'RUNEOF'
#!/usr/bin/env bash
# Runs once on first boot, then disables itself
set -euo pipefail
LOG=/root/bb-firstboot.log
exec >> "$LOG" 2>&1
set -uo pipefail
echo "=== BigBrother first-boot setup: $(date) ==="
@@ -687,9 +697,13 @@ done
source /root/bb-config.env
# Install BigBrother
cd /root/bb-src
bash setup.sh --enable-service
# Install BigBrother (skip if setup.sh not present — dev/test mode)
if [[ -f /root/bb-src/setup.sh ]]; then
cd /root/bb-src
bash setup.sh --enable-service || echo "[-] BigBrother setup.sh failed (non-fatal)"
else
echo "[-] bb-src/setup.sh not found — skipping BigBrother install"
fi
# VPN setup
if [[ "${BB_VPN:-}" == "tailscale" && -n "${BB_TAILSCALE_KEY:-}" ]]; then