Cannot redirect USB storage device to Qemu VM (Linux / Windows)

Hi community,

yesterday I noticed that I can’t redirect USB storage devices to my KVM/Qemu VMs. I use virt-manager to manage my VMs, hence I use the menu of the vm console window: VirtualMachine->Redirect USB Device. Usually that worked, but not anymore. It stopped working for Linux and Windows VMs. I can’t say when it stopped working because I don’t use USB redirection very often.

I found this Arch-Linux Bug (closed): FS#69428 : spice-gtk 0.39-1: USB redirection error

On my Manjaro-Xface laptop is spice-gtk-0.39-3 installed. But I have the problem, which is described in the Arch-Linux bug without the virt-manager gui messages.

Then I ran virt-manager --debug --no-fork, which resulted in the following console messages while redirecting a USB thumbdrive manually:

[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:706) node device lifecycle event: nodedev=block_sda_SanDisk_Ultra_Fit_0501fbf0674f066bd6df86d83ff2a70885326812affdfafb6a683dcbe0e534dfa0c800000000000000000000766cbf2500070310835581072d287cf7_0_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_2_0_0_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_target2_0_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_host2 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1050) nodedev=scsi_host2 removed
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1050) nodedev=scsi_target2_0_0 removed
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1050) nodedev=scsi_2_0_0_0 removed
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1050) nodedev=block_sda_SanDisk_Ultra_Fit_0501fbf0674f066bd6df86d83ff2a70885326812affdfafb6a683dcbe0e534dfa0c800000000000000000000766cbf2500070310835581072d287cf7_0_0 removed
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1046) Requested removal of nodedev=scsi_host2, but it's not in our object list.
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1046) Requested removal of nodedev=scsi_target2_0_0, but it's not in our object list.
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1046) Requested removal of nodedev=scsi_2_0_0_0, but it's not in our object list.
[Thu, 22 Apr 2021 11:35:05 virt-manager 4089] DEBUG (connection:1046) Requested removal of nodedev=block_sda_SanDisk_Ultra_Fit_0501fbf0674f066bd6df86d83ff2a70885326812affdfafb6a683dcbe0e534dfa0c800000000000000000000766cbf2500070310835581072d287cf7_0_0, but it's not in our object list.

In the Linux VM: lsusb shows the device, but it can’t be used neither manually mount nor through the file manager. The command lsblk shows the USB device too, but without any further information.

Redirect the thumb-drive journalctl -xk --follow message (Debian 10 VM):

Apr 22 19:04:12 u1-pc001 kernel: usb 2-4: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
Apr 22 19:04:12 u1-pc001 kernel: usb 2-4: New USB device found, idVendor=0781, idProduct=5583, bcdDevice= 1.00
Apr 22 19:04:12 u1-pc001 kernel: usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 22 19:04:12 u1-pc001 kernel: usb 2-4: Product: Ultra Fit
Apr 22 19:04:12 u1-pc001 kernel: usb 2-4: Manufacturer: SanDisk
Apr 22 19:04:12 u1-pc001 kernel: usb 2-4: SerialNumber: 0501fbf0674f066bd6df86d83ff2a70885326812affdfafb6a683dcbe0e534dfa0c800000000000000000000766cbf2500070310835581072d287cf7
Apr 22 19:04:12 u1-pc001 kernel: usb-storage 2-4:1.0: USB Mass Storage device detected
Apr 22 19:04:12 u1-pc001 kernel: scsi host8: usb-storage 2-4:1.0
Apr 22 19:04:13 u1-pc001 kernel: scsi 8:0:0:0: Direct-Access     SanDisk  Ultra Fit        1.00 PQ: 0 ANSI: 6
Apr 22 19:04:13 u1-pc001 kernel: sd 8:0:0:0: Attached scsi generic sg1 type 0
Apr 22 19:04:13 u1-pc001 kernel: sd 8:0:0:0: [sda] 120176640 512-byte logical blocks: (61.5 GB/57.3 GiB)
Apr 22 19:04:13 u1-pc001 kernel: sd 8:0:0:0: [sda] Write Protect is off
Apr 22 19:04:13 u1-pc001 kernel: sd 8:0:0:0: [sda] Mode Sense: 43 00 00 00
Apr 22 19:04:13 u1-pc001 kernel: sd 8:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Apr 22 19:04:13 u1-pc001 kernel:  sda: sda1
Apr 22 19:04:13 u1-pc001 kernel: sd 8:0:0:0: [sda] Attached SCSI removable disk

And these when stopping the redirect:

Apr 22 19:08:58 u1-pc001 kernel: usb 2-4: USB disconnect, device number 4
Apr 22 19:08:58 u1-pc001 kernel: sd 8:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Apr 22 19:08:58 u1-pc001 kernel: sd 8:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 07 29 be f8 00 00 08 00
Apr 22 19:08:58 u1-pc001 kernel: print_req_error: I/O error, dev sda, sector 120176376
Apr 22 19:08:58 u1-pc001 kernel: print_req_error: I/O error, dev sda, sector 120176376
Apr 22 19:08:58 u1-pc001 kernel: Buffer I/O error on dev sda1, logical block 15021791, async page read

In the Windows VM: It gives the audio notification, but in the file manager the progress bar runs for a very long time and then it asked me to insert a disk in disk-drive D:. So it recognizes an USB thumb-drive as CD-Drive. (latest version of spice-agent and usbdk are installed)

Since I haven’t installed or modified anything, I’m posting this here in hope that someone else experienced this problem too.

Regards.

1 Like

Interestingly the WebCam can be redirected without any problems.

This problem occurs with both kernels: 5.11.14-1 and 5.10.30-1. I also reinstalled the virtualization components:

sudo pacman -Sy virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat

But the problem persists.

Furthermore I found that the Gentoo folks filed this bug: https://bugs.gentoo.org/775554. Maybe related?

So, it’s still not working, but a direct pass-through (virt-manager->View->Details->Add Hardware->USB Host Device) of USB3 thumb-drive works. So, it’s definitely some issue with spice-gtk and/or usbredir.

Anybody else using Manjaro-Xface+Qemu-KVM+virt-manager? Does it work for you?

Kernel: 5.11.14-1
Qemu: 5.2.0-4
Spice-GTK: 0.39-3
usbredir: 0.9.0-1
virt-manager: 3.2.0-1

virt-host-validate output:

  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : PASS
  QEMU: Checking for cgroup 'blkio' controller support                       : PASS
  QEMU: Checking for device assignment IOMMU support                         : PASS
  QEMU: Checking if IOMMU is enabled by kernel                               : PASS
  QEMU: Checking for secure guest support                                    : WARN (Unknown if this platform has Secure Guest support)
   LXC: Checking for Linux >= 2.6.26                                         : PASS
   LXC: Checking for namespace ipc                                           : PASS
   LXC: Checking for namespace mnt                                           : PASS
   LXC: Checking for namespace pid                                           : PASS
   LXC: Checking for namespace uts                                           : PASS
   LXC: Checking for namespace net                                           : PASS
   LXC: Checking for namespace user                                          : PASS
   LXC: Checking for cgroup 'cpu' controller support                         : PASS
   LXC: Checking for cgroup 'cpuacct' controller support                     : PASS
   LXC: Checking for cgroup 'cpuset' controller support                      : PASS
   LXC: Checking for cgroup 'memory' controller support                      : PASS
   LXC: Checking for cgroup 'devices' controller support                     : PASS
   LXC: Checking for cgroup 'freezer' controller support                     : PASS
   LXC: Checking for cgroup 'blkio' controller support                       : PASS
   LXC: Checking if device /sys/fs/fuse/connections exists                   : PASS

I’m running out of ideas; any help would be highly appreciated. :dizzy_face:

Not on Manjaro but on Arch.
I run different flavours of Manjaro as my guests.

It is the exact same for me.

Luckily I don’t need that feature to add usb storage on the fly, while the guest is running.
I was just curious and tested with my thumb drive.
Not a helpful reply, I’m afraid …

1 Like

Thanks Nachlese.

Actually very helpful. It confirms the problem. :slightly_smiling_face:

Hi!

same issue: Manjaro XFCE as host, Windows 10 as guest (fresh install from ISO, with product key, affinity suite installed, some desktop customization was done and some fonts were installed, everything else is default).

Kernel: 5.10.53-1
CPU: Intel Core i7-7700HQ, 2 threads, 4 cores, 2.8GHz
GPU: Intel and Nvidia GTX 1060, proprietary drivers on host.
Spice-Tools drivers on Windows Guest.

I can even see the device(s) in the Windows VM under “This PC” as well as in Device Manager, I just can’t access them – WinExplorer hangs, when i try. Can’t upload screenshots (yet?), unfortunately.

Interestingly, when in Device Manager → Universal Serial Bus Controllers → USB Mass Storage Device → right-click → Properties, under the Events tab, I get this message: “Device USB\VID_090C&PID_1000\18122500007533 requires further installation.” Spice-Tools issue? Or are my permissions not set up right for Virt-Manager?

Have you, by any chance, already found a solution to this?

setting up a USB Host Device and then booting the VM works for me as well, for USB A and USB C Ports. I’ve tried this with UFW on and off, so I’m pretty sure its not the firewall. I’m also working on getting the share folder set up, all the while finding more and more manuals to read – total linux-noob here…

If the share folder works, I won’t really need the USB redirect, but I’m very curious to know what causes this. In any case I’d very much appreciate a reply.

Cheers and thanks in advance!

maprok

The symptoms you describe occured in our Fedora 34 vm host (which I use besides Manjaro). It was caused by usbredir version-0.9.0-1. So that my be your cause too.

In response to the bug report, that package was updated by Fedora to 0.10.0-1 and this fixed the problems in Fedora 34.

Or, you can downgrade back to usbredir-0.8.0-5 if that version is available - that worked for a Fedora 33 vm host which is on still another computer.

Nope…but it seems that the culprit is usbredir. I hot-attach via add vhardware (USB device). Do what I want to do and then hot-detach the device.

I guess so. Installed version on Manjaro-Xfce is 0.9.0-1, hence we’ve to wait for upstream until they could fix it.

Thank you both, @bearcat & @MaFo for the information and the suggestions. Seeing as I will only need Windows for Layouting/2D stuff (affinity suite, MS Office) and I can do everything else (blender, slic3r and so on) on Manjaro, I will wait for the usbredir Update. I also still have the share-folder on my list, where I’m pretty confident about it working, I just haven’t had the time to try yet.

Thanks a bunch!

Hey, just a heads up:

I finished updating to the latest packages: usbredir v0.11.0-1 absolutely fixed the issue for me!

Storage devices are working on all ports in Windows 10 Guest, USB 2.0, 3.0, and C – even multiple devices at once. Hope it works for you too, if it hasn’t already!

Cheers!

Yep, I can confirm that it works on Debian 10 (Buster) VMs.