Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wpa_supplicant] Missing dbus dependency in service file...? #138900

Closed
VergeDX opened this issue Sep 22, 2021 · 7 comments
Closed

[wpa_supplicant] Missing dbus dependency in service file...? #138900

VergeDX opened this issue Sep 22, 2021 · 7 comments
Assignees
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@VergeDX
Copy link
Member

VergeDX commented Sep 22, 2021

Describe the bug

The wpa_supplicant.service file, generated by networking.wireless module.
Seems it is missing dependency to dbus, so it cannot autostart on my rpi 4b.

The service will wait for the wlan0 interface, and it will start.
But from my test, the service does not start after the device unit is ready, and idk how to debug...

Then I added a config (systemd.services."wpa_supplicant".serviceConfig = { "Type" = "dbus"; };).
It fixes this issue, but I think this maybe is a bug in the wireless module.

My question is why no dbus dependency in the wpa_supplicant service.
Or maybe the dependency is implicit? Or I'm wrong...?

Steps To Reproduce

Steps to reproduce the behavior:

  1. Build rpi img from this nix file: https://github.com/VergeDX/config-nixpkgs/blob/440312ca7fa847b02ad702e18ff87982c3434e4a/rpi/sd-image.nix.
  2. You may also specify the networking.wireless.interfaces, see:
    wpa_supplicant service fails at boot, but starts fine after boot (with systemctl start wpa_supplicant) #101963 (comment)
  3. write and boot from sd card, wpa_supplicant will not auto start.

Expected behavior

wpa_supplicant should auto start, instead of inactive (dead).

Additional context

Here is systemd document: https://www.freedesktop.org/software/systemd/man/systemd.service.html.
It says Type = dbus will implicit dependency on dbus.socket.

Notify maintainers

@globin

Metadata

(I build the img via latest nixos-21.05 channel. )

 - system: `"x86_64-linux"`
 - host os: `Linux 5.13.13-zen1, NixOS, 21.05.3294.3397f0ede9e (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20210908_3c56f62`
 - channels(root): `"nixos-21.05.3294.3397f0ede9e"`
 - channels(vanilla): `"home-manager, nixpkgs-21.11pre317242.bc9b956714e"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@VergeDX VergeDX added the 0.kind: bug Something is broken label Sep 22, 2021
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Sep 22, 2021

How many wireless interfaces have you configured? If you specify two or more, an equal number of services is started and dbus can't handle that. To put simple:

  1. interfaces = []:
    a single wpa_supplicant that binds to the first available interface. dbusControlled = true by default

  2. interfaces = [ "wlan0" ]:
    a single wpa_supplicant that binds to wlan0, dbusControlled = true by default

  3. interfaces = [ "wlan0" "wlan1" ]:
    two independent wpa_supplicant, implies dbusControlled = false

  4. etc

@rnhmjoj rnhmjoj self-assigned this Sep 22, 2021
@rnhmjoj rnhmjoj added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Sep 22, 2021
@VergeDX
Copy link
Member Author

VergeDX commented Sep 22, 2021

@rnhmjoj It seems the dbusControlled = true option only exists in nxios-unstable channel...
I build the img is in nixos-21.05, did you mean this issue is fixed in nxios-unstable...?
Maybe I should build the different img and observe the difference, sorry for bothering ;w;

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Sep 22, 2021

Ah, sorry, I assumed you were talking about nixos-unstable because the networking.wireless modules has been heavily reworked recently. In 21.05 wpa_supplicant always enable the dbus control interface, but I'm not sure that's what you're talking about, now...

Then I added a config (systemd.services."wpa_supplicant".serviceConfig = { "Type" = "dbus"; };).

This changes how the wpa_supplicant service works in NixOS. It may solve your particular issue but is not needed in general.

I need more details to figure out why it's failing. What does the journal (journalctl -u wpa_supplicant) say?

@VergeDX
Copy link
Member Author

VergeDX commented Sep 22, 2021

Here are all service files for all combinations ([21.05 & unstable] x [empty & wlan0]): wpa_supplicant.zip
file name "empty" means interfaces = [ ], wlan0 means interfaces = [ "wlan0" ].

It seems if we specify the interfaces = [ "wlan0" ], the two extra line will appended:
After=sys-subsystem-net-devices-wlan0.device and Requires=sys-subsystem-net-devices-wlan0.device

diff nixos-21.05-empty.service nixos-21.05-wlan0.service
1a2
> After=sys-subsystem-net-devices-wlan0.device
3a5
> Requires=sys-subsystem-net-devices-wlan0.device
13c15
< ExecStart=/nix/store/cwniml0kdpghx2dlcjywi9d4lnwrxxlz-unit-script-wpa_supplicant-start/bin/wpa_supplicant-start
---
> ExecStart=/nix/store/4cvg6fkp9a1j1rvpg7y4bh96w77iq5pw-unit-script-wpa_supplicant-start/bin/wpa_supplicant-start
diff nixos-unstable-empty.service nixos-unstable-wlan0.service
1a2
> After=sys-subsystem-net-devices-wlan0.device
3c4,5
< Description=WPA Supplicant instance
---
> Description=WPA Supplicant instance for interface wlan0
> Requires=sys-subsystem-net-devices-wlan0.device
13c15
< ExecStart=/nix/store/0cpyx7x8zh75d8wh043nqvkck05wrx85-unit-script-wpa_supplicant-start/bin/wpa_supplicant-start
---
> ExecStart=/nix/store/siz9fn5mm9ms57pv9wazh94izx48lch8-unit-script-wpa_supplicant-wlan0-start/bin/wpa_supplicant-wlan0-start

Next step I will try there 4 img and feedback journalctl -u wpa_supplicant log : )

@VergeDX
Copy link
Member Author

VergeDX commented Sep 22, 2021

journalctl -u wpa_supplicant in all test group are -- No entries --.
systemctl status wpa_supplicant in all test group are Loaded, inactive (dead).

That's really confused... What can I do next...?
BTW, I import nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix to build img,
I guess it break the network.wireless module.......?

@VergeDX VergeDX closed this as completed Sep 22, 2021
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Sep 22, 2021

journalctl -u wpa_supplicant in all test group are -- No entries --.

Uhm, this is suspicous: it looks like as if the service were masked.
If it failed to start, the log would at least contains something.

Why did you close the issue?

@VergeDX
Copy link
Member Author

VergeDX commented Sep 23, 2021

I import aarch64-installer.nix to build rpi img, I think that's the reason wpa service masked...
I need do more research instead of assume module is broken.

I just curious why wpa service not depends on dbus, but you have already answered.

Thanks for helping again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

No branches or pull requests

2 participants