Jump to content
dlandon

Libvirt Hot Plugin USB - USB Hot Plugin for VMs

19 posts in this topic Last Reply

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 being incorporated into Unraid, so I'm not sure if this plugin will have much value past version 6.5.

 

Note: As of 6.6.x, hot plug functionality has not been incorporated into Unraid.

Edited by dlandon
Add note about still needing the plugin

Share this post


Link to post
12 minutes ago, 1812 said:

does this work with all vm operating systems?

It should.

Share this post


Link to post

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?

Share this post


Link to post

For me, this plugin does not work anymore from unRAID 6.5.0.

It no longer appears in the VMs page

Share this post


Link to post
2 minutes ago, NY152 said:

It no longer appears in the VMs page

Are you sure you're using dlandon's and not bshakil's version?

Share this post


Link to post
6 minutes ago, NY152 said:

For me, this plugin does not work anymore from unRAID 6.5.0.

It no longer appears in the VMs page

The dlandon version has a different icon.

libvirt.hotplug_usb.png.4cd3ce6e604ff73c1edfd613c6620969.png

Share this post


Link to post

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.

Share this post


Link to post

Was this functionality added to unraid? or do I still need to download this for the hot-add usb functionality?

Share this post


Link to post
42 minutes ago, jordanmw said:

Was this functionality added to unraid? or do I still need to download this for the hot-add usb functionality?

You still need it. 

Share this post


Link to post

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

Share this post


Link to post

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!

Share this post


Link to post
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.

Share this post


Link to post

Trying to connect an external disk to a VM, but not successful:

 

error: Failed to attach device from /tmp/libvirthotplugusb.xml
error: internal error: unable to execute QEMU command 'device_add': failed to open host usb device 2:2

 

Any thoughts?

Share this post


Link to post

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.