NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.94k stars 13.96k forks source link

nixos: VLAN interfaces are not brought up if systemd-resolved is enabled #349882

Open bjornfor opened 2 days ago

bjornfor commented 2 days ago

Describe the bug

network-setup.service is disabled when resolvconf is disabled:

https://github.com/NixOS/nixpkgs/blob/bb8c2cf7ea0dd2e18a52746b2c3a5b0c73b93c22/nixos/modules/tasks/network-interfaces-scripted.nix#L87-L94

And enabling systemd-resolved disables resolvconf. And without network-setup.service, VLAN interfaces (and presumably bridges, MACVLANs and all the other stuff) will not be brought up.

Steps To Reproduce

  1. Have a NixOS config with networking.vlans = ... and services.resolved.enable = true.
  2. Watch as the VLAN interfaces are not brought up.
  3. Disable systemd-resolved and watch the interfaces getting brought up (possibly after a reboot).

Expected behavior

Enabling systemd-resolved should not break VLAN interfaces.

Additional context

The code to disable network-setup.service based on resolvconf comes from ec00b4bb1186719bbee30a89ca7f519c30001abd ("nixos/network-interfaces-scripted: remove network-setup unit if unused"). Doesn't that sound like an optimisation rather than a fix? Can we just drop config.networking.resolvconf.enable from the condition?

Notify maintainers

Metadata

NixOS 24.05.


Add a :+1: reaction to issues you find important.

bjornfor commented 2 days ago

Ping @SuperSandro2000 due to https://github.com/NixOS/nixpkgs/commit/ec00b4bb1186719bbee30a89ca7f519c30001abd ("nixos/network-interfaces-scripted: remove network-setup unit if unused").

SuperSandro2000 commented 1 day ago

The conditions where based on the content of scripts at the time. If enabling resolvconf alone shouldn't create the unit, feel free to pr it. I don't have anything to test it against, i just dropped the unit from my system which I shouldn't have had based on my config.