Fix regulatory domain persistence for 5GHz AP on boot

Problem: wlan1 regulatory domain not set on boot, defaults to 2.4GHz-only mode,
preventing channel 149 (5GHz) from being available. hostapd fails on startup.

Solution:
1. Modified regdomain.service to:
   - Run BEFORE hostapd/hostapd-2g services (Before= directive)
   - Run earlier in boot (After= sysinit.target)
   - RemainAfterExit=yes to persist setting

2. Added 80-regdomain.rules udev rule:
   - Triggers on regulatory device changes
   - Executes 'iw reg set CA' automatically

3. Added hostapd drop-in config:
   - Explicitly requires regdomain.service
   - Adds Wants= to ensure it starts

This ensures the regulatory domain is set BEFORE hostapd attempts to use
channel 149, fixing the boot-time AP failure loop.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-18 18:45:59 -04:00
co-authored by Claude Haiku 4.5
parent 2b00157642
commit 1002f86172
4 changed files with 13 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
# Set wireless regulatory domain on boot
# Trigger when regulatory device appears
SUBSYSTEM=="regulatory", ACTION=="change", RUN+="/usr/sbin/iw reg set CA"
+4
View File
@@ -0,0 +1,4 @@
# Ensure regdomain.service runs before hostapd
[Unit]
After=regdomain.service
Wants=regdomain.service
+3 -2
View File
@@ -1,9 +1,10 @@
[Unit]
Description=Set wireless regulatory domain
After=network-pre.target
Before=NetworkManager.service
After=network-pre.target sysinit.target
Before=hostapd.service hostapd-2g.service NetworkManager.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/iw reg set CA
[Install]
WantedBy=multi-user.target
+3
View File
@@ -116,9 +116,11 @@ fi
echo "== access point =="
install_rendered ap/hostapd.conf /etc/hostapd/hostapd.conf
install -D -m0644 ap/hostapd-restart.conf /etc/systemd/system/hostapd.service.d/restart.conf
install -D -m0644 ap/hostapd-regdomain.conf /etc/systemd/system/hostapd.service.d/regdomain.conf
install -D -m0644 ap/default-hostapd /etc/default/hostapd
install_rendered ap/hostapd-2g.conf /etc/hostapd/hostapd-2g.conf
install_rendered ap/hostapd-2g.service /etc/systemd/system/hostapd-2g.service
install -D -m0644 ap/hostapd-regdomain.conf /etc/systemd/system/hostapd-2g.service.d/regdomain.conf
install_rendered ap/11-van-ap-2g.network /etc/systemd/network/11-van-ap-2g.network
install -D -m0644 ap/van-ap-watchdog-2g.service /etc/systemd/system/van-ap-watchdog-2g.service
install -D -m0755 ap/van-ap-watchdog /usr/local/sbin/van-ap-watchdog
@@ -139,6 +141,7 @@ install_rendered ap/van-ap-unmanaged.conf /etc/NetworkManager/conf.d/van-ap-un
ln -sfn /dev/null /etc/systemd/network/zzzz-dracut-default.network
install -D -m0644 ap/nftables.conf /etc/nftables.conf
install -D -m0644 ap/regdomain.service /etc/systemd/system/regdomain.service
install -D -m0644 ap/80-regdomain.rules /etc/udev/rules.d/80-regdomain.rules
install -D -m0644 ap/rtw89.conf /etc/modprobe.d/rtw89.conf
install -D -m0644 ap/99-van-router.conf /etc/sysctl.d/99-van-router.conf