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

Empty networking.nameservers wipes /etc/resolv.conf after a rebuild #61490

Open
angristan opened this issue May 14, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@angristan
Copy link
Contributor

commented May 14, 2019

Issue description

nixos-rebuild --switch wipes nameservers in /etc/resolv.conf when no networking.nameservers is set.

This began to happen a week or two ago, I think...

Someone else seems to be experiencing this: https://www.reddit.com/r/NixOS/comments/bohkz2/nixosrebuild_switch_causes_my_internet_to_die/

May be related to #61230.

Steps to reproduce

configuration.nix:

networking.networkmanager.enable = true;
# nothing about namesevers here.

After a fresh boot, the /etc/resov.conf is generated by NetworkManager (probably generated by resolvconf then overwritten by NetworkManager):

# Generated by NetworkManager
nameserver <whatever is pushed by my dhcp server>

After a nixos-rebuild --switch:

# Generated by resolvconf
options edns0

No resolvers available 😞

Quick fix: disconnect/reconnect to the network or manually edit the file.

Why would resolvconf rewrite this is no nameservers are defined?

If I define some:

networking.nameservers = [ "1.0.0.1" "1.1.1.1" ];

At boot, my resolv.conf is still generated by NetworkManager. After a rebuild, it's overwritten by networking.nameservers:

# Generated by resolvconf
nameserver 1.0.0.1
nameserver 1.1.1.1
options edns0

With networking.networkmanager.dns = "none", we can tell NetworkManager to not update resolv.conf. Would it be possible to have an option for the other way around?

In the doc for networking.nameservers:

The list of nameservers. It can be left empty if it is auto-detected through DHCP.

If it's empty it's supposed to not update /etc/resolv.conf then, right?

I'm a bit confused, so please tell me if I missed something 🙂

Technical details

  • system: "x86_64-linux"
  • host os: Linux 5.0.14, NixOS, 19.09pre179307.bc94dcf5002 (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(root): "nixos-19.09pre179307.bc94dcf5002, home-manager, nixos-hardware"
  • channels(stanislas): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

@angristan angristan changed the title nixos-rebuild --switch wipes nameservers in /etc/resolv.conf Empty networking.nameservers wipes /etc/resolv.conf after a rebuild May 14, 2019

@talyz

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

I also have this problem. It seems to be because NetworkManager's default setting for rc-manager has changed from "resolvconf" to "symlink" - at least the behavior indicates this, even if the documentation states that "symlink" is and was the default setting.

I've fixed it in my config by setting

networking.networkmanager.extraConfig = ''
 [main]
 rc-manager=resolvconf
'';
@evanjs

This comment has been minimized.

Copy link

commented May 22, 2019

As mentioned here, it seems like #60904 might be related?
In particular:

# Default is symlink, we previously used resolvconf, dunno.
    "-Dconfig_dns_rc_manager_default=resolvconf"

talyz added a commit to talyz/nixpkgs that referenced this issue May 23, 2019

networkmanager: Add rc-manager option
Add an option to set the rc-manager parameter in NetworkManager.conf,
which controls how NetworkManager handles resolv.conf. This sets the
default rc-manager to "resolvconf", which solves NixOS#61490. It
additionally allows the user to change rc-manager without interference
from configuration activations.

@talyz talyz referenced this issue May 23, 2019

Open

networkmanager: Add rc-manager option #61949

4 of 10 tasks complete
@talyz

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

Ah, interesting. That would probably solve this as well...

talyz added a commit to talyz/nixpkgs that referenced this issue May 24, 2019

networkmanager: Add rc-manager option
Add an option to set the rc-manager parameter in NetworkManager.conf,
which controls how NetworkManager handles resolv.conf. This sets the
default rc-manager to "resolvconf", which solves NixOS#61490. It
additionally allows the user to change rc-manager without interference
from configuration activations.

talyz added a commit to talyz/nixpkgs that referenced this issue May 24, 2019

networkmanager: Add rc-manager option
Add an option to set the rc-manager parameter in NetworkManager.conf,
which controls how NetworkManager handles resolv.conf. This sets the
default rc-manager to "resolvconf", which solves NixOS#61490. It
additionally allows the user to change rc-manager without interference
from configuration activations.

sboehler added a commit to sboehler/nixos-config that referenced this issue May 30, 2019

evanjs added a commit to evanjs/nixos_cfg that referenced this issue May 30, 2019

@xaverdh

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

Ping.
Any progress on fixing this? / What would be the right approach to fix this in nixpkgs?

evanjs added a commit to evanjs/nixos_cfg that referenced this issue Jun 10, 2019

@abbradar abbradar referenced a pull request that will close this issue Jun 10, 2019

Open

resolvconf service: init #62955

3 of 10 tasks complete

abbradar added a commit to abbradar/nixpkgs that referenced this issue Jun 10, 2019

resolvconf service: init
This is a refactor of how resolvconf is managed on NixOS. We split it
into a separate service which is enabled internally depending on whether
we want /etc/resolv.conf to be managed by it. Various services now take
advantage of those configuration options, in particular NetworkManager
which fixes NixOS#61490.

abbradar added a commit to abbradar/nixpkgs that referenced this issue Jun 10, 2019

resolvconf service: init
This is a refactor of how resolvconf is managed on NixOS. We split it
into a separate service which is enabled internally depending on whether
we want /etc/resolv.conf to be managed by it. Various services now take
advantage of those configuration options, in particular NetworkManager
which fixes NixOS#61490.

abbradar added a commit to abbradar/nixpkgs that referenced this issue Jun 10, 2019

resolvconf service: init
This is a refactor of how resolvconf is managed on NixOS. We split it
into a separate service which is enabled internally depending on whether
we want /etc/resolv.conf to be managed by it. Various services now take
advantage of those configuration options, in particular NetworkManager
which fixes NixOS#61490.

abbradar added a commit to abbradar/nixpkgs that referenced this issue Jun 10, 2019

resolvconf service: init
This is a refactor of how resolvconf is managed on NixOS. We split it
into a separate service which is enabled internally depending on whether
we want /etc/resolv.conf to be managed by it. Various services now take
advantage of those configuration options, in particular NetworkManager
which fixes NixOS#61490.

abbradar added a commit to abbradar/nixpkgs that referenced this issue Jun 10, 2019

resolvconf service: init
This is a refactor of how resolvconf is managed on NixOS. We split it
into a separate service which is enabled internally depending on whether
we want /etc/resolv.conf to be managed by it. Various services now take
advantage of those configuration options, in particular NetworkManager
which fixes NixOS#61490.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.