initrd.network: support predictable interface names #47664
initrd.network: support predictable interface names #47664erikarvstedt wants to merge 2 commits intoNixOS:masterfrom
Conversation
6390654 to
881084c
Compare
5212bca to
1d22388
Compare
When `initrd.network.enable` and `networking.usePredictableInterfaceNames` are enabled, apply predictable interface naming in initrd. This also fixes a bug: Previously, setting `initrd.network.enable` effectively disabled option `networking.usePredictableInterfaceNames`. Reason: Interfaces brought up in initrd are not renamed by udev in boot stage 2. So the unpredictable names assigned in initrd remained unchanged after booting. Implementation notes: udhcpc uses eth0 as the default interface. When predictable names are enabled, use the lexicographically first Ethernet interface (en*) instead.
1d22388 to
7612783
Compare
|
I did that in #39329 but there was no consensus on how to avoid breaking existing configurations, so it wasn't merged yet. |
|
Great, thanks for the heads-up. I think some aspects of this PR are worth copying to your proposal:
|
|
|
||
| boot.initrd.kernelModules = [ "af_packet" ]; | ||
|
|
||
| boot.initrd.extraUdevRulesCommands = mkIf config.networking.usePredictableInterfaceNames '' |
There was a problem hiding this comment.
Can you write release notes for that?
There was a problem hiding this comment.
This aligns more with the semantics of the option, but requires users to migrate.
There was a problem hiding this comment.
#39329 contains some draft release notes, feel free to copy/adapt.
|
Any updates on this pull request, please? |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/predictable-network-interface-names-in-initrd/4055/1 |
|
Superseded by #68953. |
Copy of main commit msg:
When
initrd.network.enableandnetworking.usePredictableInterfaceNamesare enabled, apply predictable interface naming in initrd.
This also fixes a bug:
Previously, setting
initrd.network.enableeffectively disabled optionnetworking.usePredictableInterfaceNames.Reason: Interfaces brought up in initrd are not renamed by udev in boot
stage 2. So the unpredictable names assigned in initrd remained
unchanged after booting.
Implementation notes:
udhcpc uses eth0 as the default interface.
When predictable names are enabled, use the lexicographically
first Ethernet interface (en*) instead.
Things done: