Repository navigation
feat(linux-host): keep Wi-Fi from power saving under systemd-networkd - #174
Merged
Merged
Conversation
The Wi-Fi power save step only knew NetworkManager and failed on a host without it. The stack is now read from the host: NetworkManager when it lists a Wi-Fi device it manages, else systemd-networkd when it is running and the kernel has a Wi-Fi network device. Neither systemd.network, systemd.link nor netplan has a power save setting, so a udev rule has systemd start a oneshot unit that runs `iw dev <interface> set power_save off` when each Wi-Fi interface appears, ordered after the interface's device unit. iw is installed with apt and the radio is also switched off now. A host where neither stack manages a Wi-Fi device still fails.
Mearman
marked this pull request as ready for review
November 2, 2026 23:51
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
🎉 This PR is included in version 2.20.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
github_runner_linux_host_wifi_powersave_off: truefailed on any host without NetworkManager, because it read the Wi-Fi devices withnmcli. It now reads the stack from the host: NetworkManager whennmclilists a Wi-Fi device that is not unmanaged (unchanged path), else systemd-networkd when it is running and the kernel has a Wi-Fi network device (aphy80211link under/sys/class/net). A host where neither manages one still fails, and a host with no Wi-Fi device and an answering stack is still left alone.systemd 259's
systemd.networkandsystemd.linkhave no power save setting (the only wireless options are matching ones), nor does netplan, so there is nothing to configure in networkd. The role installsiwwith apt and writes a udev rule plus a oneshot unit template: the rule addsSYSTEMD_WANTS=github-runner-wifi-powersave@$name.servicefor eachDEVTYPE=wlaninterface, and the unit runsiw dev %i set power_save off, bound to and ordered aftersys-subsystem-net-devices-%i.device(the patternwpa_supplicant@.serviceuses). Using$namekeeps it right after a.linkrename, and the rule covers a Wi-Fi adapter plugged in later. brcmfmac stores the preference in its own state and applies it whenever it brings the firmware up, so it holds across reconnects. The radio is also switched off now, and on this path aniwthat cannot read an interface fails the run.The NetworkManager tasks moved into
wifi_powersave_networkmanager.ymland behave as before on a host where it manages a Wi-Fi device; the radio read and set is shared inwifi_powersave_radio.yml. The one difference there is that a Wi-Fi devicenmclilists as unmanaged no longer counts as NetworkManager's.Tested against the usual stand-ins in
tests/unit/test_linux_host.py(a networkd host with awifi0interface, idempotence,--check, iw already installed, a non-apt host, an unreadable radio, NM with an unmanaged device, neither stack). Not run against a real host. Breaking the rule'sDEVTYPEmatch makes the networkd test fail.