With new libvirt-6.9.0, any USB host device connected to virtual machine does not find in guest Gentoo OS.
Tested in guest kernel 5.8.8 && 5.8.18 and host kernel 5.8.18.
Downgrading libvirt to 6.8.0 does disappear the issue.
Same for me, but with Windows 10 guest.
I did some bisecting and looks like this commit is causing it:
>bfb1ab1df12e8dccfde42d1a6019bf2e628bf366 is the first bad commit
>Author: Michal Privoznik <firstname.lastname@example.org>
>Date: Wed Sep 9 13:15:15 2020 +0200
> qemu: Use .hostdevice attribute for usb-host
> This originally started as bug 1595525 in which namespaces and
> libusb used in QEMU were not playing nicely with each other. The
> problem was that libusb built a cache of USB devices it saw
> (which was a very limited set because of the namespace) and then
> expected to receive udev events to keep the cache in sync. But
> those udev events didn't come because on hotplug when we mknod()
> devices in the namespace no udev event is generated. And what is
> worse - libusb failed to open a device that wasn't in the cache.
> Without going further into what the problem was, libusb added a
> new API for opening USB devices that avoids using cache which
> QEMU incorporated and exposes under "hostdevice" attribute.
> What is even nicer is that QEMU uses qemu_open() for path
> provided in the attribute and thus FD passing could be used.
> Except qemu_open() expects so called FD sets instead of `getfd'
> and these are not implemented in libvirt, yet.
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1877218
> Signed-off-by: Michal Privoznik <email@example.com>
> Reviewed-by: Daniel Henrique Barboza <firstname.lastname@example.org>
> Reviewed-by: Ján Tomko <email@example.com>
> src/qemu/qemu_command.c | 21 +++++++++++++--------
Not exactly the same problem for me. For me USB keyboards works but not USB mice does not work. It shows up as "Unknown USB device (Invalid Configuration Descriptor)" in device manager on a Windows 10 VM.
Can confirm it is caused by commit bfb1ab1df12e8dccfde42d1a6019bf2e628bf366. Built libvirt and tried it on said commit and it did not work. It does work on the previous commit though (66c5674e797ee1f255c45db1509624537e451a64).
Had a chat on libvirt's IRC channel and they think it might be a bug in qemu or libusb.
(In reply to lekto from comment #2)
> I did some bisecting and looks like this commit is causing it:
> >bfb1ab1df12e8dccfde42d1a6019bf2e628bf366 is the first bad commit
> >commit bfb1ab1df12e8dccfde42d1a6019bf2e628bf366
> >Author: Michal Privoznik <firstname.lastname@example.org>
> >Date: Wed Sep 9 13:15:15 2020 +0200
> > qemu: Use .hostdevice attribute for usb-host
This commit switches qemu from using .hostbus= and .hostaddr= attributes to .hostdevice. There is nothing more in libvirt to it. Perhaps it's app-emulation/qemu where the bug is then?
I can't reproduce, but I also have the latest libusb: dev-libs/libusb-1.0.23-r1.
The QEMU commit that introduced .hostdevice mentions the minimal libusb version to be 1.0.23:
Although, if older libusb was present then the .hostdevice attribute wouldn't exist and libvirt would use the old set of attributes.
Alright, turns out it is app-emulation/qemu bug:
I'll backport it.
The bug has been closed via the following commit(s):
Author: Michal Privoznik <email@example.com>
AuthorDate: 2020-11-24 07:26:19 +0000
Commit: Sergei Trofimovich <firstname.lastname@example.org>
CommitDate: 2020-11-24 08:38:50 +0000
app-emulation/qemu: Work around libusb bug
In its 6.9.0 relelase Libvirt changed way how USB devices are
specified on QEMU's command line. While previously .hostbus= and
.hostaddr= were used they were not really good fit and often get
in way of another libvirt feature - namespaces (see
v6.9.0-rc1~456 libvirt commit for more info). The new way of
configuring USB devices is .hostdevice=/dev/bus/usb/.../... but
it exposed a bug in libusb which is worked around in qemu (see
v5.1.0-599-g202d69a715 QEMU commit for more info). Backport the
workaround for the time being. It can be dropped when we rebase
Signed-off-by: Michal Privoznik <email@example.com>
Signed-off-by: Sergei Trofimovich <firstname.lastname@example.org>
...qemu-5.1.0-usb-host-workaround-libusb-bug.patch | 82 ++
app-emulation/qemu/qemu-5.1.0-r3.ebuild | 860 +++++++++++++++++++++
2 files changed, 942 insertions(+)