Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Auto VM Start interrupted by missing USB device

Featured Replies

I would like for VMs to start automatically regardless of the fact that its missing a USB device it had attached.

 

How can this be done?

From what I've read you should be able to specify a USB device as optional on start of a VM.

Fair warning, I haven't tried this myself, so I don't know if it works or breaks something. Try it on a test VM first. And please report back if it works or not.

 

After adding your USB device as per normal in the VM edit screen, you need to manually edit the XML and add startupPolicy='optional' to the source tag of the USB device.

Here's the example from the link above:

Your vendor and product id will be different, and you will also have an address tag added.

  <hostdev mode='subsystem' type='usb'>
    <source startupPolicy='optional'>
      <vendor id='0x1234'/>
      <product id='0xbeef'/>
    </source>
  </hostdev>

 

Ok, decided to try this myself.

 

I have a VM with a bluetooth dongle passed through as a USB device.

The VM starts fine with the dongle plugged in to the unRAID box and this XML:

    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0a12'/>
        <product id='0x0001'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>

If I unplug the dongle form the host and try to start the VM, I get the expected error:

5ae3f50917c56_ScreenShot2018-04-28at2_09_02pm.png.d7c09a115a7dd97b6d69e2ffc220a764.png

 

I then edited the XML to this:

    <hostdev mode='subsystem' type='usb' managed='no'>
      <source startupPolicy='optional'>
        <vendor id='0x0a12'/>
        <product id='0x0001'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>

Now the VM starts, but it's not working properly. It has no network and the passed through GPU doesn't output a signal, so I can't see what's going on.

There are also three new errors in the VM log that doesn't normally show up, no doubt related to the issues:

libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/004: Operation not permitted
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/002: Operation not permitted
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/004: Operation not permitted

I'll continue to experiment with this, but at this point it doesn't look like the startupPolicy='optional' is working. at least not for a Mac OS VM.

Update: on second start of VM, with no changes to XML or hardware, it all just works. Still get the libusb errors in the VM log, but they don't seem to affect anything.

The missing GPU output was a loose cable, and the missing network is something that happens occasionally to this VM so it was probably a coincidence.

 

So, I think this would work for you.

 

Alternatively, you could always use the excellent Libvirt Hotplug USB plugin instead. That will let you configure the VM without the USB device attached, and then simply attach it while the VM is running if/when required.

 

  • 9 months later...

Worked like a dream, thanks bud!

 

Interesting part for me was I previously had a mapped USB device within the VM Manager.  I removed the device while the VM was off, and the VM wouldn't start up.  I tried to remove the mapping but within the UI there were no USB device entries.  I found the entry in XML view, added <source startupPolicy='optional'> and boom.  Perfect boot.

 

Thanks again!!

 

Thomas

1 hour ago, tb037 said:

Worked like a dream, thanks bud!

 

Interesting part for me was I previously had a mapped USB device within the VM Manager.  I removed the device while the VM was off, and the VM wouldn't start up.  I tried to remove the mapping but within the UI there were no USB device entries.  I found the entry in XML view, added <source startupPolicy='optional'> and boom.  Perfect boot.

 

Thanks again!!

 

Thomas

You should put in a feature request for this to be added.

  • 3 years later...
On 4/24/2018 at 11:44 PM, ceyo14 said:

I would like for VMs to start automatically regardless of the fact that its missing a USB device it had attached.

 

How can this be done?

I don't get why, after countless complaints, this hasn't been addressed at by unRAID yet.  This issue so annoying!  I manage multiple unraid systems; cant trust my kids (or employees) to have admin unraid access when im not home/work, but if they unplug the xbox controller, or BT dongle (for example), and need to restart, they cant use their computer(s) till they plug it into THE SAME usb port it was before.  Its a known issue that seems to be ignored!  and no, i don't want to install/pass through a USB controller for each VM...i don't have the PCI-e space.

  • Community Expert
55 minutes ago, miicar said:

I don't get why, after countless complaints, this hasn't been addressed at by unRAID yet.  This issue so annoying!  I manage multiple unraid systems; cant trust my kids (or employees) to have admin unraid access when im not home/work, but if they unplug the xbox controller, or BT dongle (for example), and need to restart, they cant use their computer(s) till they plug it into THE SAME usb port it was before.  Its a known issue that seems to be ignored!  and no, i don't want to install/pass through a USB controller for each VM...i don't have the PCI-e space.

Use my usb manager plugin. it auto connects devices at vm start so you dont define in vm. also supports same multiple vendor product and auto hot plug when you connect a device.

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.