linux icon indicating copy to clipboard operation
linux copied to clipboard

USB3.0 to SATA adapter causes problems

Open M-Reimer opened this issue 7 years ago • 68 comments

Describe the bug

I have a SATA SSD connected to a USB3.0 to SATA converter.

If I connect this to my Raspberry Pi 4, then the "Access" LED flashes pretty long and I get errors logged (uas_eh_device_reset_handler start)

To reproduce

This is the adapter: https://www.amazon.de/dp/B079QQJB9L/

If this is used on the Raspberry Pi, it takes pretty long for the kernel to "detect" the SSD drive correctly. I haven't tested reliability while using the drive, so far.

I have tried a powered hub but the errors keep exactly the same.

System

Tried several systems. Up-to-date Raspbian and Arch Linux with several self-compiled kernels. Always the same problem.

Logs

Jul 12 20:38:34 alarmpi kernel: usb 2-1: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd Jul 12 20:38:34 alarmpi kernel: usb 2-1: New USB device found, idVendor=2109, idProduct=8110, bcdDevice=91.04 Jul 12 20:38:34 alarmpi kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Jul 12 20:38:34 alarmpi kernel: usb 2-1: Product: USB3.0 Hub
Jul 12 20:38:34 alarmpi kernel: usb 2-1: Manufacturer: VIA Labs, Inc.
Jul 12 20:38:34 alarmpi kernel: hub 2-1:1.0: USB hub found Jul 12 20:38:34 alarmpi kernel: hub 2-1:1.0: 4 ports detected Jul 12 20:38:34 alarmpi kernel: usb 2-1.1: new SuperSpeed Gen 1 USB device number 5 using xhci_hcd Jul 12 20:38:34 alarmpi kernel: usb 2-1.1: New USB device found, idVendor=152d, idProduct=0578, bcdDevice=32.02 Jul 12 20:38:34 alarmpi kernel: usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Jul 12 20:38:34 alarmpi kernel: usb 2-1.1: Product: JMS579 Jul 12 20:38:34 alarmpi kernel: usb 2-1.1: Manufacturer: JMicron Jul 12 20:38:34 alarmpi kernel: usb 2-1.1: SerialNumber: 191951815235 Jul 12 20:38:34 alarmpi kernel: scsi host0: uas Jul 12 20:38:34 alarmpi kernel: scsi 0:0:0:0: Direct-Access CT240BX5 00SSD1 3202 PQ: 0 ANSI: 6 Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] 468862128 512-byte logical blocks: (240 GB/224 GiB) Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] 4096-byte physical blocks Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] Write Protect is off Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08 Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] Disabling FUA Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes) Jul 12 20:38:34 alarmpi kernel: sda: sda1 Jul 12 20:38:34 alarmpi kernel: sd 0:0:0:0: [sda] Attached SCSI disk Jul 12 20:39:05 alarmpi kernel: sd 0:0:0:0: [sda] tag#5 uas_eh_abort_handler 0 uas-tag 6 inflight: CMD IN Jul 12 20:39:05 alarmpi kernel: sd 0:0:0:0: [sda] tag#5 CDB: opcode=0x28 28 00 1b f2 41 d8 00 00 28 00 Jul 12 20:39:05 alarmpi kernel: sd 0:0:0:0: [sda] tag#4 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD IN Jul 12 20:39:05 alarmpi kernel: sd 0:0:0:0: [sda] tag#4 CDB: opcode=0x28 28 00 1b f2 41 28 00 00 a8 00 Jul 12 20:39:05 alarmpi kernel: scsi host0: uas_eh_device_reset_handler start Jul 12 20:39:05 alarmpi kernel: usb 2-1.1: reset SuperSpeed Gen 1 USB device number 5 using xhci_hcd Jul 12 20:39:05 alarmpi kernel: scsi host0: uas_eh_device_reset_handler success Jul 12 20:39:35 alarmpi systemd-udevd[221]: sda: Worker [295] processing SEQNUM=2007 is taking a long time Jul 12 20:39:36 alarmpi kernel: sd 0:0:0:0: [sda] tag#1 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD IN Jul 12 20:39:36 alarmpi kernel: sd 0:0:0:0: [sda] tag#1 CDB: opcode=0x28 28 00 1b f2 44 78 00 00 28 00 Jul 12 20:39:36 alarmpi kernel: sd 0:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN Jul 12 20:39:36 alarmpi kernel: sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 1b f2 44 08 00 00 68 00 Jul 12 20:39:36 alarmpi kernel: sd 0:0:0:0: [sda] tag#2 uas_eh_abort_handler 0 uas-tag 3 inflight: CMD IN Jul 12 20:39:36 alarmpi kernel: sd 0:0:0:0: [sda] tag#2 CDB: opcode=0x28 28 00 1b f2 43 b8 00 00 48 00 Jul 12 20:39:36 alarmpi kernel: scsi host0: uas_eh_device_reset_handler start Jul 12 20:39:36 alarmpi kernel: usb 2-1.1: reset SuperSpeed Gen 1 USB device number 5 using xhci_hcd Jul 12 20:39:36 alarmpi kernel: scsi host0: uas_eh_device_reset_handler success

M-Reimer avatar Jul 12 '19 20:07 M-Reimer

Can we get an update on the situation or at least a new issue to track this? If there's no plan on fixing JMS579 and JMS578 based adapters, then at least provide us with an official list of known good adapters (both for SATA and M.2 B/B+M key drives) that have been tested and work properly/fully-functional with the Raspberry Pi 4B.

FrostbyteGR avatar Mar 16 '20 14:03 FrostbyteGR

Adapter/device whitelists don't work. There hasn't been, and will never be, a curated set of third-party USB devices that are "known good" because manufacturers frequently change chipset revisions and the firmware that runs on them.

This is why this thread exists (linked above): https://www.raspberrypi.org/forums/viewtopic.php?t=245931

Have you tried connecting your adapters to the USB3.0 port and setting the cmdline.txt quirk?

P33M avatar Mar 16 '20 14:03 P33M

Adapter/device whitelists don't work. There hasn't been, and will never be, a curated set of third-party USB devices that are "known good" because manufacturers frequently change chipset revisions and the firmware that runs on them.

This is why this thread exists (linked above): https://www.raspberrypi.org/forums/viewtopic.php?t=245931

Have you tried connecting your adapters to the USB3.0 port and setting the cmdline.txt quirk?

I am aware of the thread and have perused it extensively. Utilizing quirks (as I mentioned earlier) does work for the time being, but I'd like to have a proper long-term solution (uas instead of usb-storage) in place, to leverage the full capabilities (along with a tiny bit of extra performance and lifespan possibly) that an M.2 SSD can offer. It's just that I'm (among several other users, I suppose) struggling to find such solution. Thank you for understanding and the time/effort you've put into this matter.

FrostbyteGR avatar Mar 16 '20 15:03 FrostbyteGR

The issue for me stopped when I moved my USB drive from the RPi4's USB 3.0 slot, to the USB 3.0 4-port hub that I added to my system. It's a bit expensive but I like it's size and it's ability to power it from a micro USB cord and 5v power source if needed. So far, I haven't needed to add power to it. It's a bit on the expensive side so I'm assuming any 3.0 hub would also do the trick.

UGREEN USB 3.0 Hub 4 Port Ultra Slim Data Hub with 5V Micro USB Power Compatible for MacBook Mac Pro Mini, iMac, Surface Pro, XPS, IdeaPad, MateBook X Pro, Notebook PC, USB Flash Drives, Mobile HDD

SDClass avatar Apr 12 '20 09:04 SDClass

Any updates from VIA?

FrostbyteGR avatar Jul 20 '20 11:07 FrostbyteGR

[...] so I'm assuming any 3.0 hub would also do the trick. [...]

This one didn't solve the issue, it's possible on the contrary that errors are more frequent than without it, also with a good power supply plugged in:

https://articulo.mercadolibre.com.ar/MLA-857246129-adaptador-hub-usb-30-a-4-puertos-usb-30-alimentacion-exter-_JM?quantity=1#position=37&type=item&tracking_id=ea39649e-9b91-4f50-93f4-bde723f58611


Let me add a rant here, just to put some weight on the "please fix it" side of the thread:

I wonder how many man-hours this thing will have eaten before VIA provides a fix and the fix is made available and well visible for Raspberry PI newcomers, I wish raspberrypi.org had put a very well visible note on their homepage :-|

I'm another of many who's lost some hours (*) discarding other possible sources of the problem, updating upgrading, checking - via another machine - the ssd for bad sectors, getting source code for binaries I was suspecting might have been compiled with libraries not totally compatible with the Raspberry PI and recompiling from source, ordering a powered hub in case the problem was power related (I'm testing the same disk+case on a USB2 port right now... although without that hub because apparently the Raspberry PI won't boot through it on USB2, while it does on USB3... well... I might always go back to booting from an SDcard and putting the external disk in fstab, if not directly as root in /boot/cmdline.txt).

Considering that I'm personally in constant lack of time and considering that this is a deviation from priorities, I have my Dutch friend's words resonating in my ears, "any low end PC will give any Raspberry PI a run for that price".

But I love the small thing idea with the GPIO pins LOL.

JazzTp avatar Jul 21 '20 16:07 JazzTp

Hubs are not a valid solution if you have a cluster of Pi's, I am pretty sure the reasons are easy to imagine.

FrostbyteGR avatar Jul 21 '20 17:07 FrostbyteGR

Hubs are not a valid solution if you have a cluster of Pi's, I am pretty sure the reasons are easy to imagine.

(I understand that the quoted message, to which I had at first replied, was not addressed to me: I see in my e-mail inbox a post from another user, deleted afterwards apparently, who's running a cluster of 8 Pi's fed via PoE. The comment was actually about hubs not being an acceptable solution.)

JazzTp avatar Jul 21 '20 18:07 JazzTp

Hubs are not a valid solution if you have a cluster of Pi's, I am pretty sure the reasons are easy to imagine.

(I understand that the quoted message, to which I had at first replied, was not addressed to me: I see in my e-mail inbox a post from another user, deleted afterwards apparently, who's running a cluster of 8 Pi's fed via PoE. The comment was actually about hubs not being an acceptable solution.)

That user was me, I decided to delete and rewrite my response, because I felt it was maybe too hostile/whiny. Yes, it wasn't addressed to you, I just felt triggered because I was reminded that I was proposed such a solution. I own a PoE-fed cluster of these bad boys and hubs are not a convenient way to go about it, for multiple reasons. I'll just dish out for a new set of adapters and hope their controllers play nice. There go 270+ euros, if the first one proves functional.

FrostbyteGR avatar Jul 21 '20 19:07 FrostbyteGR

That user was me, [...]

I see, yes we are a bit annoyed about the issue (and in my case absence of a clear warning on their homepage) and it's easy to become too hostile LOL.

Above, ASMedia Technology Inc. has been mentioned as the way to go for now.

(Problem: most online sellers don't publish what chip their adapters are based on.)

JazzTp avatar Jul 21 '20 19:07 JazzTp

Just to add some more info to this thread. I have an UpSquared (Not a RaspberryPi but a Intel N4200 CPU single board computer) that has both a VIA USB Host and a JMicron chipset based Hard Drive enclosure and I have the same issue on Proxmox (Debian/Linux) Host. This is definitely not a RaspberryPi issue and has been going on for a year or more for me (No fix in sight, manufacturers when contacted just wash their hands and blame something else as cause).

EDIT: Also, disabling SMART for the drives using the JMicron chipset enclosures reduced dramatically the amount of occurrences of the issue for me (It still rarely happens though).

rkkoszewski avatar Aug 04 '20 10:08 rkkoszewski

That user was me, [...]

I see, yes we are a bit annoyed about the issue (and in my case absence of a clear warning on their homepage) and it's easy to become too hostile LOL.

Above, ASMedia Technology Inc. has been mentioned as the way to go for now.

(Problem: most online sellers don't publish what chip their adapters are based on.)

This may solve the problem of data corruption it defiantly does not solve the problem of slow speeds.... I have a adapter with ASMedia and the best I can get on any RPI4 is 30mbs which is USB2.0 speeds with uas enabled. Other systems can transfer data to this drive/adapter at over 200mbs. I suspect this is an issue with the VIA chipset used by the PI4 I was able to find issues with VIA going back to 2008 and having terrible compatibility but not sure if its related. This is very sad for the RPI4 as its one of the biggest selling points for it having a usb3 ports. As it stands alot of adapters to get a ssd working will just suck for speed and makes having usb3 completely pointless. Not sure if the foundation can do anything about this as they stated its an issue with the VIA's stuff but I suspect this probably will never be fixed :(. For now maybe I will try my luck playing the amazon roulette for adapters :/..

Treah avatar Aug 11 '20 18:08 Treah

I've also seen this issue again recently. My plan was to set up a TV streaming server with recording capability on a RPi 4. To do this I had to add a big storage device. So I ordered an off-the-shelf 4TB USB HDD which, once again, has the issue described here. Recording failed regularly as the HDD was set to read only by the kernel. I disabled UAS for this drive and now everything is rock stable.

This most probably is an issue directly inside the kernel with this JMicron chipset. I wouldn't even say that the VIA chip is involved in this. I had the UAS errors on my Desktop machine, too. Discussing this here may be the wrong place. Someone with at least basic knowledge would have to move this discussion to LKML. If there is no solution for this, then the kernel should at least not even try to use UAS for this chipset.

M-Reimer avatar Aug 11 '20 18:08 M-Reimer

The kernel USB subsystem has long been warned about 152d:0578 - see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.4&id=62354454625741f0569c2cbe45b2d192f8fd258e - so it's strange that we still need an explicit quirk.

pelwell avatar Aug 12 '20 09:08 pelwell

What are the USB vendor:device IDs for the JMS578 and JMS579?

pelwell avatar Aug 12 '20 09:08 pelwell

JMS578 152d:0578 JMS579 152d:1576

FrostbyteGR avatar Aug 12 '20 09:08 FrostbyteGR

Exactly - now read the linked commit again:

--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2100,6 +2100,13 @@ UNUSUAL_DEV(  0x152d, 0
...
+UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
+		"JMicron",
+		"JMS567",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_BROKEN_FUA),
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -129,6 +129,13 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999,
...
+UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
+		"JMicron",
+		"JMS567",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_BROKEN_FUA),

pelwell avatar Aug 12 '20 10:08 pelwell

I don't see "1576" anywhere in the commit.

FrostbyteGR avatar Aug 12 '20 10:08 FrostbyteGR

But you should see 0578.

pelwell avatar Aug 12 '20 10:08 pelwell

..and how does this help the issue at hand?

Honestly I give up, I'm just gonna go get different chipsets and keep whatever works without issue. I've been nagging about this (JMS579) since March and all we've got is complete radio silence from VIA.

FrostbyteGR avatar Aug 12 '20 10:08 FrostbyteGR