VM keeps dropping USB connected device?


Recommended Posts

I setup an extremely minimal Debian install with OctoPrint on it and I could occasionally get my 3D printer to show up and work for a few moments, but it would eventually disconnect and the only way to reconnect it was to fully shut down and start up the VM (not even a normal reboot would work). And that would only work some of the time, other times it seemed to disconnected before I could even hit the web interface and start using it for a minute or two.

 

I checked the logs and I keep seeing this in it when the device disconnects - is there any way to prevent the USB disconnects? I was trying to avoid having to setup a raspberry pi for this.

 

libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [udev_hotplug_event] ignoring udev action bind
2018-01-19T21:32:25.306548Z qemu-system-x86_64: libusb_release_interface: -4 [NO_DEVICE]
2018-01-19T21:32:25.306584Z qemu-system-x86_64: libusb_release_interface: -4 [NO_DEVICE]
libusb: error [_open_sysfs_attr] open /sys/bus/usb/devices/2-1.4/bConfigurationValue failed ret=-1 errno=2
libusb: error [udev_hotplug_event] ignoring udev action bind
libusb: error [udev_hotplug_event] ignoring udev action bind

Link to comment
6 hours ago, dmacias said:

Is it a usb3 device? Try connecting to a usb2 port or disabling usb3/xhci.

 

It's not, just a USB 2.0 3D Printer. 

 

This motherboard (https://www.supermicro.com/products/motherboard/Xeon/C600/X9DRi-LN4F_.cfm) doesn't even have USB 3.0 ports actually. Hmm.

 

The device doesn't seem to be sleeping either, it's able to do a few things and when I try to issue a print via octoprint it just craps out.

Fired up OctoPrint on a raspberry pi and it works fine that way with the same USB cable. I just really prefer to run it as a VM instead but I can make do with a Pi setup for this.

 

Link to comment

Hi @CorneliousJD,

 

I have similar problem with my Windows 10 Gaming VM. When connected to USB 2 or 3 my Keyboard keeps disconnecting and only way is to shut the VM down them boot it back up.

My mouse also stutters in Windows it will be OK then freeze for a few seconds then carry on.

 

I have changed my power settings to performance and put the USB devices not to sleep.

Also now passed through one of my USB 3 controllers that also has a USB type c on the same IOMMMU group. Connect everything to them now same results but this time i can just plug it out and back in to continue using the VM no need to reboot. Not ideal as this happens every 2 minutes +-

 

I have a post in the KVM section

My post also has my machine Spec and i am running 6.4

 

 

Let me know what you do to resolve this as it is P*****g me off

Link to comment
On 1/23/2018 at 12:20 PM, CorneliousJD said:

doesn't even have USB 3.0 ports actually. Hmm.

 

Is the USB printer using the same "usb hub" on the chip set as your USB thumb drive? I've had problems with VMs trying to use the same controller as that of my unRAID fob.

Also with the 3d printer is it being passed as a usb device (the check box), or are you passing it along as pci address to the USB hub it's on?  With my old system I had to pass my usb game controller as the latter for it to work properly.  Of course that's where, your iommu groups help or hurt you, and why people often mention the separate USB controller card.

 

If you're not familiar with second method, feel free to run, and copy/paste output of these three terminal commands: and your IOMMU groups.

lsusb

lspci | grep USB

readlink /sys/bus/usb/devices/usb*

We can see if we can't set it up the second way. I got the method out of this thread. If you're more the, "do it yourself'er" here is the most coherent/useful area of my personal notes on this: Basic idea is you want an isolated USB port(s) in an IOMMU group, and you get the bus number, then you get the PCI address for that USB port. Finally you edit your XML file to add that pci address to your VM.

You then have to modify some parts of it to get it to work. The good thing is that you do not have to care about which bus and address it's supposed to have in the VM. You only need to find out the host PCI address.
The part you change is bus, slot and function. In your case it's 00:14.0.
Let's brake it down.
00 is the bus. You simply exchange the two numbers after the 0x.
14 is the slot. Same method as above.
0 is the function. Her it's also the same method as above.
So in your case the full device tag would be like this:

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
      </source>
    </hostdev>

root@localhost:~# lsusb
Bus 003 Device 007: ID 045e:0084 Microsoft Corp. Basic Optical Mouse
Bus 003 Device 006: ID 045e:07b9 Microsoft Corp.
Bus 003 Device 005: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 003 Device 004: ID 046d:c21d Logitech, Inc. F310 Gamepad [XInput Mode]
Bus 003 Device 003: ID 28de:1102
Bus 003 Device 002: ID 174c:2074 ASMedia Technology Inc. ASM1074 High-Speed hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
----------------------------------------------------------
    |
    |
    \-------->    Bus 00Y Device 002: ID 174c:2074 ASMedia Technology Inc. ASM1074 High-Speed hub


root@localhost:~# readlink /sys/bus/usb/devices/usb*
../../../devices/pci0000:00/0000:00:1a.0/usb1
../../../devices/pci0000:00/0000:00:1d.0/usb2
../../../devices/pci0000:00/0000:00:1c.0/0000:05:00.0/usb3
../../../devices/pci0000:00/0000:00:1c.0/0000:05:00.0/usb4
../../../devices/pci0000:00/0000:00:1c.1/0000:06:00.0/usb5
../../../devices/pci0000:00/0000:00:1c.1/0000:06:00.0/usb6
----------------------------------------------------------
    |
    |
    \-------->    ../../../devices/pci0000:00/0000:00:1c.X/Domain:Bus:Slot.function/usbY
                                                        ---                            ---
                                                        -/\
                                                        -||
                                                        -\/
                                                       ---
                  ../../../devices/pci0000:00/0000:00:1c.X/0000:05:00.0/usb3
                  ../../../devices/pci0000:00/0000:00:1c.X/0000:05:00.0/usb4
                  -----------------------------------------------------------
                      /\
                      ||   {  X == 0   Y == 3 && 4
                      \/   {  X == 1   Y == 5 && 6 
                  -----------------------------------------------------------
                  ../../../devices/pci0000:00/0000:00:1c.0/0000:05:00.0/usbY

 

At least, that's been my experience with the VMs so far.

Edited by Jcloud
  • Like 1
Link to comment

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.