UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Failed to attach m.2 to usb converter

Open moham96 opened this issue 2 years ago • 18 comments

Describe the issue I have an SSD enclosure(m.2 to USB converter) that uses an RTL9210B chip, when attaching this to a Linux VM (I tested it on the Debian VM from the UTM gallery) it doesn't work and gives errors in the kernel log(log attached below). Note that the same enclosure works fine under Linux( tested on an intel machine running Linux and also tested under Asahi Linux running on the same MacBook I'm running UTM on.

Configuration

  • UTM Version: 3.1.5
  • OS Version: 12.3.1
  • Intel or Apple Silicon? apple silicon

Crash log N/A

Debug log The log below is when the enclosure doesn't work after attaching to utm:

[   50.131278] usb 3-3: new high-speed USB device number 2 using xhci_hcd
[   50.259530] usb 3-3: device descriptor read/64, error 18
[   50.503453] usb 3-3: device descriptor read/64, error 18
[   50.750657] usb 3-3: new high-speed USB device number 3 using xhci_hcd
[   50.887526] usb 3-3: device descriptor read/64, error 18
[   51.133088] usb 3-3: device descriptor read/64, error 18
[   51.240131] usb usb3-port3: attempt power cycle
[   51.443229] usb 3-3: new high-speed USB device number 4 using xhci_hcd
[   51.464661] usb 3-3: Invalid ep0 maxpacket: 9
[   51.591345] usb 3-3: new high-speed USB device number 5 using xhci_hcd
[   51.611845] usb 3-3: Invalid ep0 maxpacket: 9
[   51.612125] usb usb3-port3: unable to enumerate USB device

The log below when running under asahi linux(the enclosure works fine):

[ 1531.664694] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 1531.664712] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[ 1531.664899] xhci-hcd xhci-hcd.0.auto: hcc params 0x0238ffcd hci version 0x110 quirks 0x0000000000010010
[ 1531.664920] xhci-hcd xhci-hcd.0.auto: irq 85, io mem 0x502280000
[ 1531.665151] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.17
[ 1531.665159] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1531.665165] usb usb1: Product: xHCI Host Controller
[ 1531.665170] usb usb1: Manufacturer: Linux 5.17.0-rc7-asahi-next-20220310-5-1-ARCH xhci-hcd
[ 1531.665175] usb usb1: SerialNumber: xhci-hcd.0.auto
[ 1531.665424] hub 1-0:1.0: USB hub found
[ 1531.665446] hub 1-0:1.0: 1 port detected
[ 1531.665701] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[ 1531.665711] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[ 1531.665718] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.1 Enhanced SuperSpeed
[ 1531.665767] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[ 1531.665849] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.17
[ 1531.665856] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1531.665862] usb usb2: Product: xHCI Host Controller
[ 1531.665866] usb usb2: Manufacturer: Linux 5.17.0-rc7-asahi-next-20220310-5-1-ARCH xhci-hcd
[ 1531.665870] usb usb2: SerialNumber: xhci-hcd.0.auto
[ 1531.666283] hub 2-0:1.0: USB hub found
[ 1531.666303] hub 2-0:1.0: 1 port detected
[ 1534.674356] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 1534.806377] usb 1-1: New USB device found, idVendor=0bda, idProduct=9210, bcdDevice=20.01
[ 1534.806392] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1534.806398] usb 1-1: Product: RSH-329-RTL9210B-CG
[ 1534.806403] usb 1-1: Manufacturer: Realtek
[ 1534.806407] usb 1-1: SerialNumber: 012345678915
[ 1534.813589] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 1534.813714] scsi host0: usb-storage 1-1:1.0
[ 1535.851141] scsi 0:0:0:0: Direct-Access     Realtek  RSH-329-RTL9210B 1.00 PQ: 0 ANSI: 6
[ 1535.851452] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 1535.865573] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[ 1535.867429] sd 0:0:0:0: [sda] Write Protect is off
[ 1535.867433] sd 0:0:0:0: [sda] Mode Sense: 37 00 00 08
[ 1535.869407] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 1535.894043]  sda: sda1
[ 1535.905733] sd 0:0:0:0: [sda] Attached SCSI disk

moham96 avatar May 08 '22 16:05 moham96

Can you try 3.2.1?

osy avatar May 08 '22 16:05 osy

Can you try 3.2.1?

Same problem

moham96 avatar May 08 '22 16:05 moham96

I think the issue is in "usb usb3-port3: attempt power cycle". The way macOS support attaching USBs in VM does not allow the USB device to reset or be power cycled.

osy avatar May 08 '22 16:05 osy

UTM Version 3.2.4 (58) OS Version 12.5 apple silicon

Using Samsung T7 portable SSD drives, I have the same unable to enumerate problem when attempting to attach one to a Linux VM as an external drive. They also fail when trying to attach to a Win 11 VM.

I am running my VMs from a Samsung T7 drive that is attached to my MBP.

The error is repeatable on the four that I tried, including the one storing working VMs.

hopeful-1 avatar Aug 14 '22 16:08 hopeful-1

I am having the same problem, also with an NVMe drive in an inateck USB enclosure. I also tested a Samsung T7 Shield SSD connected to a Linux VM and here is the kernel log: Bildschirm­foto 2022-11-13 um 22 53 30

UTM 4.0.9 from App Store. macOS 13.0.1

c-goes avatar Nov 13 '22 21:11 c-goes

Getting same issues in UTM 4.1.5 in App Store. Using NVMe enclosure: Having issues with copy/paste from UTM to paste dmesg output. However, exact same error that c-goes posted above.

rmervine avatar Jan 23 '23 02:01 rmervine

I'm having the same issue as @rmervine and @c-goes with an "Icybox-1817M-C31" USB M.2 enclosure unter UTM 4.1.6 (homebrew) Screenshot 2023-03-28 at 01 04 54

greedystack avatar Mar 27 '23 23:03 greedystack

I'm seeing the same issue as well. Drive: Samsung 980 Pro 1TB NVMe to USB Adapter: Insignia NS-PCNVMEHDE(-C)

The drive is seen by MacOS without issue. (Of note though, the drive is listed as Bus 000 Device 002: ID 6655:a583 6655 NS-PCNVMEHDE(-C) Serial: XXXXXXX rather than as the Samsung device, though I believe this is due to the USB adapter creating a layer of abstraction.) When I have the VM running and I click the entry in USB Devices for the drive, my Mac shows a notice that the drive was disconnected without being ejected and I see this on the console of the VM:


kali login: [   20.590604] usb 3-3: device descriptor read/64, error 18
[   20.827730] usb 3-3: device descriptor read/64, error 18
[   21.214353] usb 3-3: device descriptor read/64, error 18
[   21.453974] usb 3-3: device descriptor read/64, error 18
[   21.807626] usb 3-3: Invalid ep0 maxpacket: 9
[   21.972239] usb 3-3: Invalid ep0 maxpacket: 9
[   21.974420] usb usb3-port3: unable to enumerate USB device```

bhoglan avatar May 06 '23 03:05 bhoglan

Additionally this is the output I get when sharing my Yubikey to the VM CleanShot 2023-05-05 at 20 23 07@2x

bhoglan avatar May 06 '23 03:05 bhoglan

Same here. I use an Orico CM2C3-G2 with an Crucial P3 plus NVME SSD.

thoschl avatar May 25 '23 20:05 thoschl

I investigated this issue a little bit further. The enclosure is based on a RTL9210 Chip. It works flawless with UTM when attached by an USB-2.0-only Cable or when connected over an USB 2.0 Hub. Switching between USB 3.0 (XHCI) and USB 2.0 does not change the behaviour. issue_3995

There is no issue when I connect this case to a virtual machine running on either „Parallels“ or „VMware Fusion“. The Linux Distribution used does no matter.

thoschl avatar Jun 01 '23 05:06 thoschl

I have the same problem with a Sandisk Extreme Pro external Hard Drive on a freshly installed Mac M1 and freshly installed VM. macOs: 13.4.1 (c) (22F770820d) VM: Kali Linux

[  399.002677] usb 3-3: device descriptor read/64, error 18
[  399.250713] usb 3-3: device descriptor read/64, error 18
[  399.626674] usb 3-3: device descriptor read/64, error 18
[  399.875131] usb 3-3: device descriptor read/64, error 18
[  400.224216] usb 3-3: Invalid ep0 maxpacket: 9
[  400.384269] usb 3-3: Invalid ep0 maxpacket: 9
[  400.387329] usb usb3-port3: unable to enumerate USB device

simonhuwiler avatar Jul 25 '23 12:07 simonhuwiler

UTM is able to detect my enclosure when I use a usb 2.0 cable as @thoschl mentioned.

On virtualbox, I had to run with sudo virtualbox from the mac terminal before I could connect any USB device, as it wouldn't work on a normally launched virtualbox. It is now able to detect my enclosure as usb 3. Perhaps it has something to do with mac permissions? Is there a way to launch utm similarly?

tiubenedict avatar Aug 03 '23 09:08 tiubenedict

found this on stackoverflow:

18 is not an error here. Note it is a positive number, while all the error codes are converted to negative numbers in Linux kernel.

Here, 18 is the return value of usb_control_msg(), which returns the length of the device descriptor if success. So it's the bLength field in your device descriptor, which is 18.

https://stackoverflow.com/a/27289248/3922966

so that's kind of 'normal'.

FYI, here is the linux usb init port function: https://github.com/torvalds/linux/blob/e6fda526d9db2c7897dacb9daff8c80e13ce893d/drivers/usb/core/hub.c#L4732

mx1up avatar Aug 04 '23 23:08 mx1up

Is there any resolution to this other than using a hub? I'm experiencing the same issue with my external SSD. Normal external HDDs work fine. And the SSD works when plugged into a hub, but not when plugged in directly.

I'm hoping to ditch Parallels for UTM, but having to carry around and use a hub for my external SSD would be pretty inconvenient. Are there any external SSDs or enclosures that are known to work?

jd6-37 avatar Jan 12 '24 11:01 jd6-37

When I was getting this "unable to enumerate USB device" message it was related to my choice of USB host controller virtualization in UTM. Like if I had chosen "USB 2" support, I could plug in and use a USB 2 device fine but a USB 3 device will result in the "unable to enumerate USB device" message and not appear in the guest's lsusb list — even though one might expect it to just work, albeit at USB 2 speeds.

My solution was to return the VM's settings to "USB 3 XHCI" (the default), after which I can once again use my SanDisk Extreme Pro USB 3.0 drive in the guest. But this did not help a coworker of mine, who continues to have this issue.

mike-myers-tob avatar Jan 25 '24 23:01 mike-myers-tob

I am having this problem too. I am using a WD mass storage device connected directly to the MacBook Pro USB-C port. I tell MacOS to "ignore" the device (it is formatted with BtrFS which Mac OS can't use), I enable HXCI sharing, boot the guest OS, and select the mass storage device from UTM's toolbar menu. The device is detected by the guest OS but reports an error:

[   374.821965] usb 3-3: Invalid ep0 maxpacket: 9
[   374.822728] usb usb3-port3: unable to enumerate USB device
Screenshot 2024-06-10 at 5 40 27

ramin-honary-ai avatar Jun 09 '24 20:06 ramin-honary-ai

It solved the issue with this setting.

image

Chathula avatar Jun 23 '24 22:06 Chathula