-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
nixos/dhcpcd: fix race between namespace setup and resolvconf #348305
Conversation
I think the bug here is that https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/resolvconf.nix#L141
Ordering only works on |
that's not just a systemd thing, that's a linux namespace thing. i believe that even with this fix, if another service were to edit the /etc directory is secured by user permissions, so it should be safe to just bind |
6d2e719
to
88d0049
Compare
Yes, it seems the correct solution. Thank you.
Yes, but probably then /run/resolvconf would be the next to trigger the error, and I don't think giving access to all of /run is ideal. |
@@ -210,7 +210,8 @@ in | |||
{ description = "DHCP Client"; | |||
|
|||
wantedBy = [ "multi-user.target" ] ++ lib.optional (!hasDefaultGatewaySet) "network-online.target"; | |||
wants = [ "network.target" ]; | |||
wants = [ "network.target" ] ++ lib.optional useResolvConf "resolvconf.service"; | |||
after = lib.optional useResolvConf "resolvconf.service"; |
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.
These shouldn't need to be optional since resolvconf.service
just won't exist if disabled.
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.
Seems ok, done.
systemd requires paths in `ReadWritePaths=` to exist before setting up the service sandbox, so dhcpcd should be ordered after resolvconf. Making resolvconf a oneshot service ensure `After=resolvconf.service` works correctly.
For me the test is still hanging, I'm afraid. I tried a couple times on two different x86_64 machines. |
88d0049
to
52e2e70
Compare
@ofborg test networking.networkd.dhcpSimple |
It should be |
Well, the scripted ones do pass on Hydra. It's the networkd ones that block the channel. See e.g. |
Ah, so it has nothing to do with dhcpcd! It's the test
|
This reverts commit bad5251. #348305 (comment) Should've known that commit starting with `bad` will be no good. Fixes nixosTests.networking.networkd.dhcpSimple https://hydra.nixos.org/build/274843085/nixlog/8/tail
All other channel-critical tests succeeded on the previous eval, so I hope we'll good now 🤞🏽 |
(Note: the race condition is still a thing, but it's not blocking the channel) |
This reverts commit bad5251. NixOS#348305 (comment) Should've known that commit starting with `bad` will be no good. Fixes nixosTests.networking.networkd.dhcpSimple https://hydra.nixos.org/build/274843085/nixlog/8/tail
Ok, it seems |
This reverts commit bad5251. NixOS#348305 (comment) Should've known that commit starting with `bad` will be no good. Fixes nixosTests.networking.networkd.dhcpSimple https://hydra.nixos.org/build/274843085/nixlog/8/tail
systemd requires paths in
ReadWritePaths=
to exist before setting up the service sandboxand there is apparently no way to control this with the usualAfter=
,Wants=
etc.Instead, we have to mark all the paths as optional, even if they're not, then manually check if they exist, fail if they don't and wait for the service to be restarted.
so dhcpcd should be ordered after resolvconf. Making resolvconf a oneshot service ensure
After=resolvconf.service
works correctly.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
dhcpcd.tests
and--rebuild
a few timesnix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.