Score:0

QEMU freezes when booting with USB drive passthrough

au flag

Goal

I'm trying to read the contents of a USB 3 external hard drive. It's got a GPT partition table, with almost all space allocated to a single Core Storage partition, which contains a single HFS+ volume of interest.

I haven't been able to natively mount it on linux using libfvde; the resultant block device isn't recognized by either hfsfuse or hfsprogs as being a valid HFS+ volume. I know the volume is valid, so I suspect this is just because it's using a newer format than libfvde supports.

To workaround this, I'm trying to configure a macOS VM that can read the drive for me, using its native drivers. Sosumi (a wrapper around QEMU) looked pretty convenient, so I opted for that.

Issue

I've managed to install macOS in my VM, boot the desktop, etc. I fought with several permission-related errors, but eventually got to the point where QEMU can see my USB device. But now, it just hangs indefinitely on the initial VM screen:

enter image description here

Here's the steps I took (starting from having the macOS already installed)

  1. sudo snap connect sosumi:raw-usb

  2. lsusb:

    Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 006: ID 0bc2:ab31 Seagate RSS LLC Backup Plus Desktop Drive (5TB) # I want this guy
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 009: ID 05ac:024f Apple, Inc. Aluminium Keyboard (ANSI)
    Bus 001 Device 002: ID 046d:c539 Logitech, Inc. USB Receiver
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
  3. Added these 2 configuration lines to my ~/snap/sosumi/common/launch file:

    -device nec-usb-xhci \
    -device usb-host,vendorid=0x0bc2,productid=0xab31 \
    

    (I also tried -device usb-host,hostbus=4,hostaddr=6 instead, to the same effect.)

    I added the device nec-usb-xhci line after QEMU warned my about my device being "superspeed" (5 Gb/s) where it only expected it to be "full speed"/"high speed" (12/480 Mb/s)

  4. Add a whole bunch of permissions on the USB devices (I know these are more permissive than strictly necessary, but I was just trying to rule these out from being the issue, for now.)

    sudo chown -R nobody:nogroup /dev/bus/usb/
    sudo chmod -R 0666 /dev/bus/usb/
    
  5. Started my VM by running sosumi (as my regular admin account, not root).

This was the console output:

*** Checking for kvm interface connection
INFO: kvm interface is connected
*** Checking for firmware files
*** Checking for Base System files
*** Checking for disk image
*** Checking for launch script
*** Launch!
/usr/share/libdrm/amdgpu.ids: No such file or directory

# It just hangs...
# after a while, I manually closed the QEMU window here

libusb: error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
libusb: error [do_close] A cancellation hasn't even been scheduled on the transfer for which the device is closing

What am I doing wrong? Any help is appreciated :)

Update

I eventually got it to boot, but it looks like macOS doesn't have drivers for the xhci (USB 3) controller QEMU uses:

macOS system information panel shows no USB devices

I just ended up using my drive in USB 2 mode. It's a crappy hard drive, so it doesn't really benefit faster transfer speeds of USB 3.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.