#5394 closed enhancement (fixed)

udev assigns altname to network device

Reported by: thomas Owned by: Xi Ruoyao
Priority: normal Milestone: 12.1
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description

It looks like udev (udev of systemd-254) assigns an 'altname's to NICs if there are more than one NIC in the system (and based on same hardware).

It led to a situation on a (sysv-based) machine with two identical NICs (identical except the MAC) that the first NIC has been renamed to enp4s0 according to a rule which matches the MAC and an altname of enp5s0 has been added. The next udev rule tried to rename the second NIC to enp5s0 which failed as the name is already in use.

The udev rules (/etc/udev/rules.d/70-persistent-net.rules) are

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="2c:fd:a1:34:29:35", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="enp4s0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="2c:fd:a1:34:29:36", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="enp5s0"

xry111 brought up a solution:

sed '/^AlternativeNamesPolicy/s/=.*$/=/' /usr/lib/udev/network/99-default.link > /etc/udev/network/99-default.link

That works fine on this system.

Change History (9)

comment:1 by Xi Ruoyao, 12 months ago

I'm not sure if this is an issue with systemd revision as well. I'll test it in a few days...

comment:2 by Bruce Dubbs, 12 months ago

Owner: changed from lfs-book to Bruce Dubbs
Status: newassigned

comment:3 by Bruce Dubbs, 12 months ago

Owner: changed from Bruce Dubbs to lfs-book
Status: assignednew

Reassigning this ticket to lfs-book. I do not have a system with the hardware to test the proposed fix. We need to test sysV and systemd.

comment:4 by Xi Ruoyao, 12 months ago

I can do the test in QEMU, but I have to remove a line excluding QEMU virtual NICs in init-net-rules.sh for the testing.

in reply to:  4 comment:5 by Bruce Dubbs, 12 months ago

Replying to Xi Ruoyao:

I can do the test in QEMU, but I have to remove a line excluding QEMU virtual NICs in init-net-rules.sh for the testing.

That sounds like a good way to do it. I'm in the process of updating the book for most of the packages today. After that if you could update the book and also the systemd update, it would be great.

comment:6 by Xi Ruoyao, 12 months ago

Owner: changed from lfs-book to Xi Ruoyao
Status: newassigned

comment:7 by Xi Ruoyao, 12 months ago

I can reproduce the issue with QEMU and virtual network device hotplugging (for simulating the timing issue enumerating the NICs).

comment:8 by Xi Ruoyao, 12 months ago

Not an issue with systemd because the 10-ether0.link file will completely override 99-default.link for the NIC with specified MAC address, thus AlternativeNamesPolicy will just be empty for this NIC.

comment:9 by Xi Ruoyao, 12 months ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.