Proxmox – add more USB devices in VM

Maybe you need to add more USB devices to your Proxmox VM but the web interface only offers three. Or the other USB devices are not detected by VM operation system. So there is a little tutorial on how you can add more USBs.

1. – connect to Proxmox via SSH

2. – find your usb

For this step, you need to check your connected USB with the lsusb -t command. Above you can see the highlighted important parts.

I got 6 TV tuners in my host machine connected via the USB hub, the USB hub is split into 2 parts. So for example the USB1 got this path: Hostbus = 1, hostport=1.1. You just need to go down in the tree and use the node names as your path. Some USB devices could have path like hostbus=1,hostport=1.1 some will have path like hostbus=1,hostport=1.3.2.

In the detail:

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M   <--- HostBus = 1
 |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M   <--- hostport=1
     |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <-- hostport=1.1
root@rezidence:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/8p, 10000M
    |__ Port 3: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 4: Dev 4, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <--- USB 1
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <--- USB 2
        |__ Port 3: Dev 5, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 7, If 0, Class=Vendor Specific Class, Driver=usbfs, 12M
            |__ Port 2: Dev 9, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <--- USB 3
            |__ Port 3: Dev 11, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <--- USB 4
        |__ Port 4: Dev 6, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 2: Dev 10, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <--- USB 5
            |__ Port 1: Dev 8, If 0, Class=Vendor Specific Class, Driver=usbfs, 480M  <--- USB 6

3. – Make a backup of your VM config !

In this step you MUST make a backup of your VM config, so we need to go to the config folder and backup the config file. The name of the config file is the same as the ID of your VM. My VM has ID 101.

 cd /etc/pve/qemu-server
 cp 101.conf 101.conf.bak

4. – Use the QM command to change the config

Ok, now came the adrenaline part of this process. We need to change the configuration of the VM. We will use the information from step 2. I suggest you prepare the command in some text editor and then copy it to the terminal. It is suggested to split your devices into multiple XHCI devices for example I split them into two XHCI(3 and 3). So for my Host and my 6 USB, the final config command is like this. After that, you should restart the HOST and you should see your USB in the VM OS.

 qm set 101 -args "\
-device qemu-xhci,id=xhci1 \
-device usb-host,bus=xhci1.0,hostbus=1,hostport=1.1,id=Device_1 \
-device usb-host,bus=xhci1.0,hostbus=1,hostport=1.2,id=Device_2 \
-device usb-host,bus=xhci1.0,hostbus=1,hostport=1.3.2,id=Device_3 \
-device qemu-xhci,id=xhci2 \
-device usb-host,bus=xhci2.0,hostbus=1,hostport=1.3.3,id=Device_4 \
-device usb-host,bus=xhci2.0,hostbus=1,hostport=1.4.1,id=Device_5 \
-device usb-host,bus=xhci2.0,hostbus=1,hostport=1.4.2,id=Device_6"