« Back to overview

I have an external ethernet adapter (Realtek8151) connected to my RPI4 usb 3 ports, and also an external usb SSD. My RPI boots from the usb SSD, but now thinks that my ethernet adapter is a storage device!

If I hotplug the usb ethernet adapter, it is recognized and there is no problem.

This may be because some adapters first start up as a storage device, to allow windows to install required drivers, and then switches to network mde. Apparently at boot, the adapter can keep hanging in 'storage mode'.

I solved it this way; remember this was Ubuntu 20.04LTS on a Raspberry Pi 4:


First, find the vendor and product id of the device.

lsusb
# output:
# Bus 002 Device 002: ID 0bda:8151 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter

In this case, it is 0bda (vendor id) and 8151 (product id) - later this will be 8153, I think 8151 is the storage device.

Now, we need to install 'usb-modeswitch':

sudo apt install usb-modeswitch

With usb modeswitch, we can 'reset' the adapter:

usb_modeswitch -v 0bda -p 8151 -R

(you should now see the network interface coming up).

We want this to happen at the right time, during system boot, so we'll create a service:

/etc/systemd/system/rpi-usbfix.service:

[Unit]
Description=Fixes some usb issues

[Service]
ExecStart=/usr/sbin/usb_modeswitch -v 0bda -p 8151 -R
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

We can no reset the adapter with:

systemctl start rpi-usbfix.service

Or do that automatically at boot time with:

systemctl enable rpi-usbfix.service