Skip to content

nixos/wireless: fix failure with no interfaces#104722

Merged
rnhmjoj merged 1 commit intoNixOS:masterfrom
rnhmjoj:wpa-fix
Dec 15, 2020
Merged

nixos/wireless: fix failure with no interfaces#104722
rnhmjoj merged 1 commit intoNixOS:masterfrom
rnhmjoj:wpa-fix

Conversation

@rnhmjoj
Copy link
Contributor

@rnhmjoj rnhmjoj commented Nov 23, 2020

Motivation for this change

This resolves issue #101963.

When the service is started and no interface is ready yet, wpa_supplicant
is being exec'd with no -i flags, thus failing. Once the interfaces
are ready, the udev rule would fire but wouldn't restart the unit because
it wasn't currently running (see systemctl(1) try-restart).

The solution is to exit (with a clear error message) but always restart
wpa_supplicant when the interfaces are modified.

Things done
  • Tested wpa_supplicant service is restarted
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This resolves issue NixOS#101963.

When the service is started and no interface is ready yet, wpa_supplicant
is being exec'd with no `-i` flags, thus failing. Once the interfaces
are ready, the udev rule would fire but wouldn't restart the unit because
it wasn't currently running (see systemctl(1) try-restart).

The solution is to exit (with a clear error message) but always restart
wpa_supplicant when the interfaces are modified.
@rnhmjoj rnhmjoj requested review from bendlas, flokli and globin November 23, 2020 23:49
@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Nov 24, 2020
# Restart wpa_supplicant when a wlan device appears or disappears.
services.udev.extraRules = ''
ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="/run/current-system/systemd/bin/systemctl try-restart wpa_supplicant.service"
ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="/run/current-system/systemd/bin/systemctl restart wpa_supplicant.service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented Dec 15, 2020

Thank you. I'm merging this because the problem is starting to get annoying.

@rnhmjoj rnhmjoj merged commit 12f367b into NixOS:master Dec 15, 2020
@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented Dec 15, 2020

Backport to 20.09: 645b8a3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants