Libvirt USB passthrought via port
from user_naa@lemmy.world to linux@lemmy.ml on 07 Sep 2024 12:16
https://lemmy.world/post/19501694

Hello! I need to create a VM and passthrought some host USB port to it. Sadly libvirt doesn’t support QEMU built-in feature to use -hostport argument (which was added 10 years ago…). I tried to add custom arguments to domain (qemu:commandline) but this didn’t work. When I just run qemu-system-x86_64 -device host-usb,hostbus=X,hostport=Y -usb everything works well. It seems like libvirt restricts some QEMU actions. How can I fix this? OS: Debian 12

#linux

threaded - newest

taaz@biglemmowski.win on 07 Sep 2024 13:23 next collapse

Uh probably not that helpful but I am somewhat sure that this was super easy to do from virt-manager (on Arch qemu & kvm, virtualizing Tiny11 )

user_naa@lemmy.world on 07 Sep 2024 13:38 collapse

No, this is not possible. Virt-manager is just a GUI over libvirt. For now libvirt doesn’t support USB passthrought by port id, only by device id (which changes on each plug) or vendor id.

mumblerfish@lemmy.world on 07 Sep 2024 22:07 collapse

Not the person you were replying to, and don’t understand exactly what you mean with port and device id. But if it changes every time, -ish, you plug it in, do you mean like /dev/sdX device names? If so, then maybe look at /dev/disk/by-TYPE/ and use those instead? You have stuff there which is the same each time you plug in.

somethingsomethingidk@lemmy.world on 07 Sep 2024 14:46 next collapse

I found this. I didn’t look at the code at all but the Readme mentions another project that might help.

https://github.com/ipatix/libvirt-usb-hotplug

nublug@lemmy.blahaj.zone on 07 Sep 2024 21:07 next collapse

this may help, if you’re using apparmour.

serverfault.com/…/pass-an-usb-hub-from-a-kvm-host…

hornedfiend@sopuli.xyz on 08 Sep 2024 05:09 next collapse

I could never get that to work for some of my devices,so I had to use virtualbox,which works very well.

possiblylinux127@lemmy.zip on 08 Sep 2024 05:34 collapse

I would personally look into buying a pcie USB card. You can easily passthough PCIe devices with minimal effort and it will work better