Strange Behavior on USB 3.0 Bus on Raspberry Pi 4: Cannot Plug in Anything Alongside USB 3.0 NVME SSD Enclosure

This is a bit of a followup to the USB 3 issues in this thread, where neither @Darksky nor I could plug an NVME SSD (boot drive) in alongside the USB 3.0 2.5 Gigabit Ethernet adapter: Raspberry Pi 4 (4 GB) + Sabrent 2.5G Ethernet-to-USB 3.0 Adapter?

I wanted to post a quick followup on this, as:

  1. Recent experiments lead me to believe the problems @Darksky and I were having in the previous thread have nothing to do with the Realtek networking chipset in the network adapter, as that’s completely out of the loop now.
  2. @Darksky and I are presumably using different SSDs, and I’m guessing different enclosures having different chipsets. @Darksky, what chipset shows for yours via lsusb?

I recently purchased one of these: Sabrent 4-Port USB 3.0 Hub with Individual LED Lit Power Switches, Includes 5V/2.5A Power Adapter (HB-UMP3): https://www.amazon.com/gp/product/B00TPMEOYM/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

I wanted to have a powered USB 3.0 Hub available for items I was concerned weren’t going to get enough power off the USB 3 bus, especially if the Pi was suspended or sleeping (e.g., keyboards and mice, USB flash drives, etc.).

I plugged the hub into power, turned it on, turned on all four USB 3.0 ports (they’re individually powered), and plugged it into the open USB 3.0 port on the Pi.

Instant crash. The SSH session I had open didn’t disconnect immediately, but it did nothing but sputter out garbage and I couldn’t get any useful diagnostic info off of it.

At this point, I’m wondering if the USB SSD enclosure is misbehaving somehow, and cannot coexist on the USB 3.0 bus because of that. It doesn’t make sense that the Pi’s hardware should choke just having a USB 3.0 drive and an unused hub with 4 open ports connected. There’s no real increase in I/O if the hub isn’t in use, right?

So…maybe it’s the disk enclosure?
Here’s what I get off mine as far as diagnostic info:

❯ lsusb
Bus 002 Device 002: ID 152d:0583 JMicron Technology Corp. / JMicron USA Technology Corp. JMS583Gen 2 to PCIe Gen3x2 Bridge 

From sudo inxi -Fazy

> Drives:
>   Local Storage: total: 465.76 GiB used: 35.25 GiB (7.6%) 
>   ID-1: /dev/sda type: USB model: External USB3.0 size: 465.76 GiB block size: 
>   physical: 4096 B logical: 512 B serial: <filter> drive serial: <filter> 
>   rev: 0209 drive rev: RKT401.3 temp: 38 Celsius C scheme: GPT 
>   SMART: yes health: PASSED on: 55d 22h cycles: 379 
>   read-units: 364,457 [186 GB] written-units: 634,084 [324 GB] 

Model is how it identifies the enclosure, not the drive. I’m also assuming rev: 0209 relates to the enclosure, as well.

I assume this is true as smartctl -a /dev/sda identifies the drive correctly as:

Model Number:                       Sabrent Rocket 4.0 500GB
Firmware Version:                   RKT401.3

I’m pretty stumped at apparently not being able to use anything on the USB 3.0 bus when the SSD is inserted…

Any ideas?

I have no clue if this fixes this or not but I upgraded and pushed to the unstable branch the rpi-eeprom package the other day that fixes some type of nvme boot issue. It will be:

FIRMWARE_RELEASE_STATUS="beta"

https://github.com/raspberrypi/rpi-eeprom/commit/c5fea074c11186ddcf8d8941de69a428e9d29caf#diff-2fd99ac606675ba8113e5addeda4b56ee0b42ee9f8202b0c8cac6707fa5d931f

It will also require installing the latest raspberrypi–bootloader and raspberrypi–bootloader-x packages in the unstable branch:

https://github.com/Hexxeh/rpi-firmware/commit/48570ba954a318feee348d4e642ebd2b58d9dd97

1 Like

I have one of those little 4 port powered USB hubs too, however mine is not Sabrent. I am not able to plug/unplug mine after the RPi is booted or bad juju happens. But if I connect before booting, all is good. I am able to connect and disconnect USB devices in the USB hub, without issue. It is the plugging in of the USB Hub itself after boot, that causes the RPi to have issues for me.

1 Like

@Darksky I’ll try this sometime tonight or tomorrow. Thanks!

@0n0w1c good to know! It’s been a long, long time since I had to worry about not hot-plugging USB devices.

If the new NVME firmware stuff does not fix it, I’ll go back to trying to contemplate how to upgrade the firmware on this USB enclosure. Orico does NOT make it easy to figure out. (Apparently, the Pluggable enclosure uses a different chipset that works a bit better, and can be assembled tooless. Alas.)

Quick followup re: how to switch to the unstable branch the right way. Do I have this process right?

sudo pacman-mirrors --api --set-branch unstable
sudo pacman-mirrors --fasttrack 5 && sudo pacman -Syyu

sudo pacman -S raspberrypi–bootloader raspberrypi–bootloader-x rpi-eeprom

++ REBOOT ++

sudo nano /etc/default/rpi-eeprom-update >> FIRMWARE_RELEASE_STATUS="beta"
sudo rpi-eeprom-update -a

++ REBOOT ++

sudo rpi-eeprom-update -r # remove temp files
sudo rpi-eeprom-update # verify flash

sudo pacman-mirrors --api --set-branch stable
sudo pacman-mirrors --fasttrack 5 && sudo pacman -Syyu

Note 1: The pacman -Syyu command updates the mirrors, but also tries to install a full system update. Do not install a full system update unless you want to go unstable branch for everything.

Note 2: It didn’t offer me an EEPROM update until I installed the rpi-eeprom package.

The flash appears to have worked :slight_smile: :

From the release notes re: USB/USB boot (rpi-eeprom/release-notes.md at master · raspberrypi/rpi-eeprom · GitHub). I’m not sure what some of this means (e.g., the start.elf modification?), but I did notice the callout to my specific Orico external NVME <–> USB 3 enclosure, which has failed to boot in the past (rainbow screen) and needed a hard reboot. Even though I don’t fully understand what it means, it seems like the January 2021 update was also targeting USB drive stability?

2020-10-28:

  • Improve compatibility with external USB 3.0 disk enclosures by enumerating the downstream hubs before executing the USB port power off. N.B. Pi4 8GB automatically powers off the USB ports during chip-reset and does not need this change.
  • Don’t timeout a USB MSD device after USB_MSD_LUN_TIMEOUT if there are no other MSD devices or LUNs to try. This avoids unnecessary timeouts on very slow to initialise disk drives e.g. USB HDDs designed for backups.
  • Fix failover to partition zero if the partition number is invalid. For USB MSD boot a start.elf update is also required.

2021-01-05:

  • Revert the USB port power delay on R1.1 boards to be more like the Sep 2020 production release. Verified with Geekworm X835, Orico NVME M.2 USB adapter and Microsoft Wireless keyboard.

@Darksky Is there anything specifically I can do to help test how this is working, aside from updating to the latest bet trying to plug in the USB 3.0 2.5GbE dongle?

Just to see if it helps with your issue in any way.

Awesome. I’ll plug up the USB hub in a minute and see if it remains stable for 24 hours with nothing plugged in.

EDIT 2: Anecdotally, USB NVME disk read now seems more efficient/faster. It’s hitting the 300 MB/s max more easily. I rarely saw anything over 285 before.

EDIT 1: It’s 11 PM US Central Time on March 17, 2021. The USB hub is plugged in, and visible to Pi. I’m not going to use it, and just use the Pi as normal. If the Pi doesn’t crash in 24 hours, I’ll assume it’s stable and start experimenting with plugging things in.

I added some additional info to my earlier post, just to document the parts of the firmware release notes that seemed to be related to NVME/USB boot.

A couple of questions:

  1. Do I need to be concerned about that “start.elf update” remark? I’m assuming the packages I downloaded updated the .elf file and anything else necessary, since the Pi actually, y’know, booted again.
  2. “Improve compatibility with external USB 3.0 disk enclosures by enumerating the downstream hubs before executing the USB port power off.” Any idea what this means? Specifically, “enumerating the downstream hubs?” I can half-guess, but I’m probably way off the mark.

EDIT: I plugged the NVME SSD enclosure into my powered hub and started up the Pi. It boots. @Darksky , I think this is a definite improvement. I could not get it to reliably boot from the SSD when it was plugged into the hub before. I’m very pleased with this, as I was concerned about the Pi being able to adequately power the NVME over the bus.

On the downside, the hub does appear to introduce some significant overhead. I’m seeing a 15-25 percent read speed drop in hdparm vs plugging the drive directly into the Pi. The slowest I’m seeing is still ~245MB/s, which is still leagues faster than the internal SD card (~45 MB/s) or the onboard 1Gbps Ethernet.

EDIT 2: I ran into some serious issues when I tried to shut down the Pi so I could unplug the onboard Ethernet. It absolutely refused to come back up. No disk activity at all while the SSD was plugged into the hub. I removed the hub from the Pi and plugged the ethernet adapter in directly…and it had put itself back into USB storage mode (for installing drivers when plugged into a Windows machine).

Bus 001 Device 003: ID 0bda:8151 Realtek Semiconductor Corp. RTL8151 Adapteon Business Mobile Networks BV

This command switches its mode to ethernet adapter:

sudo usb_modeswitch -v 0bda -p 8151 -V 0bda -P 8152 -M 555342430860d9a9c0000000800006e0000000000000000000000000000000

However, the mode switch does not survive restart. I’m going to have to look at a udev rule, I think, which I don’t completely understand how to write. I know there’s a way to automatically run that command on startup with Udev, though.

EDIT 3: I bounced around google last night until I found someone who was trying to do a modes witch on their USB device via Udev, and wasn’t also trying to do sixteen other things at once, so I was actually able to figure it out.

Here’s the Udev rule:

❯ cat /etc/udev/rules.d/40-usb-realtek-modeswitch.rules
ACTION=="add|change", SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8151", RUN+="/usr/sbin/usb_modeswitch -v 0bda -p 8151 -V 0bda -P 8152 -M '555342430860d9a9c0000000800006e0000000000000000000000000000000'"

Here’s the mode-switched device:

❯ lsusb
Bus 001 Device 004: ID 0bda:8156 Realtek Semiconductor Corp. USB 10/100/1G/2.5G LAN

After making sure the right usb device name is used in ‘nmtui’, the interface comes up:

❯ ip addr show enp1s0u1u1
4: enp1s0u1u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether $HW_MAC brd ff:ff:ff:ff:ff:ff
    inet 10.0.4.51/24 brd 10.0.4.255 scope global dynamic noprefixroute enp1s0u1u1
       valid_lft 86108sec preferred_lft 86108sec

Conclusion:

  1. The EEPROM update + the patched kernel did the trick. Now I’ve got the 2.5GbE dongle and the NVME SSD on the same USB bus. This still worked after shutting down the Pi, removing the ethernet cable from the onboard 1GbE, and restarting it.
  2. LightDM is non-functional again. I have no idea what’s going on here, aside from the fact Xorg refuses to see any screens plugged in using this kernel. I will be pleased when I can finally switch to X11 forwarding.
  3. I’m going avoid messing with the network settings for at least 12 hours. If anything is going to become unstable and crash, it shouldn’t take longer than that.

Questions:

  1. Is there anything specific you’d like me to test, aside from it just not crashing?
  2. You mentioned in the Kernel thread that you were rolling this change into the latest unstable 5.10.y kernel a while ago. Does that mean that at some point, assuming all this works, I’ll be able to install the latest 5.10.y unstable kernel and insert this altered driver into it?

Update: It crashed again, roughly 2 minutes after I updated this post to say it worked. While the new firmware definitely improved things–the SSD and ethernet adapter were stable on the same USB bus for minutes before it all went boom–it’s still apparently hardware limited.

It didn’t seem to make a difference whether the SSD or the USB ethernet adapter was plugged directly into the Pi, while the other device was plugged into the powered hub.

I need to get back to work, but later on I’ll do two more tests:

  1. Try plugging the ethernet adapter in to the USB 3.0 port after the Pi has successfully booted off the SSD. It may be possible that something is going on specific to trying to boot with it, given that the one time it seemed to work was when I plugged it in after the Pi was already booted. If that’s the case, maybe dmesg will reveal something useful about what’s going on. But it’s not really feasible, IMHO, to use an ethernet adapter that can’t be plugged in when the system boots–especially given how often I end up rebooting the Pi while tweaking various docker containers and other things actually involving using the Pi.
  2. Switch the SSD to the USB 2.0 bus and see if that stays stable long term. That’s the last test I can think to run. Of course, if that works, there’s a good argument for just going back to a large SD card if I want to keep the 2.5GbE adapter connected.

Alright, after more testing:

  1. Device remained unstable. Absolutely cannot connect both the SSD and the ethernet adapter to the same USB 3 bus, even with the latest EEPROM. Sometimes it works for a few minutes, sometimes longer. It absolutely never works when the ethernet adapter is plugged in when the device boots. It has to be plugged in after boot, and then manually activated in nmtui if it’s in a different USB port than it was in before (the name of the adapter in nmtui has to be changed to match the name shown in ip address show).
  2. With the SSD plugged into the USB 2 port, the Pi booted and an open SSH session using the on-board ethernet, it is possible to plug in the adapter, adjust nmtui, and get an IP. However, after some arbitrary length of time, I lose my connection and cannot reconnect via SSH to either network adapter. After unplugging the USB cable connecting the adapter, the built-in ethernet adapter’s IP is pingable and I can hit it with nmap, but SSH cannot connect until after a restart.

Since I still can’t get LightDM to start with this version of the kernel, I’m left with no way to interact with the Pi without a restart.

Here’s what I got off dmesg. I noticed it failing and restarting a lot before finally getting an address, and still throwing errors about not being able to, e.g.: “device (eth1): driver ‘r8152’ does not support carrier detection.” If the pattern of failing and then succeeding to talk to the device repeats, it’s no wonder it eventually loses connection–though admittedly, I don’t fully understand why sshd becomes unreachable but the device remains pingable.

Mar 19 17:47:17 teletraan1 kernel: r8152: loading out-of-tree module taints kernel.
Mar 19 17:47:18 teletraan1 NetworkManager[378]: [1616194038.6264] device (eth1): driver ‘(null)’ does not support carrier detection.
Mar 19 17:47:18 teletraan1 systemd-networkd[207]: eth1: Could not determine whether the device is initialized: No such file or directory
Mar 19 17:47:18 teletraan1 kernel: r8152 1-1.1:1.0 (unnamed net_device) (uninitialized): get_registers -19
Mar 19 17:47:18 teletraan1 kernel: r8152 1-1.1:1.0 (unnamed net_device) (uninitialized): Get ether addr fail
Mar 19 17:47:18 teletraan1 kernel: r8152 1-1.1:1.0 (unnamed net_device) (uninitialized): netif_napi_add() called with weight 256
Mar 19 17:47:18 teletraan1 kernel: r8152 1-1.1:1.0 eth1: v2.14.0 (2020/09/24)
Mar 19 17:47:18 teletraan1 kernel: r8152 1-1.1:1.0 eth1: This product is covered by one or more of the following patents:
US6,570,884, US6,115,776, and US6,327,625.
Mar 19 17:47:18 teletraan1 kernel: usbcore: registered new interface driver r8152
Mar 19 17:47:18 teletraan1 kernel: usb 1-1.1: USB disconnect, device number 4
Mar 19 17:47:18 teletraan1 systemd-networkd[207]: eth1: Failed
Mar 19 17:47:18 teletraan1 systemd-networkd[207]: Could not process new link message, ignoring: No such file or directory
Mar 19 17:47:18 teletraan1 NetworkManager[378]: [1616194038.6270] device (eth1): driver ‘r8152’ does not support carrier detection.
Mar 19 17:47:18 teletraan1 NetworkManager[378]: [1616194038.6279] manager: (eth1): new Ethernet device (/org/freedesktop/NetworkManager/Devices/18)
Mar 19 17:47:18 teletraan1 systemd-udevd[5905]: eth1: Failed to query device driver: No such device
Mar 19 17:47:18 teletraan1 systemd-udevd[5905]: eth1: Failed to get link config: No such device
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=30.00
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: Product: USB 10/100/1G/2.5G LAN
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: Manufacturer: Realtek
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: SerialNumber: 000000001
Mar 19 17:47:18 teletraan1 kernel: cdc_ncm 2-1:2.0: MAC-Address: 00:24:27:88:08:c1
Mar 19 17:47:18 teletraan1 kernel: cdc_ncm 2-1:2.0: setting rx_max = 16384
Mar 19 17:47:18 teletraan1 kernel: cdc_ncm 2-1:2.0: setting tx_max = 16384
Mar 19 17:47:18 teletraan1 kernel: cdc_ncm 2-1:2.0 usb0: register ‘cdc_ncm’ at usb-0000:01:00.0-1, CDC NCM, 00:24:27:88:08:c1
Mar 19 17:47:18 teletraan1 NetworkManager[378]: [1616194038.8047] manager: (usb0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/19)
Mar 19 17:47:18 teletraan1 kernel: cdc_ncm 2-1:2.0 usb0: unregister ‘cdc_ncm’ usb-0000:01:00.0-1, CDC NCM
Mar 19 17:47:18 teletraan1 kernel: usb 2-1: reset SuperSpeed Gen 1 USB device number 4 using xhci_hcd
Mar 19 17:47:19 teletraan1 kernel: r8152 2-1:1.0 eth1: v2.14.0 (2020/09/24)
Mar 19 17:47:19 teletraan1 kernel: r8152 2-1:1.0 eth1: This product is covered by one or more of the following patents:
US6,570,884, US6,115,776, and US6,327,625.
Mar 19 17:47:19 teletraan1 NetworkManager[378]: [1616194039.1232] manager: (eth1): new Ethernet device (/org/freedesktop/NetworkManager/Devices/20)
Mar 19 17:47:19 teletraan1 mtp-probe[5931]: checking bus 2, device 4: “/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-1”
Mar 19 17:47:19 teletraan1 mtp-probe[5931]: bus: 2, device: 4 was not an MTP device
Mar 19 17:47:19 teletraan1 systemd-udevd[5905]: usb0: Failed to query device driver: No such device
Mar 19 17:47:19 teletraan1 systemd-udevd[5905]: usb0: Failed to get link config: No such device
Mar 19 17:47:19 teletraan1 mtp-probe[5959]: checking bus 2, device 4: “/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-1”
Mar 19 17:47:19 teletraan1 mtp-probe[5959]: bus: 2, device: 4 was not an MTP device
Mar 19 17:47:19 teletraan1 systemd-udevd[5904]: Using default interface naming scheme ‘v247’.
Mar 19 17:47:19 teletraan1 systemd-udevd[5904]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.
Mar 19 17:47:19 teletraan1 kernel: r8152 2-1:1.0 enp1s0u1: renamed from eth1
Mar 19 17:47:19 teletraan1 systemd-networkd[207]: eth1: Interface name change detected, eth1 has been renamed to enp1s0u1.
Mar 19 17:47:19 teletraan1 NetworkManager[378]: [1616194039.9570] device (eth1): interface index 20 renamed iface from ‘eth1’ to ‘enp1s0u1’
Mar 19 17:47:19 teletraan1 NetworkManager[378]: [1616194039.9807] device (enp1s0u1): state change: unmanaged → unavailable (reason ‘managed’, sys-iface-state: ‘external’)
Mar 19 17:47:19 teletraan1 systemd-networkd[207]: enp1s0u1: Link UP
Mar 19 17:47:19 teletraan1 systemd-udevd[5905]: Using default interface naming scheme ‘v247’.
Mar 19 17:47:20 teletraan1 systemd-udevd[5905]: ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.
Mar 19 17:47:23 teletraan1 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp1s0u1: link becomes ready
Mar 19 17:47:23 teletraan1 kernel: r8152 2-1:1.0 enp1s0u1: carrier on
Mar 19 17:47:23 teletraan1 systemd-networkd[207]: enp1s0u1: Gained carrier

Have you tried increasing the power to the USB ports?

max_usb_current=1

I found the setting in this link, no clue if it works or if it will allow the magic smoke* to escape from your RPi4.

  • Note: magic smoke appears to make electronics function… if it escapes, the device ceases to operate. :wink:

Oooh. I didn’t know you could amp the USB ports.

Like you said, I’d be a bit wary of frying it. I also very occasionally get the undervolt rainbow. I’m not sure how much extra juice is left in my power supply.

(Are there Pi PSUs meant for overclocking?)

The 3.5 amp power supplies are .5 amp over spec. I get them from CannaKit.

I happen to be using a 3 amp power supply today. I am using a low power SSD while I compile the kernel. And for the first time, I am seeing under-voltage warnings. So I highly recommend the 3.5 amp power supplies.

That’s the one I have, with the switch.

I’ve also got overvoltage set to 6 and am overclocking the CPU to 2000MHz. I’m wondering if I’d be pushing my luck under those conditions trying to push the USB current.

I’d be awesome if there was a way to monitor how much power the Pi is actually using vs. how much is available in a stable way.

I switched to a 3.5 amp power supply before I started another kernel compile, and have not received another warning since. It could be that the 3 amp just happens to be a poor power supply. There are USB power testers, but I have not ever used one.

Found this issue today. Maybe now it will get some attention.

This issue has been with the pi4 since day 1 with interference. Depending on which side of the fence you are on they have played the blame game. RPi says improper shielding with the ssd plugged in and others say bad design with the pi4 board.

Interference can maybe be minimized like this.

Hehe. I have my ssd enclosure wrapped in tinfoil but it is just a stick so no box with vents like some have.