Bug 75810

Summary: Cannot add USB devices to guest Windows OS using GNOME Boxes
Product: Spice Reporter: Francesco Turco <fturco>
Component: spice-gtkAssignee: Spice Bug List <spice-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Troubleshooting log from GNOME Boxes
remote-viewer log
Log from ~/.cache/libvirt/qemu/log/boxes-unknown.log

Description Francesco Turco 2014-03-05 17:39:02 UTC
I have a problem with GNOME Boxes 3.10.2, but zeenix from #boxes told me it's probably a bug with spice-gtk. My host operating system is Gentoo Linux while my guest operating system is Windows 7. I'm trying to add USB devices (such as a flash drive or a webcam) to the guest operating system via the appropriate interface in GNOME Boxes (Properties > Devices). First of all I make sure the "Redirect new USB devices" option is set to "on", then I set the USB device that appears on the list to "on", too. The problem is that the guest operating system doesn't recognize the device I added. Nothing happens. When I try with my USB flash drive it correctly gets disconnected from the host operating system when switching to "on" and it gets reconnected when switching to "off". But apart from that nothing happens in the guest operating system.

-----

$ gnome-boxes 
Boxes-Message: machine.vala:149: display Microsoft Windows 7 disconnected

Nothing else is displayed.

-----

gnome-boxes, spice-gtk and qemu packages all have been emerged with the "usbredir" USE flag enabled.

$ emerge -pv gnome-boxes spice-gtk qemu

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] net-misc/spice-gtk-0.21  USE="dbus gtk3 introspection policykit pulseaudio usbredir -doc -gstreamer -python -sasl -smartcard -static-libs -vala" PYTHON_SINGLE_TARGET="python2_7 -python2_6" PYTHON_TARGETS="python2_7 -python2_6" 0 kB
[ebuild   R    ] app-emulation/qemu-1.6.1  USE="aio alsa caps curl fdt filecaps gtk jpeg ncurses opengl png pulseaudio sdl seccomp spice threads usb usbredir uuid vhost-net -accessibility -bluetooth -debug -glusterfs -iscsi -mixemu -python -rbd -sasl (-selinux) -smartcard -ssh -static -static-softmmu -static-user -systemtap -tci {-test} -tls -vde -virtfs -vnc -xattr -xen -xfs" PYTHON_TARGETS="python2_7 -python2_6" QEMU_SOFTMMU_TARGETS="x86_64 -alpha -arm -cris -i386 -lm32 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -or32 -ppc -ppc64 -ppcemb -s390x -sh4 -sh4eb -sparc -sparc64 -unicore32 -xtensa -xtensaeb" QEMU_USER_TARGETS="-alpha -arm -armeb -cris -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -or32 -ppc -ppc64 -ppc64abi32 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -unicore32 -x86_64" 0 kB
[ebuild   R    ] gnome-extra/gnome-boxes-3.10.2  USE="usbredir -smartcard" 0 kB

Total: 3 packages (3 reinstalls), Size of downloads: 0 kB

-----

Please tell me if you need further informations.
Comment 1 Christophe Fergeau 2014-03-05 18:05:36 UTC
I'd start by making sure USB redirection is working with a fedora 20 guest. If it does not, it's more likely to be an installation issue/VM configuration issue/... than a spice-gtk issue.
Comment 2 Francesco Turco 2014-03-05 19:39:08 UTC
Created attachment 95185 [details]
Troubleshooting log from GNOME Boxes

I noticed the usb=off option for the qemu-kvm command. Is that OK?
Comment 3 Francesco Turco 2014-03-05 19:39:52 UTC
I just installed Fedora 20 as the guest OS, then tried to add a USB flash drive. It doesn't work. Same problem as with Windows.
Comment 4 Christophe Fergeau 2014-03-05 21:05:53 UTC
I assume usbredir is installed on your system?
Can you start the VM with Boxes, kill gnome-boxes so that it does not suspend it on exit, and then connect to it with
remote-viewer spice://localhost:5900
and check if you can access the "File/USB Device Selection" menu?
Comment 5 Francesco Turco 2014-03-06 09:00:14 UTC
Package usbredir is installed on my system:

$ emerge -pv usbredir

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-apps/usbredir-0.6  USE="-static-libs" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

-----

I tried with the remote-viewer command. The USB device selection menu is there, but toggling my USB flash drive doesn't make Windows recognize it. Nothing happens, again.
Comment 6 Christophe Fergeau 2014-03-06 09:22:18 UTC
(In reply to comment #5)
> I tried with the remote-viewer command. The USB device selection menu is
> there, but toggling my USB flash drive doesn't make Windows recognize it.
> Nothing happens, again.

Hmm, looks like things are mostly fine, can you try with a linux guest ?
Comment 7 Francesco Turco 2014-03-06 10:42:52 UTC
I tried running remote-viewer with Fedora 20 as the guest operating system. Inside the guest I kept open a terminal with the following command running:

$ watch -n 1 "dmesg | tail"

Then I tried toggling my USB flash drive from the USB device selection menu. Unfortunately nothing happens.
Comment 8 Christophe Fergeau 2014-03-06 17:48:50 UTC
Can you retest with the f20 host/remote-viewer after setting
export SPICE_DEBUG=1
export G_MESSAGES_DEBUG=all
?

Can you also attach the log file from ~/.cache/libvirt/qemu/log/ corresponing to your VM?
Comment 9 Francesco Turco 2014-03-06 19:51:50 UTC
Created attachment 95236 [details]
remote-viewer log

remote-viewer spice://localhost:5900 log after having set SPICE_DEBUG=1 and G_MESSAGES_DEBUG=all
Comment 10 Francesco Turco 2014-03-06 19:53:28 UTC
Created attachment 95237 [details]
Log from ~/.cache/libvirt/qemu/log/boxes-unknown.log

It's the log corresponding to Fedora 20 guest VM.
Comment 11 Christophe Fergeau 2014-03-10 16:09:29 UTC
Are libspice-client-glib.so and your qemu binary both linked with libusbredir?
Comment 12 Francesco Turco 2014-03-10 19:30:32 UTC
I think they are:

ldd /usr/lib64/libspice-client-glib-2.0.so.8.4.0 | grep libusbredir
	libusbredirhost.so.1 => /usr/lib64/libusbredirhost.so.1 (0x00007f6521d89000)
	libusbredirparser.so.1 => /usr/lib64/libusbredirparser.so.1 (0x00007f6521b80000)

ldd /usr/bin/qemu-system-x86_64 | grep libusbredir
	libusbredirparser.so.1 => /usr/lib64/libusbredirparser.so.1 (0x00007f90b1f1b000)
Comment 13 Christophe Fergeau 2014-03-10 23:48:21 UTC
usb redirection was broken with spice-gtk 0.21
Comment 14 Francesco Turco 2014-03-11 19:24:12 UTC
Installed spice-gtk-0.23 from here: https://bugs.gentoo.org/show_bug.cgi?id=492778

Now it works! I can finally add USB devices to my Windows guest operating system.

I think this bug can be closed now (not sure which status option I should pick).
Comment 15 Christophe Fergeau 2014-03-11 19:30:32 UTC
Marking as FIXED, but this was fixed quite some time ago.
Comment 16 Christophe Fergeau 2014-03-11 19:31:12 UTC
Oh, can you file a bug with your distro so that they update spice-gtk to a newer version or add the patch fixing usb redirection to the 0.21 package?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.