Open l0b0 opened 5 years ago
I can link related issues:
resolvconf
service was added recently https://github.com/NixOS/nixpkgs/pull/62955Doesn't really help but this seems to work fine when initializing a VM from scratch, so I suppose what doesn't work is the action of (nixos-rebuild) switching while adding a new nameserver.
nix-build -E 'let pkgs = import <nixpkgs> {}; in with import <nixpkgs/nixos> {
configuration = {
users.extraUsers.root.initialHashedPassword = "";
virtualisation.graphics = false;
environment.systemPackages = with pkgs; [ vim ];
documentation.nixos.enable = false;
networking.networkmanager.enable = true;
networking.networkmanager.appendNameservers = [ "1.2.3.5.6" ];
}; }; vm' && rm ./nixos.qcow2 && ./result/bin/run-nixos-vm
Could this be caused by my VPN connection?
This seems likely to me. The DNS setup is overridden by a script that is placed in NetworkManager's dispatcher.d and without being aware of any NetworkManager internals my assumption is that there is something in VPN configurations that runs later and takes precedence.
We experimented with running a VM with this option set (with no additional network configuration) and the nameservers showed up as expected.
@l0b0 Could you try this without your VPN config?
@tazjin Removing the VPN configuration, rebuilding and switching did not work – resolvconf -l
still lists only the local DNS server. I should've probably mentioned the VPN connection has autoStart = false;
, so at least the service itself very likely did not cause this.
Same issue here (same steps to reproduce).
Removing blocker, since this doesn't prevent systems from booting etc and isn't a 19.03 → 19.09 regression. Of course, I'm happy if anyone has a fix to cherry-pick to 19.09 :)
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
I no longer need appendNameservers
, so I won't have time to follow up on this. Closing.
From what I can tell it's correct that resolvconf -l
does not show the additional nameservers as they are written directly into /etc/resolv.conf
by the dispatcher script.
resolvconf
afaict uses the files in /run/resolveconf/interface
to create the output of -l
.
/run/resolvconf/interfaces/NetworkManager
does not contain the additional nameservers, as they are added by the dispatcher script.
I think the flow is something like this:
/run/resolvconf/interfaces/NetworkManager
file/etc/resolv.conf
/etc/resolv.conf
with appendNameservers
& insertNameservers
So overall it is really janky and not at all obvious.
I think appendNameservers
& insertNameservers
are better suited when not using resolvconf
:
networking.resolvconf.enable = false;
networking.networkmanager.settings.main.rc-manager
to "file"
or "symlink"
.The workaround from @l0b0
Adding the host to networking.nameservers instead worked. The original bug report stands, since networking.nameservers are added before the DHCP name server(s), while appendNameservers should add secondary etc. name servers.
is also good if one does not want to disable resolvconf
, as it results in the creation of /run/resolvconf/interfaces/static
which then also shows up with resolvconf -l
. In my tests the nameservers from networking.nameservers
were added after the NetworkManager nameservers.
I hope this helps someone who stumbles upon this :slightly_smiling_face:
@jtojnar what do you think about this? Should we directly expose rc-manager
via the module and add assertions that prevent the usage of appendNameservers
& insertNameservers
when rc-manager
is not "file"
or "symlink"
and when networking.resolvconf
is enabled?
Describe the bug Values in this option do not seem to do anything.
To Reproduce Steps to reproduce the behavior:
networking.networkmanager.appendNameservers = [ "[some IP address]" ];
to /etc/nixos/configuration.nixsudo nixos-rebuild switch
resolvconf -l
Expected behavior There should be a
nameserver
entry in the resolvconf entry with the given appended name server.Actual behavior There is only one
nameserver
entry containing the local router address:Additional context In my case
networkmanager.appendNameservers
is in an included file, but other options from the file are included in the configuration, so it should work.Weirdly, even setting an additional DNS server in the currently active NetworkManager connection does't change the
resolvconf -l
output or even seem to have any effect. Could this be caused by my VPN connection?Workaround
Adding the host to
networking.nameservers
instead worked. The original bug report stands, sincenetworking.nameservers
are added before the DHCP name server(s), whileappendNameservers
should add secondary etc. name servers.Metadata