udev tries to assign identical name to multiple network cards

Bug #1914884 reported by sm8ps
8
This bug affects 1 person
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/rules.d/75-persistent-net-generator.rules', '/etc/udev/rules.d/70-persistent-net.rules' or '/lib/udev/rules.d/71-biosdevname.rules' exist.

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_NAMING_SCHEME=v245
ID_NET_NAME_MAC=enx002481d13e60
ID_OUI_FROM_DATABASE=Hewlett Packard
ID_NET_NAME_PATH=enp14s0
ID_NET_NAME_SLOT=ens2

/sys/class/net/eth0
ID_NET_NAMING_SCHEME=v245
ID_NET_NAME_MAC=enx001018b197dc
ID_OUI_FROM_DATABASE=Broadcom
ID_NET_NAME_PATH=enp5s0
ID_NET_NAME_SLOT=ens2

/sys/class/net/eth1
ID_NET_NAMING_SCHEME=v245
ID_NET_NAME_MAC=enx00101897069a
ID_OUI_FROM_DATABASE=Broadcom
ID_NET_NAME_PATH=enp9s0
ID_NET_NAME_SLOT=ens2

This seems to be a case where the naming scheme v245 should be replaced by v247, according to
https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html
The situation does not change with passing "net.naming-scheme=latest" to the kernel.
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!

Revision history for this message
sm8ps (sm8ps) wrote :

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
[Match]
OriginalName=*
[Link]
NamePolicy=path
AlternativeNamesPolicy=path
as described in https://www.freedesktop.org/software/systemd/man/systemd.link.html. For reasons unknown to me the AlternativeNamesPolicy is necessary; otherwise the name is kept at ens2 (only) for the active link (the other two NICs are inactive).

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.

Revision history for this message
Dan Streetman (ddstreet) wrote :

closing per comment 1

Changed in systemd (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.