Sunday, November 10, 2013

Missing USB devices in KVM or QEMU with Ubuntu Saucy?

I've been a long time user of Fitibits. These are small devices you wear on your person to track activity. For instance, the Fitibit Ultra can track steps taken and stairs taken among other things. The device integrates with an application and has a nice webapp to display your history.

Setup on the Ultra was done with a Windows machine as there is (well was) no Linux client. I borrowed my wife's machine (as she already had the software installed as she too had an Ultra.) Once the device was setup, some guys at Canonical created a library for Ubuntu that would allow you to sync the device properly from Ubuntu (without running Windows.) Windows was only needed at setup time.

Fitbit continued to develop new monitors and I recently ordered the Fitbit Force. The Force is essentially a smartwatch. It has a superset of features of the Ultra. It also requires setup via Windows (or Mac) and I still don't own one of those. I figured I'd just use KVM and a Windows guest image.

I'm running Ubuntu Saucy with

libvirt-bin 1.1.1-0ubuntu8
qemu-system 1.5.0+dfsg-3ubuntu5

these versions of libvirt and qemu.

Fitbit Force comes with a small dongle you plug into your usb port. (Essentially, this is a bluetooth 4 device but it is single purposed, pairing only with the Fitbit Force.) 

So I added the USB device info to my virtual machine description (using the GUI). This allows for specific usb hub and device passthrough. However, the device was never showing up in Windows (as near as I could tell.)  I spent hours debugging this, changing perms on the usb device tree, running as root, etc, to no avail.

To troubleshoot, I used a USB device lister, USBDeview, from Nirsoft. It's freeware (free as in beer). It did a nice job of listing my past and present USB devices by walking the USB tree and the registry entries of past devices. Nope, no Fitbit Force.

A bit of googling and debugging led me to this gem:
"Apparmor blocks usb devices in libvirt in Saucy" bug #1245251. By using the work around in comment #1, my Fitbit Force (and any other USB device I requested) were now available in the guest.

(I had previously tried the apparmor settings mentioned in the Managing KVM page, to no avail. Those instructions pre-date Saucy.)

Hopefully by the time anyone stumbles on this particular post, this bug will already be fixed in Saucy and Trusty, but I like to publish these lessons learned Just In Case.

Oh, and one other note, once the initial setup is done, you can pair your smartwatch to your android phone... once they add the type of android phone you have. The Nexus 5 is apparently slightly too new..... :( so I'll be using that Windows image a bit more than I planned.

No comments: