udev tries to assign identical name to multiple network cards
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Upon upgrading from U18.04 to U20.04.2, the network interface names became unpredictable. They could be *any* of eth0, eth1, eth2 and ens2. Further inspection shows error messages like
"systemd-udevd: eth1: Failed to rename network interface 3 from 'eth1' to 'ens2': File exists"
The installation is plain vanilla; in fact, the system had not been used at all yet. Neither of the files '/lib/udev/
On U18.04, 'ls /sys/class/net' yielded "enp5s0 enp14s0 enp9s0 lo".
After the upgrade, it currently shows "ens2 eth0 eth1 lo".
For each of these entries, 'udevadm test-builtin net_id $nic 2>/dev/null' gives the following:
/sys/class/net/ens2
ID_NET_
ID_NET_
ID_OUI_
ID_NET_
ID_NET_
/sys/class/net/eth0
ID_NET_
ID_NET_
ID_OUI_
ID_NET_
ID_NET_
/sys/class/net/eth1
ID_NET_
ID_NET_
ID_OUI_
ID_NET_
ID_NET_
This seems to be a case where the naming scheme v245 should be replaced by v247, according to
https:/
The situation does not change with passing "net.naming-
The installed version of udev is 245.4-4ubuntu3.4.
Since this faulty behavior happened completely out of the blue on a practically pristine LTS installation, I hope to have some kind of solution similar to a backport. Thanks for comments!
In case anybody else should stumble over this issue, my solution was to create a .link file /etc/systemd/ network/ 10-fix- names.link with content sPolicy= path /www.freedeskto p.org/software/ systemd/ man/systemd. link.html. For reasons unknown to me the AlternativeName sPolicy is necessary; otherwise the name is kept at ens2 (only) for the active link (the other two NICs are inactive).
[Match]
OriginalName=*
[Link]
NamePolicy=path
AlternativeName
as described in https:/
sudo SYSTEMD_ LOG_LEVEL= debug udevadm test-builtin net_setup_link /sys/class/net/ens2 yields the expected result enp5s0 and the machine can be rebooted.
Closing this issue.