-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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/{networkd,dhcpcd}: remove udev-settle hack #107382
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/boot-faster-by-disabling-udev-settle-and-nm-wait-online/6339/4 |
Shower thought: Do we copy and apply all udev rules into initrd? I'm a bit worried about The We should add a test for this, to ensure it keeps working. |
There is some additional information here: #25311 |
I run more tests today and everything looks fine:
|
@rnhmjoj can you add a test for the |
@flokli Thank you for the suggestion: there is indeed a problem here. I wrote this small test: {
rename = {
name = "RenameInterface";
machine = { pkgs, ... }: {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
useDHCP = false;
};
services.udev.extraRules = ''
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:12:01:01", KERNEL=="eth*", NAME="custom_name"
'';
};
testScript = ''
machine.succeed("udevadm settle")
print(machine.succeed("ip link show dev custom_name"))
'';
};
} The "scripted" variant works, but the renaming fails when netword is enabled:
I'm not sure what this means... |
The linked #79532 kinda does something similar this: We copy I feel like we need to copy more of the |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
b331ba7
to
1ebe140
Compare
systemd-udev-settle is a terrible hack[1] and should never[2] ever[3] used, seriously it's very bad. It was used as a stop-gap solution for issue NixOS#39069, but thanks to PR NixOS#79532 it can be removed now. [1]: systemd/systemd#7293 (comment) [2]: NixOS#73095 [3]: NixOS#107341
Renaming an interface must be done in stage-1: otherwise udev will report the interface as ready and network daemons (networkd, dhcpcd, etc.) will bring it up. Once up the interface can't be changed and the renaming will fail. Note: link files are read directly by udev, so they can be used even without networkd enabled.
1ebe140
to
4459cb4
Compare
b85dce1
to
9d34123
Compare
Note: this moves the example rule used to rename network interfaces in the new udev.initrdRules option, which is required since 115cdd1c.
9d34123
to
d683d26
Compare
@rnhmjoj I'm using this for a while now ontop of Edit: Nevermind, I just read the addition to the release notes. Doesn't sound safe to backport. |
@erictapen Yes, unfortunately it can't be easily backported. |
@@ -202,12 +202,26 @@ in | |||
''; | |||
}; | |||
|
|||
extraRules = mkOption { | |||
initrdRules = mkOption { |
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.
Hmmph not particularily fond of having this option defined here. This module is for configuring systemd-udevd in stage 2; not stage 1
how about instead of having an initrdRules
here; we move this option to stage-1.nix
and name it boot.initrd.extraUdevRules
? It's a bit weird to have the the option for initrd defined here as udevd
in initrd and udevd
in stage-2 might be two completely different udevd
implementations at this moment.
I'm working on an alternative initrd implementation using systemd. But it's hard to introduce this change as now the udev
module in stage-2 has a hard dependency on the stage-1.nix
module. Because now the stage-2
udev module calls out to stage-1.nix
I can not disable stage-1.nix
in disabledModules
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'll send a draft PR with these suggested changes and i'll backlink it here.
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 think renaming this option is fine - as long as we do this before the 20.05 branchoff, it probably doesn't even need the mkRenamedOption
alias.
Motivation for this change
systemd-udev-settle is a terrible hack1 and should never2 ever3
used, seriously it's very bad. It was used as a stop-gap solution for
issue #39069, but thanks to PR #79532 it can be removed now.
Things done
nixosTests.networking.networkd
nixosTests.networking.scripted
nixosTests.predictable-interface-names