Skip to content
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

enp5s0 became eth0 with no warning after kernel version bump; network config disrupted #137316

Closed
elmarsto opened this issue Sep 10, 2021 · 2 comments
Labels
0.kind: bug Something is broken

Comments

@elmarsto
Copy link

Problem

After a kernel version bump, it appears that enp5s0 became eth0 with no warning. This caused my network configuration to cease to function.

I fixed the problem by booting into the generation immediately before the kernel version bump, and then nixos-rebuild switch to give me the niceties of my current config. Of course, the bug will return when I reboot.

Steps to reproduce

  • uncertain; it may only affect some NICs; I have not yet grepped the kernel changelog to find out what, exactly, changed, or why.

Additional context

Suggested Fix

Allow referring to network interfaces (in configuration.nix) by MAC address. Something along the lines of:

networking.interfacesByMac."AA:BB:CC:DD:EE:FF:00" = {
ipv4.addresses = [....]
}

would also need to be able to refer by MAC address in e.g. networking.firewall.interfaces, and everywhere else (networkmanager.unmanaged, etc.)

This would be substantially more stable for config, given how mutable linux kernel ethernet interface naming scheme has become

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.61, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.15`
 - channels(lattice): `"nixos-21.05.2987.fd6dba47199, unstable-21.11pre313466.bc06c93905f"`
 - channels(root): `"nixos-21.11pre313614.09cd65b33c5, nixos-unstable, unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@elmarsto elmarsto added the 0.kind: bug Something is broken label Sep 10, 2021
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Sep 10, 2021

The linux kernel has always followed the traditional naming scheme: eth0, eth1, wlan0, etc. What's responsible for the so called "predictable" naming scheme (like enp5s0) is systemd, so I'd say this is a bug in either systemd or the way we configure it in NixOS. If would help tracking this down if you could tell us what nixos-version in the last good and first bad generation.

By the way, if you have been setting static routes or addresses, the best way to make the configuration robust is assigning a custom name to the interfaces you need by matching the MAC address, as you suggested. This chapter of the NixOS manual shows how.

@elmarsto
Copy link
Author

this is great; thanks for the clarification; I didn't know systemd altered interface names.

FYI the problem mysteriously disappeared a few generations later; all the same, I will follow that section in the manual to refer more precisely to my devices.

TYSM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants