network: reconnect WiFi at boot when wifi.enabled is set

WiFi was refactored from connman to iwd (wifictl uses iwctl), but iwd is
dbus-activated and nothing re-associates it to the saved network at boot.
The result: a unit rebooted with WiFi on comes up with the ES toggle
showing active but no connection, and the user has to flip the toggle off
and on to reconnect.

The ES "Enable WiFi" toggle reconnects via `wifictl enable` (rfkill
unblock) + `wifictl connect` (scan + associate to the saved iwd profile,
ApiSystem::enableWifi). Mirror that in 099-networkservices, which already
owns the network domain at boot and runs after network.target. The
connect is backgrounded so the scan does not delay the UI, and wifictl
no-ops when there is no WiFi device.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Douglas Teles
2026-06-26 18:06:02 -03:00
parent 1ba3d6ef92
commit ae837498a3
@@ -40,3 +40,15 @@ do
;;
esac
done
# Reconnect WiFi at boot. iwd is dbus-activated and nothing re-associates it
# to the saved network here, so a unit rebooted with WiFi on comes back with
# the toggle showing active but no connection (the user otherwise has to flip
# it off and on). The ES "Enable WiFi" toggle reconnects by running
# `wifictl enable` (rfkill unblock) then `wifictl connect` (scan + associate
# to the saved iwd profile), so mirror that here. Backgrounded so the scan
# does not delay the UI; wifictl is a no-op when there is no WiFi device.
if [ "$(get_setting wifi.enabled)" = "1" ]; then
/usr/bin/wifictl enable
nohup /usr/bin/wifictl connect >/dev/null 2>&1 &
fi