Grimoire-
Command
.es

GNU+Linux command memo

Gigabit USB / Ethernet adapter driver

Utiliser un adaptateur USB / Ethernet gigabit sans bloquer le système.

Since 5 years I use a laptop with no Ethernet port. On some rare occasions I needed one and used 3 different USB / Ethernet adapters. Each of them ended up blocking my Linux kernel after a few hours of usage. The last I’ve tested was based on the RTL8153 chip.

1. Linux kernel 5.15

Starting from Linux kernel 5.15 a fix has been included improving the situation. I changed hardware since.

2. Linux kernel between 4.15 and 5.14

(2021-06-14) Linux kernel 5.12 RealTek 8153 chip driver is not supporting USB auto-suspend, so this powersaving setting have to be disabled.

There is also a known bug in the Linux kernel since 2018-08-30 that causes close symptoms with RealTek RTL8153 adapters (embeding a USB hub, as for my experience) : Bug 200977 - Daily crash with r8152 driver requiring reboot ; no kernel fix yet (2020-11-15).

If you encounter this kind of log before a series of kernel Call Traces :

Jun 14 13:39:10 machine kernel: usb 2-3.1: reset SuperSpeed Gen 1 USB device number 17 using xhci_hcd
Jun 14 13:42:01 machine kernel: Call Trace:
Jun 14 13:42:01 machine kernel:  __schedule+0x2ff/0x8b0
 […]

You might want to try one of these solutions.

2.1. /sys/bus/usb/devices/ […] /power/control

This can be achieve by writing on in /sys/bus/usb/devices/2-3/power/control, as your device is the 3rd of the 2nd bus.

# echo on | tee /sys/bus/usb/devices/2-3/power/control (1)
1 This line can be added to /etc/rc.local to have it executed at startup.

2.2. Blacklisting the device via the tlp

Blacklisting the device via the tlp powersaving manager should work also, but have been reported as not fixing the issue on Arch Linux based distributions.

To try it anyway :

$ lsubs
 Bus 002 Device 003: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
 […]
# vi /etc/tlp.conf
 […]
 USB_BLACKLIST="*0bda:8153*"
 […]
# cat /sys/bus/usb/devices/2-3/power/control
on

2.3. kernel boot command method

Another solution is to add usbcore.quirks=0bda:8153:k to the kernel boot command line.

3. Linux kernel prior to 4.15

Older Linux kernels might not have loaded the right driver : https://www.pcsuggest.com/install-rtl8153-driver-linux/

It’s well supported by the Linux kernel, but the default r8152 module is rarely used, the generic cdc_ether driver is loaded instead.

— https://www.pcsuggest.com/install-rtl8153-driver-linux/[Arnab Satapathi]

So a radical solution is to blacklist the faulty kernel module to let the r8152 being used. This can be achieved with a configuration file in /etc/modprobe.d :

# vi /etc/modprobe.d/blacklist_cdc_ether.conf
# depmod -a
blacklist cdc_ether

Another solution is to point out which module to use for your particular peripheral, via udev :

# vi /etc/udev/rules.d/50-usb-realtek-net.rules
ATTR{idVendor}=="0bda", ATTR{idProduct}=="8153", ATTR{bConfigurationValue}!="1", ATTR{bConfigurationValue}="1"

The idVendor and idProduct field values where given by lsusb :

$ lsusb
Bus 002 Device 014: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
 …

The complete 50-usb-realtek-net.rules file can found here : https://github.com/bb-qq/r8152/blob/master/50-usb-realtek-net.rules