Page MenuHomeVyOS Platform

invalid interface name
Closed, InvalidPublicBUG

Description

As my local internet provider has regular outages, I wanted to add mobile broadband as fallback to my VyOS machine. For this I used a USB LTE modem.
The modem is detected properly as an Ethernet device and can be configured successfully. But as soon as the board reboots, the interfaces are renamed.

I can see the following in the kernel log:

[    1.616096] r8169 0000:03:00.0 e3: renamed from eth1
[    1.631929] r8169 0000:02:00.0 e2: renamed from eth0
[   28.575966] r8169 0000:03:00.0 eth1: renamed from e3
[   28.589961] cdc_ether 1-1:1.0 eth2: renamed from eth0

All interfaces in the form of e[0-9]+ are not shown in the output of show interfaces.
They also cannot be configured. For example if I try to set the address of the interface via set interfaces ethernet e2 address 10.0.0.0/24, then i get the following error message:

Invalid Ethernet interface name
Value validation failed
Set failed

I think this is because the regex in interface-definitions/interfaces-ethernet.xml.in in /interfaceDefinition/node/children/tagNode/properties/constraint/regex does not allow just e[0-9]+ or because the interface is renamed wrongly.

Details

Version
VyOS 1.4-rolling-202306280317
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

e2 it is a temporary name to rename ethX in correct way
You have to use “ethernet ethX address x.x.x.x”

@Viacheslav

I found invalid interface name with lastest build (fresh install and none configuration)

image.png (326×1 px, 598 KB)

image.png (354×1 px, 600 KB)

e2 it is a temporary name to rename ethX in correct way
You have to use “ethernet ethX address x.x.x.x”

It is supposed to be renamed as ethX, but that fails, so it stays eX.
After a little more digging, I found the corresponding udev rules yesterday.
I found the following log in the journal:

Jun 29 10:19:19 vyos (udev-worker)[1060]: eth0: Failed to rename network interface 2 from 'e2' to 'eth0': File exists

I found the following log in /run/udev/log/vyos-net-name from the vyos_net_name python script:

INFO:root:lookup e3, 00:e0:4c:14:53:91
INFO:root:lookup e2, 00:e0:4c:14:71:26
INFO:root:lookup eth0, 58:2c:80:13:84:21
DEBUG:root:config file entries: {'00:e0:4c:14:71:26': 'eth0', '00:e0:4c:14:53:91': 'eth1', '58:2c:80:13:84:21': 'eth2'}
DEBUG:root:config file interfaces are {'00:e0:4c:14:71:26': 'eth0', '00:e0:4c:14:53:91': 'eth1', '58:2c:80:13:84:21': 'eth2'}
INFO:root:use mapping from config file: '00:e0:4c:14:53:91' -> 'eth1'
DEBUG:root:config file entries: {'00:e0:4c:14:71:26': 'eth0', '00:e0:4c:14:53:91': 'eth1', '58:2c:80:13:84:21': 'eth2'}
DEBUG:root:on boot, returned name is eth1
DEBUG:root:config file interfaces are {'00:e0:4c:14:71:26': 'eth0', '00:e0:4c:14:53:91': 'eth1', '58:2c:80:13:84:21': 'eth2'}
INFO:root:use mapping from config file: '00:e0:4c:14:71:26' -> 'eth0'
DEBUG:root:on boot, returned name is eth0
DEBUG:root:config file entries: {'00:e0:4c:14:71:26': 'eth0', '00:e0:4c:14:53:91': 'eth1', '58:2c:80:13:84:21': 'eth2'}
DEBUG:root:config file interfaces are {'00:e0:4c:14:71:26': 'eth0', '00:e0:4c:14:53:91': 'eth1', '58:2c:80:13:84:21': 'eth2'}
INFO:root:use mapping from config file: '58:2c:80:13:84:21' -> 'eth2'
DEBUG:root:on boot, returned name is eth2

The third line looks like the script gets the interface as eth0, instead of eX.
This would mean, that the 62-temporary-interface-rename.rules udev rule somehow fails for the eth0 interface.

I think I found the real problem:

The 62-temporary-interface-rename.rules udev rule runs in initramfs before the USB modem is detected:

Jun 30 14:32:11 vyos kernel: r8169 0000:03:00.0 e3: renamed from eth1
Jun 30 14:32:11 vyos kernel: r8169 0000:02:00.0 e2: renamed from eth0

[...]

Jun 30 14:32:11 vyos kernel: usb 1-1: new high-speed USB device number 2 using xhci_hcd
Jun 30 14:32:11 vyos kernel: ata2: SATA link down (SStatus 4 SControl 300)
Jun 30 14:32:11 vyos kernel: ata1: SATA link down (SStatus 4 SControl 300)
Jun 30 14:32:11 vyos kernel: usb 1-1: New USB device found, idVendor=12d1, idProduct=1f01, bcdDevice= 1.02
Jun 30 14:32:11 vyos kernel: usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
Jun 30 14:32:11 vyos kernel: usb 1-1: Product: HUAWEI HiLink
Jun 30 14:32:11 vyos kernel: usb 1-1: Manufacturer: HUAWEI

So the modem does not get renamed to eX and thus, if the modem has an ethX name that conflicts with the configuration from the 65-vyos-net.rules udev rule, the renaming of the interfaces from eX to ethX fails because a duplicate already exists.

So in conclusion, if VyOS wants to support USB Ethernet devices, the 62-temporary-interface-rename.rules udev rule should be deferred until the USB devices are detected or something like that.

I think I found the real problem:

The 62-temporary-interface-rename.rules udev rule runs in initramfs before the USB modem is detected:

Jun 30 14:32:11 vyos kernel: r8169 0000:03:00.0 e3: renamed from eth1
Jun 30 14:32:11 vyos kernel: r8169 0000:02:00.0 e2: renamed from eth0

[...]

Jun 30 14:32:11 vyos kernel: usb 1-1: new high-speed USB device number 2 using xhci_hcd
Jun 30 14:32:11 vyos kernel: ata2: SATA link down (SStatus 4 SControl 300)
Jun 30 14:32:11 vyos kernel: ata1: SATA link down (SStatus 4 SControl 300)
Jun 30 14:32:11 vyos kernel: usb 1-1: New USB device found, idVendor=12d1, idProduct=1f01, bcdDevice= 1.02
Jun 30 14:32:11 vyos kernel: usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
Jun 30 14:32:11 vyos kernel: usb 1-1: Product: HUAWEI HiLink
Jun 30 14:32:11 vyos kernel: usb 1-1: Manufacturer: HUAWEI

So the modem does not get renamed to eX and thus, if the modem has an ethX name that conflicts with the configuration from the 65-vyos-net.rules udev rule, the renaming of the interfaces from eX to ethX fails because a duplicate already exists.

So in conclusion, if VyOS wants to support USB Ethernet devices, the 62-temporary-interface-rename.rules udev rule should be deferred until the USB devices are detected or something like that.

This is only partially true.
After reading a bit into how udev works, I found out the rules run concurrently for each device whenever it is connected.
So the udev rules themselves run fine for the modem.
The problem is, the vyos_net_name script only does the renaming until the "boot configuration is complete".
The modem takes a little longer to boot up and connect, so it looks like it is fully detected right after the boot configuration is done but before the second renaming is finished.
This also explains why the issue only happens on cold boots: otherwise, the modem does not loose power and does not take as long to boot up and be fully detected.

This could maybe be solved by

  • either using predictable network interface names
  • doing the renaming for new interfaces even when the "boot configuration is complete"
  • checking if the name is really free before renaming

I think the third option always poses the risk of a race condition and I have not yet looked into what the downsides of option two would be.

dmbaturin subscribed.

If there is a bug in the NIC loading process, we need a different task with precise wording.