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
networkmanager: Add rc-manager option #61949
Conversation
<para> | ||
Options: | ||
<variablelist> | ||
<varlistentry> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty much documented at https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html
"main
section" "rc-manager". Can't we link there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! For consistency, we should do this for dns as well.
nixos/modules/config/networking.nix
Outdated
# by NetworkManager | ||
${optionalString (!config.environment.etc?"resolv.conf" && | ||
cfg.networkmanager.enable -> | ||
cfg.networkmanager.rc-manager == "resolvconf") '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very confused by this condition here, can you explain this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I had the precedence messed up there. It's supposed to check that there's no "resolv.conf"-attribute in etc and that, if networkmanager is enabled, rc-manager is set to "resolvconf".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also curious, i don't know much about network manager, but after reading the doc it seems that network manager is supposed to run itself the resolvconf program, so I'm not sure why we run here resolvconf. I would have written instead just config.environment.etc?"resolv.conf" && !cfg.networkmanager.enable
. Did I missed something? Otherwise, thanks for this PR, it solves the problem of no internet after each rebuild!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NetworkManager runs resolvconf only if configured to do so via rc-manager = "resolvconf"
, which is why the condition is needed - it makes sure that if NetworkManager is enabled, resolvconf is only run here if NetworkManager is configured to use resolvconf.
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.
- Refer to external documentation for dns option - Clean up macAddress option - Improve references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reproduced the issue by adding something to my system and doing a nixos-rebuild test
and watched the /etc/resolv.conf
loose it's nameservers. So to regain my nameservers I reconnected to my wifi.
Then I applied this patch and did another nixos-rebuild test
and still had the nameservers in there.
@infinisil Is there something that you think we need to fix in this after the updates to your comments? |
At least until NixOS/nixpkgs#61949 is resolved.
Any chance we can get this backported to 19.03. |
@kampka If you want something backported, you're always free to open a PR for it (to the release-19.03 branch) |
fwiw this is a default behaviour change, so a backport would depend on what the release managers (@samueldr and @lheckemann) think.
|
-1 on backporting. This can be worked around effectively using
as mentioned by @talyz on the issue that prompted this, or by defining |
Motivation for this change
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 #61490. It
additionally allows the user to change rc-manager without interference
from configuration activations.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)