attaching usb dongle to KVM VM
It's probably a problem with access rights. Your QEMU deamon is not allowed to access the USB devices. Try:
chown libvirt-qemu /dev/bus/usb/ -R
or whichever user your KVM is running as. This should do the trick.
To grant permanent access to the raw USB device nodes to the user the hypervisor runs as, you need to create an udev rule; the chown-based answer will only work until the next reboot.
In /lib/udev/rules.d
, create a file like 51-usb_passthrough.rules
:
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{busnum}=="2" ATTRS{devpath}=="1" GROUP="kvm"
Here I used physical bus and port numbers to target the device (as I prefer passing through the physical port no matter what device is plugged in rather than reconfiguring my VM each time I connect a new device), but of course you can use whatever attributes you want; the GROUP
argument determines the group that will own the device node, this should be whatever user runs the virtual machines.
Run udevadm control --reload-rules
to make the new rule effective immediately (you still need to disconnect/reconnect the USB devices) or simply reboot the host.