Renaming interfaces using *.link file does not work

Bug #1879770 reported by Ven Huroo
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Dear Ubuntu team,

I wanted to use "systemd-networkd" intead of "udev" to rename network interface like this:

(replace MAC by real one)

########################################
echo '[Match]
MACAddress=12:34:56:78:90:11

[Link]
Name=myname123' | sudo tee '/etc/systemd/network/myname123.link'
########################################

(and reboot)

But it does not work. And it should work based on the systemd documentation. I googled the issue but I didn't find anything interesting instead that I should run "update-initramfs -u" but that didn't help.

I tested that this doesn't work both on Ubuntu Desktop 20.04 and Ubuntu Server 20.04.

Thank you,

Kind regards,
Ven

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: systemd 245.4-4ubuntu3
ProcVersionSignature: Ubuntu 5.4.0-29.33-generic 5.4.30
Uname: Linux 5.4.0-29-generic x86_64
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: KDE
Date: Wed May 20 14:35:21 2020
InstallationDate: Installed on 2020-05-17 (3 days ago)
InstallationMedia: Kubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
Lsusb:
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd QEMU USB Tablet
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Lsusb-t:
 /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
 /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
     |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 480M
MachineType: QEMU Standard PC (Q35 + ICH9, 2009)
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.4.0-29-generic root=UUID=fd983ca3-a36f-4d8a-b881-164590fe35e2 ro rootflags=subvol=@ quiet splash vt.handoff=7
SourcePackage: systemd
SystemdDelta:
 [EXTENDED] /usr/lib/systemd/system/rc-local.service → /usr/lib/systemd/system/rc-local.service.d/debian.conf
 [EXTENDED] /usr/lib/systemd/system/user@.service → /usr/lib/systemd/system/user@.service.d/timeout.conf

 2 overridden configuration files found.
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/01/2014
dmi.bios.vendor: SeaBIOS
dmi.bios.version: 1.12.0-1
dmi.chassis.type: 1
dmi.chassis.vendor: QEMU
dmi.chassis.version: pc-q35-3.1
dmi.modalias: dmi:bvnSeaBIOS:bvr1.12.0-1:bd04/01/2014:svnQEMU:pnStandardPC(Q35+ICH9,2009):pvrpc-q35-3.1:cvnQEMU:ct1:cvrpc-q35-3.1:
dmi.product.name: Standard PC (Q35 + ICH9, 2009)
dmi.product.version: pc-q35-3.1
dmi.sys.vendor: QEMU

Revision history for this message
Ven Huroo (ven-huroo) wrote :
Revision history for this message
Dan Streetman (ddstreet) wrote :

What's the output of:

$ networkctl status enp3s0

specifically, what's the 'Link File'. Change the name of the interface if needed, of course.

I am guessing it's "/lib/systemd/network/99-default.link". That's because your link file is named "myname123.link", and "m" is after "9", so 99-default.link matches first (because it matches "OriginalName=*"). If this is the case, try renaming your link file so it's lower (alphabetically) than 99-, e.g. "50-myname123.link".

Alternately, if networkctl shows your interface link file is "/run/systemd/network/10-netplan-enp3s0.link", it's because you have it configured using netplan, which also creates a link file for some operations (like setting interface name). Check your /etc/netplan/ dir for *.yaml files.

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
Markus Rexhepi-Lindberg (k-markus) wrote :
Download full text (4.0 KiB)

I experiencing the same problem. My two Ethernet interfaces does not get renamed. I want to accomplish the following.

eth0 => eth1
eth1 => eth0

Basically switching names between the Ethernet interfaces.

I had the same exact setup on 18.04 which worked.

You can find some information about my system below. Please let me know if I should provide more information.

== networkctl(1) ==

# networkctl status eth0
WARNING: systemd-networkd is not running, output will be incomplete.

Failed to query link bit rates: Unit dbus-org.freedesktop.network1.service not found.
● 2: eth0
             Link File: n/a
          Network File: n/a
                  Type: ether
                 State: n/a (unmanaged)
            HW Address: e0:d5:5e:43:7e:52 (GIGA-BYTE TECHNOLOGY CO.,LTD.)
                   MTU: 1500 (min: 68, max: 9000)
  Queue Length (Tx/Rx): 1/1
      Auto negotiation: yes
                 Speed: 1Gbps
                Duplex: full
                  Port: tp
               Address: 10.88.130.28
                        fe80::e2d5:5eff:fe43:7e52
               Gateway: 10.88.0.1 (Hewlett Packard)

May 28 16:23:44 lnxjohansy systemd-udevd[503]: eth0: Failed to rename network interface 2 from 'eth0' to 'eth1': File exists
May 28 16:23:44 lnxjohansy systemd-udevd[503]: eth0: Failed to process device, ignoring: File exists

# networkctl status eth1
WARNING: systemd-networkd is not running, output will be incomplete.

Failed to query link bit rates: Unit dbus-org.freedesktop.network1.service not found.
● 3: eth1
             Link File: n/a
          Network File: n/a
                  Type: ether
                 State: n/a (unmanaged)
            HW Address: 68:05:ca:75:3d:65 (Intel Corporate)
                   MTU: 1500 (min: 68, max: 9212)
  Queue Length (Tx/Rx): 1/1
      Auto negotiation: yes
                 Speed: n/a
                  Port: tp

May 28 16:23:44 lnxjohansy systemd-udevd[503]: eth1: Failed to rename network interface 3 from 'eth1' to 'eth0': File exists
May 28 16:23:44 lnxjohansy systemd-udevd[503]: eth1: Failed to process device, ignoring: File exists

== systemd.link(5) ==

# ls -l /etc/systemd/network
total 8
-rw-r--r-- 1 root root 55 May 28 14:23 70-eth0.link
-rw-r--r-- 1 root root 55 May 28 14:23 70-eth1.link

# cat /etc/systemd/network/70-eth0.link
[Match]
MACAddres...

Read more...

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu):
status: Incomplete → Expired
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.