USB ethernet adapter (Realtek r8153) keeps disconnecting

12,961

Solution 1

While writing the question I found the source of the bug on the kernel mailing list. The r8152 driver which is responsible for managing my r8153 adapter cannot handle the usb autosuspend (done for power saving reasons). Blacklisting the device for usb autosuspend solves the disconnects and is done like so:

Find out the usb id of your device (0bda:8153 in my case) by using lsusb, which gives me:

Bus 004 Device 003: ID 0bda:8153 Realtek Semiconductor Corp.

Now you open /etc/default/tlp and search for USB_BLACKLIST and add an entry for your device:

USB_BLACKLIST="0bda:8153"

You may need to reboot, after which your ethernet connection should be stable again.

Solution 2

You can also do this using kernel udev rules. I created udev rules both to turn off usb autosuspend for the device and also turn off Turbo Mode of the CPU (which may help too):

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8153", TEST=="power/control", ATTR{power/control}="on"
KERNEL=="cpu",RUN+="/bin/sh -c 'echo -n 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'"

Put the above in a file: /etc/udev/rules.d/50-cpu-custom.rules

Share:
12,961

Related videos on Youtube

nhaesler
Author by

nhaesler

Updated on September 18, 2022

Comments

  • nhaesler
    nhaesler over 1 year

    Since upgrading to Ubuntu 18.04 from 17.10 my usb ethernet adapter keeps disconnecting. It used to work perfectly with 17.10.

    dmesg shows the following output upon a connection drop:

    [  273.462732] usb 4-1.4: usb_reset_and_verify_device Failed to disable LTM
                   .
    [  273.643622] usb 4-1.4: USB disconnect, device number 11
    [  273.795468] usb 4-1.4: new SuperSpeed USB device number 12 using xhci_hcd
    [  273.816520] usb 4-1.4: New USB device found, idVendor=0bda, idProduct=8153
    [  273.816522] usb 4-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=6
    [  273.816523] usb 4-1.4: Product: USB 10/100/1000 LAN
    [  273.816524] usb 4-1.4: Manufacturer: Realtek
    [  273.816525] usb 4-1.4: SerialNumber: 0000A5
    [  273.896167] usb 4-1.4: reset SuperSpeed USB device number 12 using xhci_hcd
    [  273.948778] r8152 4-1.4:1.0 eth0: v1.09.9
    [  274.503001] r8152 4-1.4:1.0 enx144fd7d04a3c: renamed from eth0
    [  274.539481] IPv6: ADDRCONF(NETDEV_UP): enx144fd7d04a3c: link is not ready
    [  274.543857] IPv6: ADDRCONF(NETDEV_UP): enx144fd7d04a3c: link is not ready
    [  276.431243] r8152 4-1.4:1.0 enx144fd7d04a3c: carrier on
    [  276.431258] IPv6: ADDRCONF(NETDEV_CHANGE): enx144fd7d04a3c: link becomes ready
    
  • Anibal Sanchez
    Anibal Sanchez about 4 years
    This tip also solves the issue on UH3031GC Superspeed USB-C 4-Port Hub with Gigabit Ethernet, which comes with RT 8153.
  • Aspiring Dev
    Aspiring Dev almost 4 years
    The gigabit ethernet adapter was not working at all under USB3.0 (but it was for USB2/0) and this seemingly fixed it for me in Fedora 32. Thank you!
  • mcarans
    mcarans almost 4 years
    Glad it helped @AspiringDev!
  • Barnaba
    Barnaba over 3 years
    I tried this on my device (same VID/PID as example; ubuntu 20.04.1) and instead of reconnecting system started freezing :(
  • cyqsimon
    cyqsimon over 2 years
    Note for anyone trying this: tlp has changed its config file location since v1.3. See here. You can find out which version you are running with tlp-stat -s.