Libvirt Hot Plugin USB - USB Hot Plugin for VMs


Recommended Posts

This is a continuation of the plugin written by bshakil to hot plug USB devices in a VM.  It has been updated for Unraid 6.5 due to some file structure changes.  You will need to remove the previous plugin before installing this one.

 

Installing the plugin

 

You can install the plugin from Community Applications or by pasting the following link in the Install Plugin tab on the Unraid plugins page.

 

https://github.com/dlandon/libvirt.hotplug.usb/raw/master/libvirt.hotplug.usb.plg

 

USB hot plug is now incorporated into Unraid by editing the xml and selecting/unselecting USB devices.  This plugin offers an alternative to that method.

Edited by dlandon
Add note about Unraid support of hotplug USB devices
  • Like 2
  • Thanks 2
  • Upvote 1
Link to comment
  • 3 weeks later...

Switched from USB passthrough to using this, as my coffee lake system basically has all the USB controllers as one and can't be split apart, and I can't be bothered right now to pick up an additional USB controller

 

But, question though.  Is it possible to have the "last state" of hot-plugged devices through this plugin carried over to the next reboot of unRaid without modifying the XML?

Link to comment
  • 2 weeks later...
  • 2 months later...

This looks great - I wonder if it could be a but improved.

I am wanting to set up a virtual PC for my daughter on my server, running an HDMI and a USB to her room, where she'll have a monitor, and a powered USB hub to connect keyboard, mouse, headset, etc.  My hold-up is that m motherboard has a pretty poor IOMMU arrangement, so I cannot seem to successfully pass through a USB controller to the VM.  I can simply pass through the USB devices she needs (Keyboard, Mouse, Headset) via USB passthrough, but this doens't allow her to plug in thumbdrives or other devices into her USB hub.

 

I'm wondering if it would be possible to detect when new USB devices are plugged into unRAID, and if they are beneath a defined USB hub, they are auto-hotplugged to a specified virtual machine.

Link to comment
  • 4 months later...
  • 3 months later...

Anyone know how to correct for this error?

Quote

 

error: operation failed: Multiple USB devices for XXXX:XXXX, use <address> to specify one


 

 

I am trying to attach a handheld scanner, which when plugged in, seems to register as 2 USB devices.

Instead of hot plugging, I also tried editing the VM settings. This device appears twice (2 checkboxes) in 'form view'. If I check only one box, the VM won't start, throwing a similar error:

Quote

 

Execution error

operation failed: Multiple USB devices for 8088:7809, use to specify one

 

 

  • When I go back in to edit in 'form view', both checkboxes are now selected. 
  • When I check the XML, only one entry exists but still the same behavior occurs.
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x8088'/>
        <product id='0x7809'/>
      </source>
      <address type='usb' bus='0' port='4'/>
    </hostdev>

 

Thanks everyone in advance for helping me get this working!

 

Screen 2019-03-29 at 23.48.51.png

Screen 2019-03-29 at 23.49.10.png

Screen 2019-03-29 at 23.49.31.png

Screen 2019-03-29 at 23.50.02.png

Link to comment
  • 2 months later...

Hi, was trying out this plugin.

My setup is a SuperMicro X8DT6-F, with a PCI-e USB-C card. My SSD drive is connected to the USB-C card.

When i Edit my VM, the ssd is listed on the list of USB devices.

However, when i try to start my VM, it throws an error saying its unable to open the bus # and device #.

Any pointers?

P.S my PCI-e card is not setup as passthru.

Thanks!

Link to comment
22 minutes ago, ryan.lio said:

Hi, was trying out this plugin.

My setup is a SuperMicro X8DT6-F, with a PCI-e USB-C card. My SSD drive is connected to the USB-C card.

When i Edit my VM, the ssd is listed on the list of USB devices.

However, when i try to start my VM, it throws an error saying its unable to open the bus # and device #.

Any pointers?

P.S my PCI-e card is not setup as passthru.

Thanks!

Wrong place to ask, mate. You are asking about VM stuff and this topic is about the plugin.

Link to comment
  • 1 month later...
  • 1 month later...
  • 1 month later...

Trying out 6.8.0-RC3.  When I start my Windows 10 VM, I must detach my Logitech unifying receiver from the VM using the plugin ( I have a HDMI switch and I can switch back and forth from my VM and my unRaid GUI) and then reattach it for my wireless mouse and keyboard to be usable in the VM.  I didn't have this issue with 6.7.2. 

Link to comment
16 minutes ago, Woodpusherghd said:

Trying out 6.8.0-RC3.  When I start my Windows 10 VM, I must detach my Logitech unifying receiver from the VM using the plugin ( I have a HDMI switch and I can switch back and forth from my VM and my unRaid GUI) and then reattach it for my wireless mouse and keyboard to be usable in the VM.  I didn't have this issue with 6.7.2. 

This plugin does not control the attachment of usb devices when a VM boots.  It only allows you to attach and detach a usb device manually.  The issue is 6.8.

Link to comment
  • 1 month later...
6 minutes ago, ElnarVideo said:

Im not sure what Im doing wrong. I installed plugin, it shows up in my VM page. However when I start the VM, I try to choose in in the list of Running VMs, but the list is just empty. What am I doing wrong? Thanks!

Reload the page.  The Hot plug page isn't dynamic, and only picks up the running VMs when you enter the VM page

Link to comment
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.