Strange device names for USB NICs

Bug #1544747 reported by Jeff Lane on 2016-02-11
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Wishlist
Unassigned

Bug Description

Fresh install of Xenial on an intel NUC with 1 onboard GigE and one USB GigE NIC.

I was setting up networking for MAAS and discovered that the device names were ridiculous:

bladernr@critical-maas:/etc/udev$ ifconfig |grep HWaddr
eno1 Link encap:Ethernet HWaddr ec:a8:6b:fb:9f:66
enx8cae4cff4099 Link encap:Ethernet HWaddr 8c:ae:4c:ff:40:99

In the previous Trusty install on this NUC with the same USB dongle, they were named eth0 and em1. The predictable standard device names.

Looking at udevadm:
P: /devices/pci0000:00/0000:00:19.0/net/eno1
E: DEVPATH=/devices/pci0000:00/0000:00:19.0/net/eno1
E: ID_BUS=pci
E: ID_MM_CANDIDATE=1
E: ID_MODEL_FROM_DATABASE=82579LM Gigabit Network Connection
E: ID_MODEL_ID=0x1502
E: ID_NET_DRIVER=e1000e
E: ID_NET_LABEL_ONBOARD=en L1U1
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enxeca86bfb9f66
E: ID_NET_NAME_ONBOARD=eno1
E: ID_NET_NAME_PATH=enp0s25
E: ID_OUI_FROM_DATABASE=ELITEGROUP COMPUTER SYSTEMS CO., LTD.
E: ID_PATH=pci-0000:00:19.0
E: ID_PATH_TAG=pci-0000_00_19_0
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_VENDOR_ID=0x8086
E: IFINDEX=2
E: INTERFACE=eno1
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/eno1
E: TAGS=:systemd:
E: USEC_INITIALIZED=5400250

P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/net/enx8cae4cff4099
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/net/enx8cae4cff4099
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=AX88178
E: ID_MODEL_ENC=AX88178\x20
E: ID_MODEL_FROM_DATABASE=AX88178
E: ID_MODEL_ID=1780
E: ID_NET_DRIVER=asix
E: ID_NET_LINK_FILE=/lib/systemd/network/90-mac-for-usb.link
E: ID_NET_NAME=enx8cae4cff4099
E: ID_NET_NAME_MAC=enx8cae4cff4099
E: ID_NET_NAME_PATH=enp0s29u1u5
E: ID_OUI_FROM_DATABASE=Plugable Technologies
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.5:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_5_1_0
E: ID_REVISION=0001
E: ID_SERIAL=ASIX_Elec._Corp._AX88178_000002
E: ID_SERIAL_SHORT=000002
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
E: ID_USB_DRIVER=asix
E: ID_USB_INTERFACES=:ffff00:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass
E: ID_VENDOR=ASIX_Elec._Corp.
E: ID_VENDOR_ENC=ASIX\x20Elec.\x20Corp.
E: ID_VENDOR_FROM_DATABASE=ASIX Electronics Corp.
E: ID_VENDOR_ID=0b95
E: IFINDEX=3
E: INTERFACE=enx8cae4cff4099
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enx8cae4cff4099 /sys/subsystem/net/devices/enx8cae4cff4099
E: TAGS=:systemd:
E: USEC_INITIALIZED=8700146

And finally, looking in /etc/udev:
bladernr@critical-maas:/etc/udev$ sudo ls -ra /etc/udev/*
/etc/udev/udev.conf

/etc/udev/rules.d:
.. .

/etc/udev/hwdb.d:
.. .

There are NO rules at all in udev for persistent names. Not even some samples and defaults.

Looking at a completely different Xenial system with a single GigE NIC:
bladernr@galactica:~$ ifconfig
enp2s0 Link encap:Ethernet HWaddr 40:8d:5c:51:5b:0d

P: /devices/pci0000:00/0000:00:1b.2/0000:02:00.0/net/enp2s0
E: DEVPATH=/devices/pci0000:00/0000:00:1b.2/0000:02:00.0/net/enp2s0
E: ID_BUS=pci
E: ID_MM_CANDIDATE=1
E: ID_MODEL_FROM_DATABASE=Killer E220x Gigabit Ethernet Controller
E: ID_MODEL_ID=0xe091
E: ID_NET_DRIVER=alx
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx408d5c515b0d
E: ID_NET_NAME_PATH=enp2s0
E: ID_OUI_FROM_DATABASE=GIGA-BYTE TECHNOLOGY CO.,LTD.
E: ID_PATH=pci-0000:02:00.0
E: ID_PATH_TAG=pci-0000_02_00_0
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Qualcomm Atheros
E: ID_VENDOR_ID=0x1969
E: IFINDEX=2
E: INTERFACE=enp2s0
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enp2s0
E: TAGS=:systemd:
E: USEC_INITIALIZED=752502

and again, nothing in the udev rules:
bladernr@galactica:~$ ls -a /etc/udev/*
/etc/udev/udev.conf

/etc/udev/hwdb.d:
. ..

/etc/udev/rules.d:
. ..

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: udev 228-6ubuntu1
ProcVersionSignature: Ubuntu 4.4.0-2.16-generic 4.4.0
Uname: Linux 4.4.0-2-generic x86_64
ApportVersion: 2.19.4-0ubuntu2
Architecture: amd64
Date: Thu Feb 11 16:36:35 2016
InstallationDate: Installed on 2016-02-10 (1 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Alpha amd64 (20160210)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.4.0-2-generic.efi.signed root=UUID=b53bf9e5-5cab-4ebd-98cc-a07ddffe53af ro quiet splash vt.handoff=7
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 03/03/2014
dmi.bios.vendor: Intel Corp.
dmi.bios.version: RKPPT10H.86A.0032.2014.0303.1322
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: D53427RKE
dmi.board.vendor: Intel Corporation
dmi.board.version: G87971-403
dmi.chassis.type: 3
dmi.modalias: dmi:bvnIntelCorp.:bvrRKPPT10H.86A.0032.2014.0303.1322:bd03/03/2014:svn:pn:pvr:rvnIntelCorporation:rnD53427RKE:rvrG87971-403:cvn:ct3:cvr:

Jeff Lane (bladernr) wrote :
Jeff Lane (bladernr) wrote :

More checking... on Trusty, the file is generated by /lib/udev/write_net_rules:

bladernr@sulaco:~$ cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.

And checking my Xenial system (one of them) write_net_rules does not exist:
bladernr@galactica:/etc/udev/rules.d$ ls /lib/udev
ata_id hplj1000 hpljP1008 iphone-set-info scsi_id
cdrom_id hplj1005 hpljP1505 ipod-set-info udev-add-printer
collect hplj1018 hpljP1505n mtd_probe udev-configure-printer
console-setup-tty hplj1020 hwclock-set mtp-probe usb_modeswitch
hdparm hpljP1005 hwdb.bin pcmcia-check-broken-cis v4l_id
hid2hci hpljP1006 hwdb.d pcmcia-socket-startup
hotplug.functions hpljP1007 ifupdown-hotplug rules.d

Now, comparing the packages installed in the two that include udev in the name:

Trusty:
bladernr@sulaco:~$ dpkg -l |grep udev|awk '{print $2 " " $3}'
gir1.2-gudev-1.0 1:204-5ubuntu20.15
libgudev-1.0-0:amd64 1:204-5ubuntu20.15
libgudev-1.0-0:i386 1:175-0ubuntu9
libudev0:amd64 175-0ubuntu13
libudev0:i386 175-0ubuntu13
libudev1:amd64 204-5ubuntu20.15
libudev1:i386 204-5ubuntu20.15
python3-pyudev 0.16.1-2build1
system-config-printer-udev 1.4.3+20140219-0ubuntu2.6
udev 204-5ubuntu20.15

Xenial:
bladernr@galactica:/etc/udev/rules.d$ dpkg -l |grep udev |awk '{print $2 " " $3}'
gir1.2-gudev-1.0:amd64 1:230-2
libgudev-1.0-0:amd64 1:230-2
libudev1:amd64 228-6ubuntu1
system-config-printer-udev 1.5.7+20150819-0ubuntu5
udev 228-6ubuntu1

the manpage for udev in Xenial says:
RULES FILES
       The udev rules are read from the files located in the system rules directory
       /lib/udev/rules.d, the volatile runtime directory /run/udev/rules.d and the local
       administration directory /etc/udev/rules.d. All rules files are collectively sorted and

SO looking at /lib/udev/rules.d for Trusty:
bladernr@sulaco:~$ ls /lib/udev/rules.d/ |grep net
40-bridge-network-interface.rules
40-vlan-network-interface.rules
75-net-description.rules
75-persistent-net-generator.rules
77-mm-huawei-net-port-types.rules

and Xenial:
bladernr@galactica:/etc/udev/rules.d$ ls /lib/udev/rules.d/ |grep net
75-net-description.rules
77-mm-huawei-net-port-types.rules
80-net-setup-link.rules

Xenial is missing one. If this is intentional, how does one go about setting persistent network names?

Jeff Lane (bladernr) wrote :

Hrmm... frustratingly, it's been changed automatically at boot somehow:

[ 5.389985] e1000e 0000:00:19.0 eno1: renamed from eth0
[ 8.689549] asix 2-1.5:1.0 enx8cae4cff4099: renamed from eth0

Martin Pitt (pitti) wrote :

See https://lists.ubuntu.com/archives/ubuntu-devel/2015-May/038761.html for more details about the change, and /usr/share/doc/udev/README.Debian.gz how the current schema works, and how to set custom names or change the policy, if you desire so.

So the lack of /etc/udev/rules.d/70-persistent-net.rules is intended, unless this was an upgrade from trusty -- in that case the file should of course continue to exist (we don't remove it automatically on upgrades). But it sounds like this was a new install.

So for the most part this all works as intended. The main point of contention is the naming of USB devices ("enx8cae4cff4099") -- see the ML discussion for why this is currently done. I'm fine to change this to a different policy if desired by the server or other teams, but everytime I asked about it I get a resounding silence as an answer :-) Retitling the bug accordingly.

I. e. an alternative policy would be: Always use the kernel names for USB devices. As long as you have only one, it will always be eth0, but as soon as you have multiple ones *and* you need to refer to their names in configuration files, then you need to define a naming policy yourself, as the kernel names are not persistent and predictable.

In theory we could also use the path based names for USB devices, which would name the interface according to the port you plug it into. That'd be a good policy for things like a RasPi where you deploy the same image (with that policy) to lots of devices and port location would make sense. This policy makes less sense on a laptop where you might plug in your mobile phone on different ports every time -- but then again those usually use NetworkManager and dynamic configurations where you don't care about device names.

summary: - No udev persistent rules in Xenial = strange device names for NICs
+ Strange device names for USB NICs
Changed in systemd (Ubuntu):
status: New → Incomplete
importance: Undecided → Medium
Martin Pitt (pitti) wrote :

Subscribing server and snappy developers for collecting some opinions about which default naming policy for USB devices we want.

Jeff Lane (bladernr) wrote :

Thanks for that explanation Pitti! THat makes sense now that I've read the thread.

I wouldn't suggest making changes here for the sake of convenience, I also admit that I am a special corner case in this matter.

Would it be a safe assumption that if I can decipher how to write a udev rule for network devices, I should be able to rename them myself? I think, knowing what you described above, that would be fine since this is intended behaviour.

It just caught me off guard as this is the first time running anything but Trusty on this hardware and the only time I generally run an interim release is in VMs or Cloud instances which almost always only have one network device anyway.

Martin Pitt (pitti) wrote :

> Would it be a safe assumption that if I can decipher how to write a udev rule for network devices, I should be able to rename them myself?

Yes, and /usr/share/doc/udev/README.Debian.gz even gives some examples.

Martin Pitt (pitti) wrote :

https://lists.ubuntu.com/archives/ubuntu-devel/2016-April/039302.html did not get too many responses, so that's the schema that 16.04 final has.

Note bug 1567744 is still open about that, but for a slightly different context.

Changed in systemd (Ubuntu):
status: Incomplete → Triaged
importance: Medium → Wishlist
Steeve Cottin (stef-cottin) wrote :

I've got the same problem on a 16.04 LTS zenbook with an ASUS eth2usb 100 Mbit/s dongle, that works perfectly on another 16.04 LTS computer !

I primarily imagined it was Bug #1688081 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1688081 USb-Ethernet ASIX A88772 stops working after kernel 4.10 but this-one seems closer.

On the "good" system, I've got :

$ lsusb
Bus 003 Device 003: ID 0b95:7e2b ASIX Electronics Corp. AX88772B

$ lsmod | grep asix
asix 40960 0
usbnet 45056 1 asix
mii 16384 2 asix,usbnet

$ modinfo asix
filename: /lib/modules/4.4.0-146-generic/kernel/drivers/net/usb/asix.ko
license: GPL
description: ASIX AX8817X based USB 2.0 Ethernet Devices
version: 22-Dec-2011
author: David Hollis
srcversion: DA148880088D4DBCEA4DFE9
alias: usb:...
...
depends: mii,usbnet
retpoline: Y
intree: Y
vermagic: 4.4.0-146-generic SMP mod_unload modversions retpoline

$ ifconfig eth1
eth1 Link encap:Ethernet HWaddr 9c:eb:e8:04:99:50
         inet adr:192.168.5.21 Bcast:192.168.5.255 Masque:255.255.255.0
         UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
         Packets reçus:10067 erreurs:0 :0 overruns:0 frame:0
         TX packets:9517 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 lg file transmission:1000
         Octets reçus:9190044 (9.1 MB) Octets transmis:1533634 (1.5 MB)

$ dmesg | grep asis
asix 3-13:1.0 eth1: register 'asix' at usb-0000:00:14.0-13, ASIX AX88772 USB 2.0 Ethernet, 9c:eb:e8:04:99:50
usbcore: registered new interface driver asix
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
asix 3-13:1.0 eth1: link down
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
alx 0000:02:00.0 eth0: Link Down
IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
asix 3-13:1.0 eth1: link up, 10Mbps, half-duplex, lpa 0x0000
asix 3-13:1.0 eth1: link up, 100Mbps, full-duplex, lpa 0x41E1
asix 3-13:1.0 eth1: link up, 100Mbps, full-duplex, lpa 0x41E1
asix 3-13:1.0 eth1: link up, 100Mbps, full-duplex1

On the bad one, the0 is replacedby enx + MAC (9c:eb:e8:04:99:50) = enx9cebe8049950
I get some elements as the usb NIC was not connected to my wired network (it can't get the DHCP !):

$ ifconfig enx9cebe8049950
enx9cebe8049950 Link encap:Ethernet HWaddr 9c:eb:e8:04:99:50
         UP BROADCAST MULTICAST MTU:1500 Metric:1
         Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 lg file transmission:1000
         Octets reçus:0 (0.0 B) Octets transmis:0 (0.0 B)

$ dmesg| grep asix
asix 1-1.2:1.0 eth0: register 'asix' at usb-0000:00:1d.0-1.2, ASIX AX88772 USB 2.0 Ethernet, 9c:eb:e8:04:99:50
usbcore: registered new interface driver asix
asix 1-1.2:1.0 enx9cebe8049950: renamed from eth0
asix 1-1.2:1.0 enx9cebe8049950: link down

Any idea to help me ?

I tried this : https://askubuntu.com/questions/947519/ubuntu-17-04-how-to-rename-a-usb-network-interface-based-on-path-not-based-on but it doesn't solved...
 sudo ln -s /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers