USB Passthrough Strategy

Hi,

Incus 6.8

I have a Windows VM on Incus which has several USB devices configured with type=usb. They are connected to the host via 2 separate hubs.

/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 05e3:0608 Genesys Logic, Inc. Hub
        |__ Port 001: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 05e3:0608 Genesys Logic, Inc. Hub
        |__ Port 002: Dev 004, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
            ID 0c70:f014 MCT Elektronikladen
        |__ Port 002: Dev 004, If 1, Class=Human Interface Device, Driver=usbfs, 12M
            ID 0c70:f014 MCT Elektronikladen
        |__ Port 002: Dev 004, If 2, Class=Human Interface Device, Driver=usbfs, 12M
            ID 0c70:f014 MCT Elektronikladen
        |__ Port 003: Dev 005, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
            ID 0c70:f00e MCT Elektronikladen
        |__ Port 003: Dev 005, If 1, Class=Human Interface Device, Driver=usbfs, 12M
            ID 0c70:f00e MCT Elektronikladen
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/2p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 003.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 0bda:5411 Realtek Semiconductor Corp. RTS5411 Hub
        |__ Port 001: Dev 012, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
            ID 0c70:f011 MCT Elektronikladen
        |__ Port 001: Dev 012, If 1, Class=Human Interface Device, Driver=usbfs, 12M
            ID 0c70:f011 MCT Elektronikladen
        |__ Port 002: Dev 003, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
            ID 1b1c:1c11 Corsair
/:  Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/2p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/2p, 5000M
        ID 0bda:0411 Realtek Semiconductor Corp. Hub

config device show:

usb-ax1600i:
  productid: 1c11
  type: usb
  vendorid: 1b1c
usb-d5next:
  productid: f00e
  type: usb
  vendorid: 0c70
usb-leakshield:
  productid: f014
  type: usb
  vendorid: 0c70
usb-octo:
  productid: f011
  type: usb
  vendorid: 0c70

The problem is that after rebooting the entire system (and the VM autostarts) I may be missing one device which then had to be removed and readded. At all times they appear via lsusb on host.

So I have some questions

  1. Is it possible there is some kind of timing issue that causes a device to not show
  2. Would it be better to pass thru the underlying USB root hub(s)
  3. What solution are people using that will run for 24/7/365

There is of course some other way such as USB/IP…?

Thanks

Depending on the system, if you can have a dedicated PCIe card for USB and then pass the whole card into the VM, you’ll definitely have a more reliable and faster experience.

As your devices aren’t marked as optional=true, they must have been present and working for the VM to start at all. So my guess is that something happened shortly afterwards, quite likely a kernel driver loading on the host which then caused that device to be reset and drop out of the VM.

Maybe look at the journalctl or dmesg output to see if there isn’t anything related to those devices happening after the VM is started.

1 Like

I have worked around this issue conclusively by using USB/IP served from a Raspberry Pi

It is curious though that USB devices do not seem to need to be present for the VM to boot (instead of stopping boot if a non-optional USB device is missing), will test more there.