-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
nixos/boot: rename network interfaces already in stage 1 #39329
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
Changes from 6 commits
219cbf5
f689b51
dcb5a9e
d57bb7e
89ec4f2
2773c62
f1979dc
381ba55
54e95b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,6 +266,9 @@ in | |
| change randomly across reboots; for instance, you may find | ||
| <literal>eth0</literal> and <literal>eth1</literal> flipping | ||
| unpredictably. | ||
| For newer configurations with <literal>system.stateVersion >= 18.09</literal>, | ||
| interfaces are renamed to predictable names in Stage 1 (initrd), and | ||
| changing this option's value requires a reboot to take effect. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Reading this, I initially thought that this was related to the previous sentence. It would be better to separate the sentences, as they share no relation.
Additionally, dropping the newer will keep the description evergreen and not feel weird in two years when 20.09 is being used, seeing 18.09 described as newer.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It actually is related - in the current implementation, the option can be changed with |
||
| ''; | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,76 @@ | ||
| import ../make-test.nix ({ lib, ... }: | ||
| { system ? builtins.currentSystem }: | ||
|
|
||
| { | ||
| name = "initrd-network-ssh"; | ||
| meta = with lib.maintainers; { | ||
| maintainers = [ willibutz ]; | ||
| }; | ||
| let | ||
| inherit (import ../../lib/testing.nix { inherit system; }) makeTest pkgs; | ||
| in | ||
| with pkgs; lib.listToAttrs ( map (predictable: { | ||
|
|
||
| nodes = with lib; rec { | ||
| server = | ||
| { config, ... }: | ||
| { | ||
| boot.kernelParams = [ | ||
| "ip=${config.networking.primaryIPAddress}:::255.255.255.0::eth1:none" | ||
| ]; | ||
| boot.initrd.network = { | ||
| enable = true; | ||
| ssh = { | ||
| enable = true; | ||
| authorizedKeys = [ "${readFile ./openssh.pub}" ]; | ||
| port = 22; | ||
| hostRSAKey = ./dropbear.priv; | ||
| }; | ||
| }; | ||
| boot.initrd.preLVMCommands = '' | ||
| while true; do | ||
| if [ -f fnord ]; then | ||
| poweroff | ||
| fi | ||
| sleep 1 | ||
| done | ||
| ''; | ||
| name = if predictable then "predictable" else "unpredictable"; | ||
|
|
||
| value = makeTest { | ||
| name = "initrd-network-ssh"+ lib.optionalString predictable "predictable"; | ||
| meta = with lib.maintainers; { | ||
| maintainers = [ willibutz xeji ]; | ||
| }; | ||
|
|
||
| client = | ||
| { config, ... }: | ||
| { | ||
| environment.etc.knownHosts = { | ||
| text = concatStrings [ | ||
| "server," | ||
| "${toString (head (splitString " " ( | ||
| toString (elemAt (splitString "\n" config.networking.extraHosts) 2) | ||
| )))} " | ||
| "${readFile ./dropbear.pub}" | ||
| ]; | ||
| }; | ||
| nodes = with lib; | ||
| let interface2 = if predictable then "ens4" else "eth1"; | ||
| in rec { | ||
| server = | ||
| { config, ... }: | ||
| { | ||
| # for stateVersion < 18.09 this doesn't make a difference in initrd | ||
| system.stateVersion = "18.09"; | ||
| networking.usePredictableInterfaceNames = mkForce predictable; | ||
| boot.kernelParams = [ | ||
| "ip=${config.networking.primaryIPAddress}:::255.255.255.0::${interface2}:none" | ||
| ]; | ||
| boot.initrd.network = { | ||
| enable = true; | ||
| # for initrd networking with predictable interface names, | ||
| # udhcpc must be given the name as an argument | ||
| udhcpc.extraArgs = [ (lib.optionalString predictable "-i ${interface2}")]; | ||
| ssh = { | ||
| enable = true; | ||
| authorizedKeys = [ "${readFile ./openssh.pub}" ]; | ||
| port = 22; | ||
| hostRSAKey = ./dropbear.priv; | ||
| }; | ||
| }; | ||
| boot.initrd.preLVMCommands = '' | ||
| while true; do | ||
| if [ -f fnord ]; then | ||
| poweroff | ||
| fi | ||
| sleep 1 | ||
| done | ||
| ''; | ||
| }; | ||
|
|
||
| client = | ||
| { config, ... }: | ||
| { | ||
| environment.etc.knownHosts = { | ||
| text = concatStrings [ | ||
| "server," | ||
| "${toString (head (splitString " " ( | ||
| toString (elemAt (splitString "\n" config.networking.extraHosts) 2) | ||
| )))} " | ||
| "${readFile ./dropbear.pub}" | ||
| ]; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| testScript = '' | ||
| startAll; | ||
| $client->waitForUnit("network.target"); | ||
| $client->copyFileFromHost("${./openssh.priv}","/etc/sshKey"); | ||
| $client->succeed("chmod 0600 /etc/sshKey"); | ||
| $client->waitUntilSucceeds("ping -c 1 server"); | ||
| $client->succeed("ssh -i /etc/sshKey -o UserKnownHostsFile=/etc/knownHosts server 'touch /fnord'"); | ||
| $client->shutdown; | ||
| ''; | ||
| }) | ||
| testScript = '' | ||
| $client->waitForUnit("network.target"); | ||
| $client->copyFileFromHost("${./openssh.priv}","/etc/sshKey"); | ||
| $client->succeed("chmod 0600 /etc/sshKey"); | ||
| $server->start; | ||
| $client->waitUntilSucceeds("ping -c 1 server"); | ||
| $client->succeed("ssh -i /etc/sshKey -o UserKnownHostsFile=/etc/knownHosts server 'touch /fnord'"); | ||
| $client->shutdown; | ||
| ''; | ||
| }; | ||
| }) [false true] | ||
| ) |
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.
The last bit
is redundant because of the previous paragraph; the opening paragraph of that section. I'm not specifically against keeping it, but I think removing redundant phrases in the release notes is important; they may be long! (They are probably still incomplete, we'll see in the coming days.)