nixos-install-scripts
nixos-install-scripts copied to clipboard
Dedicated Hetzner install script sometimes gets network interface name wrong (but altname right)
I've just used the Hetzner install script to install on a newly rented server. The network interface name is detected to be enp3s0
. However once I reboot into nixos, that is only the altname
:
[root@herc:~]# ip address
...
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
...
altname enp3s0
While the altname works when manually configuring the network with the ip
command, it seems to not work in configuration.nix
. Once I rename enp4s0
to eno1
in configuration.nix
things work at boot.
OK, I figured out why this is: the script just grabs ID_NET_NAME_PATH
, but if ID_NET_NAME_ONBOARD
is present that will be picked instead. In fact, the linked blog post lists how the name is chosen, and there are a few more options as well: https://major.io/2015/08/21/understanding-systemds-predictable-network-device-names/#picking-the-final-name .
So we should probably amend the script to pick the first of those which is present.
cc @nh2