Unraid VM USB Hot Plug

Windows Device Manager with USB Devices
USB Controllers in a Windows VM

Once you have basic GPU passthrough configured, you can get near bare-metal performance in a VM on Unraid using KVM under the hood. However, one thing that is a little awkward are USB devices. The host, in this case Unraid, owns, initializes, and configures USB devices by default. This gets even more complicated when you consider that Unraid boots off a USB device rather than another drive in the system.

Here we’ll look at how you can get close to hot-plugging USB devices into a VM. In a future post we’ll take it a step further to get near-baremetal functionality just like we did with the GPU.

Static Configuration

The most basic configuration is useful if you have USB devices that will be plugged in all the time. This is then easy to configure and connect these to your VM is directly through Unraid’s GUI. In order to do this, make sure you have all your USB devices plugged into your machine that you plan to pass through to the VM. USB devices will then show up directly in the VM settings as below:

USB Device Static Configuration in Unraid VM Settings
USB Passthrrough to a VM

You can then select which USB devices you’d like to pass through and update your VM configuration. Each time your VM boots Unraid will assign these USB devices to your VM automatically.

However, Unraid prevents you from changing this configuration once the VM is running. Then, how do you assign devices to that running VM?

Hot Plug Plugin

In order to get a little more configurable, there are some Community Applications / Plugins that can help. In order to use these you’ll have to install the Community Applications plugin. Our target here is the Hotplug USB App:

Hotplug USB Community App
Libvirt Hotplug USB Plugin in the Community Apps Tab of unRAID

Once you have this plugin installed, you’ll see a new configuration section under the VM tab in Unraid. Once a VM is running it will show up in the Running VM list, and any unassigned USB devices will show up in the USB Devices list. Whenever a new device is plugged in, you will sometimes have to click Refresh at the bottom of the page in order for it to show up in the list of devices.

In order to assign a device to a VM, it’s as simple as selecting the device in the USB Devices drop-down and the VM you’d like to attach it to in the Running VMs drop-down and clicking Attach.

Unraid Hotplug USB Menu
Hotplug USB App in the Unraid VM menu

As the note at the bottom of the page will say, sometimes you will need to Attach / Detach / re-Attach the device in order for it to be correctly detected. I have also noticed that some devices have their own internal hubs, which mean that they may show another device once initialized. I especially encountered this issue when plugging in my Thrustmaster T300 racing wheel. When plugged in, Unraid showed one device at first “Thrustmaster FFB Device”. Unraid then showed another device: “Thrustmaster T300 Wheel”. The wheel worked only once both of these devices were connected.

Conclusion

These two configurations are the most basic configurations that you can have with USB devices and a VM in Unraid. This gets you about 50% of the way to a bare-metal feeling VM. However, this configuration leaves some functionality on the table:

  1. A manual operation must be performed whenever a new device is added to the VM.
  2. The Unraid menu must be used to do the assignment.
  3. A USB controller cannot be assigned in this manner.

We can solve most of these problems by passing through an entire USB controller in a different way in a future post.

2 thoughts on “Unraid VM USB Hot Plug

Leave a Reply

Your email address will not be published. Required fields are marked *