I have been trying to set up a QEMU + KVM configuration to run a couple of VMs on Ubuntu as the host. I even have been able to passthrough a GPU successfully to the guests.
However, there seems to be an issue passing through input devices. No matter what I do or which guide I follow, I always get the following error in VM logs:
2021-07-17T11:22:42.556148Z qemu-system-x86_64: -object input-linux,id=mouse1,evdev=/dev/input/mouse0: /dev/input/mouse0: is not an evdev device
2021-07-17 11:22:42.616+0000: shutting down, reason=failed
The pertinent section for the VM config is
<qemu:arg value="-object"/>
<qemu:arg value="input-linux,id=mouse1,evdev=/dev/input/mouse0"/>
<qemu:arg value="-object"/>
<qemu:arg value="input-linux,id=kbd1,evdev=/dev/input/event2,grab_all=on,repeat=on"/>
The QEMU - Libvirt config has these lines:
user = "my user"
group = "108"
#108 = kvm
cgroup_device_acl = [
"/dev/input/mouse0",
"/dev/input/event2",
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm",
"/dev/rtc","/dev/hpet"
]
And here are the devices:
user:~$ ls -lha /dev/input/by-id/
total 0
drwxr-xr-x 2 root root 160 Jul 17 08:35 .
drwxr-xr-x 4 root root 500 Jul 17 14:22 ..
lrwxrwxrwx 1 root root 9 Jul 17 08:33 usb-Logitech_USB_Receiver-if01-event-mouse -> ../event6
lrwxrwxrwx 1 root root 9 Jul 17 08:33 usb-Logitech_USB_Receiver-if01-mouse -> ../mouse0
lrwxrwxrwx 1 root root 9 Jul 17 08:35 usb-OBINLB_USB-HID_Keyboard_SN0000000001-event-if01 -> ../event3
lrwxrwxrwx 1 root root 9 Jul 17 08:35 usb-OBINLB_USB-HID_Keyboard_SN0000000001-event-if03 -> ../event5
lrwxrwxrwx 1 root root 9 Jul 17 08:35 usb-OBINLB_USB-HID_Keyboard_SN0000000001-event-kbd -> ../event2
lrwxrwxrwx 1 root root 9 Jul 17 08:35 usb-OBINLB_USB-HID_Keyboard_SN0000000001-if02-event-joystick -> ../event4
Any tips on what I could to fix and troubleshoot this are appreciated. Something tells me this is something Ubuntu- or config-specific since I have basically tried everything else I could find on the subject.