Opened 2 years ago
Closed 23 months ago
#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 , 2 years ago
comment:2 by , 2 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 2 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
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.
follow-up: 5 comment:4 by , 2 years 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.
comment:5 by , 2 years 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 , 2 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:7 by , 2 years ago
I can reproduce the issue with QEMU and virtual network device hotplugging (for simulating the timing issue enumerating the NICs).
comment:8 by , 23 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 , 23 months ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Fixed at r12.0-118-g3608380f2.

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