For the past 2 years I've been running a Windows VM to which I passed through USB devices. The devices were attached while the VM was running, using virsh attach-device vm_name config_file.xml
, where config_file.xml
was e.g.:
<!-- Logitech Internet Navigator -->
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x046d'/>
<product id='0xc308'/>
</source>
</hostdev>
This all worked great, until I decided yesterday that it was time to upgrade my Ubuntu 16.04 to 18.04. Now attaching USB devices to the VM doesn't work anymore.
Here's the output I'm seeing:
$ virsh attach-device windows-gaming-uefi config/keyboard-white.xml
error: Failed to attach device from config/keyboard-white.xml
error: internal error: unable to execute QEMU command 'device_add': failed to open host usb device 1:3
The device definitely exists, here's some lsusb
output:
Bus 001 Device 003: ID 046d:c308 Logitech, Inc. Internet Navigator Keyboard
I took a look in kern.log
to see if AppArmor had something to do with it, but that doesn't seem to be the case. Just to make sure it's not interfering with anything, I've disabled AppArmor completely for now.
Does anyone have any clue as to how to fix this?
Edit: Doing a chmod -R go+rw /dev/bus/usb
before attempting to attach the USB devices doesn't help either.
-device ich9-usb-uhci3,id=uhci -device usb-ehci,id=ehci -device nec-usb-xhci,id=xhci