nixos/networkd: wait for udev to settle before starting networkd#39340
nixos/networkd: wait for udev to settle before starting networkd#39340xeji merged 1 commit intoNixOS:masterfrom
Conversation
... to avoid race condition between udevd renaming and networkd configuring interfaces (39069)
|
Upstream systemd-networkd now renames network interfaces itself, which seems like a good idea, no? |
|
We would need udev rules from here:
and also this pull request, which was reverted: #29768 Back then I made the mistake merging/reverting both features independently. |
it's still
Unfortunately no. The race condition occurs because nixos brings up interfaces in stage 1 without renaming them, we only add the renaming rule in The best solution is to do renaming when the interfaces are first created in stage 1, see #39329.
Actually, no if we do the renaming in stage 1.
Thanks for the references, I had not seen your previous PRs. Yes, switching back to upstream rules and There's a small drawback: the builtin mechanism is controlled by the |
| restartTriggers = map (f: f.source) (unitFiles); | ||
| # prevent race condition with interface renaming (#39069) | ||
| requires = [ "systemd-udev-settle.service" ]; | ||
| after = [ "systemd-udev-settle.service" ]; |
There was a problem hiding this comment.
Personally I have:
systemd.services.systemd-udev-settle.serviceConfig.ExecStart = ["" "${pkgs.coreutils}/bin/true"];
in my configuration because systemd-udev-settle timeouts on my machine sometimes.
That's why I would be glad if we could get rid of that service sometimes.
There was a problem hiding this comment.
I agree this is not ideal but the best we can do in stage 2 to prevent the race condition. We can revert this as soon as we do the renaming in stage 1.
There was a problem hiding this comment.
Instead of using systemd-udev-settle, we could add
serviceConfig.ExecStartPre="${systemd.package}/bin/udevadm settle -t 10";
directly to systemd-networkd to use a shorter timeout than the default 120s. I guess 10s will be enough to get interface renaming done... ( on a real system, but on hydra you never know).
|
LGTM |
Motivation for this change
Fix #39069: Avoid a race condition between
udevdrenaming andnetworkdconfiguring interfaces when usingnetworkdwith predictable interface names.Please backport to 18.03 because a resulting non-deterministic test failure has frequently delayed the
nixos-18.03-smallchannel.This is an interim fix to get rid of the race condition and resulting test failures. It does not break existing configs that use the old
ethXinterface names for stage 1 (initrd) networking, so it should be safe to backport to 18.03.(#39329 proposes a better long-term solution: rename interfaces in stage 1 already, so interface names are consistently the same in initrd and fully booted system. But that change will break initrd networking in some existing configs, so we should make it carefully.)
Things done
build-use-sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)