nfsroot= causes the interface to be brought up very early, before udev
starts, and before it has a chance to apply its rules and .link files.
Before kernel 6.2, it was not possible to rename interfaces that were
already "up" (see linux commit bd039b5ea2a91).
On another note, even though NamePolicy doesn't provide any names in
your case, you should still clear it in general:
[Link]
NamePolicy=
Name=mycustometh
On 17/06/2025 08.59, He, Guocai (CN) wrote:
Hi,
I want to create a link file and want to match the mac to rename eth0
to mycustometh but fail.
seems that the link file is not applied?
The fllowing is my step and some logs:
#1 etho mac
udevadm info /sys/class/net/eth0
E: ID_NET_NAME_MAC=enxa4bf016bfaf5
#2 link file
root@intel-x86-64:~# cat /etc/systemd/network/00-eth0.link
[Match]
MACAddress=a4:bf:01:6b:fa:f5
[Link]
Name=mycustometh
#3 only one link file
root@intel-x86-64:~# ls /etc/systemd/network/
00-eth0.link
#4 the link file in /lib/systemd/network/ I try to remove
99-default.link, it still not work
root@intel-x86-64:/lib/systemd/network# ls
80-6rd-tunnel.network 80-container-ve.network
80-wifi-adhoc.network 80-wired.network
80-container-host0.network 80-container-vz.network
80-wifi-ap.network.example 99-default.link
80-container-vb.network 80-vm-vt.network
80-wifi-station.network.example
root@intel-x86-64:/lib/systemd/network# cat 99-default.link
[Match]
OriginalName=*
[Link]
NamePolicy=keep kernel database onboard slot path
AlternativeNamesPolicy=database onboard slot path
MACAddressPolicy=persistent
#5 test the changes
root@intel-x86-64:~# udevadm test-builtin net_setup_link
/sys/class/net/eth0
Trying to open "/etc/systemd/hwdb/hwdb.bin"...
Trying to open "/etc/udev/hwdb.bin"...
Trying to open "/usr/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/udev/hwdb.bin"...
=== trie on-disk ===
tool version: 250
file size: 9764936 bytes
header size 80 bytes
strings 2429280 bytes
nodes 7335576 bytes
Load module index
Found cgroup2 on /sys/fs/cgroup/unified, unified hierarchy for systemd
controller
Found container virtualization none.
Loaded timestamp for '/etc/systemd/network'.
Parsed configuration file /etc/systemd/network/00-eth0.link
Created link configuration context.
eth0: Device has name_assign_type=1
eth0: Device has addr_assign_type=0
ID_NET_DRIVER=igb
eth0: Config file /etc/systemd/network/00-eth0.link is applied
eth0: Using static MAC address.
eth0: Policies didn't yield a name, using specified Name=mycustometh.
ID_NET_LINK_FILE=/etc/systemd/network/00-eth0.link
ID_NET_NAME=mycustometh
Unload module index
Unloaded link configuration context.
#6 reboot and the eth0 is not changed
root@intel-x86-64:/# ip link
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
mode DEFAULT group default qlen 1000
link/ether a4:bf:01:6b:fa:f5 brd ff:ff:ff:ff:ff:ff
#7 boot cmdline
root@intel-x86-64:~# cat /proc/cmdline
kernel console=ttyS4,115200 root=/dev/sda1
nfsroot=128.224.165.20:/export/pxeboot/vlm-boards/29170/rootfs,v3,tcp
rw selinux=0 udev.log_priority=debug enforcing=0 intel_iommu=on
iommu=pt no_console_suspend ignore_loglevel
#8 logs after reboot, can not see such as "00-eth0.link is applied"
journalctl -u systemd-udevd
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Trying to open
"/etc/udev/hwdb.bin"...
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Trying to open
"/usr/lib/systemd/hwdb/hwdb.bin"...
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Trying to open
"/lib/systemd/hwdb/hwdb.bin"...
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Trying to open
"/lib/udev/hwdb.bin"...
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: === trie on-disk ===
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: tool
version: 250
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: file size:
9764936 bytes
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: header
size 80 bytes
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: strings
2429280 bytes
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: nodes
7335576 bytes
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Load module index
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Loaded timestamp for
'/etc/systemd/network'.
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Parsed configuration
file /etc/systemd/network/00-eth0.link
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Created link
configuration context.
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Loaded timestamp for
'/etc/udev/rules.d'.
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Loaded timestamp for
'/lib/udev/rules.d'.
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Skipping overridden
file '/lib/udev/rules.d/80-net-setup-link.rules'.
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Reading rules file:
/lib/udev/rules.d/01-md-raid-creating.rules
Jun 17 02:46:02 intel-x86-64 systemd-udevd[252]: Reading rules file:
/lib/udev/rules.d/10-dm.rules
..................
Anybody have meet the same issue? who can help to have a look at this
issue?