USB basics and troubleshooting

Everything which doesn't fit into the other sections.

USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:13

Despite its reputation, USB is not always plug and play, even more so in a virtual environment. You have to talk almost directly to the hardware via a series of software layers. The more layers, the more complicated things become. That explains the length of this article. If things were so easy, this FAQ would be very small and it wouldn't require a Table Of Contents:
  1. Sharing USB devices
  2. Capturing a USB device in VirtualBox
  3. Device categories
  4. USB Filters
  5. Common problems
  6. Guest support
  7. Troubleshooting
  8. Asking for help
#1: Sharing USB devices
USB devices cannot be shared at the bus level. That means that two computers (a host and a guest) cannot share the same device. Think of it as having a USB stick, a printer, a webcam or a WiFi adapter hooked into two computers at the same time. You simply can't.

There are other means of sharing for some device categories. Such as: shared or network folders for mass storage devices, printer sharing for printer/scanners/fax devices. You simply cannot have direct resource sharing.

IMPORTANT
    If you can share the device from the host (be it Shared/Network Folders, or Printer sharing), go for that option! It's much easier, and both the host and the guest can access the shared USB resources.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:13

#2: Capturing a USB device in VirtualBox
There are two ways to capture a USB device in a guest in VirtualBox:
  • On-the-fly
      A "transient" solution, either by using the icon on the bottom of the window, or the menu "Devices » USB » ...". The captured devices are indicated by the check next to them. The rest of the devices in the list, simply show you the devices currently present in the host. That does NOT mean you can capture them at will. See "Device categories" below.
  • USB filter
      A more "permanent" solution and one that captures the device as soon as it is inserted into the host, but only after the VM is already up and running. A filter should be ideally created specifically for each device. See "USB Filters" below.

      NB: You can have both a filter, and use the transient nature of the list. So, for example, you have setup a filter for a USB stick. As soon as you insert the stick, the filter captures it, and it shows in the list as "checked" (captured). You can then check/uncheck the device in the list at will to make it available in your host. But since you used a filter, the guest has the first saying.
    The "USB filter" option is strongly suggested, compared to the "On-the-fly" option (Devices » USB » ...), because it's more robust and it works in the majority of cases.


    NOTE for Linux hosts
    For Linux hosts, please make sure that you are a part of the "vboxusers" group and verify your membership with the "id" command, after a logout or a reboot. Otherwise you will not see any USB devices. Also remember that only the official download from VirtualBox is supported, not your distro's.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:14

#3: Device categories
There are several categories of USB devices:
  • Uncapturable
      These are USB devices that are captured by the host with a daemon or service (e.g. Bluetooth controller). Not only you can't make the on-the-fly option work, but you can't even get it to work with a filter, unless you disable the host service/daemon. The device then becomes "Idling", see below.
  • Ejectable
      These are USB devices that are captured by the host and are actively used (e.g. USB sticks, external HDs). You have to eject them first to be able to use them with the on-the-fly option. If you have a filter and you plug the device after the VM has started, it gets captured by the filter.

      NB 1: In some OSes (Linux, Windows) you don't have to eject such a device specifically from the host in order to capture it with the on-the-fly option. That would place them in the "Idling" category, see below.

      NB 2: I haven't tried what happens if you have multiple VMs with the same filter active.
  • Un-ejectable
      These are USB devices that are captured by the host, but cannot be ejected (e.g. gamepads, joysticks, mice, keyboards). You have to unplug them and use a USB filter. The on-the-fly option doesn't work, simply because you cannot release them from your host.
  • Idling
      These are USB devices that are sitting, waiting to be used (e.g. gamepads, joysticks, IR receivers, ejected devices). You can capture them with either the on-the-fly or the filter option.
NB: You may have noticed that some devices are listed both in the "Un-ejectable" and in the "Idling" categories (e.g. gamepads, joysticks). The answer to that is that it depends both on the device and the host. You cannot know a priori.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:14

#4: USB Filters
A USB filter is a series of "AND" conditional statements. So when you're filling in the filter values, you're telling the filter:
Capture a device with this VendorID, AND that ProductID, AND ...
A blank filter (not recommended!) will match anything, which is good if the device appears as a composite, i.e. presents as a number of different devices all connected at once. However the danger of a blank filter is the potential to grab the wrong device, e.g. you do not want to grab the host's USB keyboard and assign it to the guest! If you have a problem with the wrong device being grabbed then you'll need to add just enough information to the filter so that it matches your device only. But don't define the filter too narrowly, as that can lead to problems too. That's why your safest bet for a basic filter is to fill in the VendorID and ProductID only. The proper checklist for capturing a USB device with a filter is:

  1. Make sure that the Extension Pack (ExtPack) is installed on the host. The ExtPack must be the same version as the main VirtualBox program. The ExtPack is not the same as the Guest Additions! The ExtPack is installed on the host and adds support for a virtual USB2 host controller. VirtualBox 5.x.x added USB3 (xHCI) support as well.

  2. Make sure that at least USB2 (EHCI) is enabled in your VM settings. If your guest supports USB3 (xHCI), use that. See "Guest support" below. It is important to note that if your guest supports USB3, you should definitely enable that, even if your host does NOT support USB3 at the hardware or software level, mainly because the USB3 stack is much better designed compared to USB1 and USB2.

  3. Under VM Settings » Port » USB, create a USB filter in your guest settings while the device is plugged in the host. Delete all values except Name, VendorID and ProductID. The Name is nothing more than a label and is not actively participating in the filtering process. You can change it at will. I usually use "Stick: XYZ" or "Joystick: ABC" or "Other: IJK".
    Image


  4. Unplug the device.

  5. Start your guest (the one that you applied the filter to). Let it start completely. Log in if you have to, reach the desktop, and wait until any disk activity has stopped.

  6. Plug your device. The filter should capture it and pass control to your guest.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:14

#5: Common problems
  • Error: Busy with a previous request (VERR_RESOURCE_BUSY)
    • The error means that something else (most probably the host) is using the device. Take a look at the "Basics - Device categories" and see which category your device falls under and take appropriate action: eject it, uncapture it, stop the service/daemon that uses it, unplug it and create a filter.

    • This error can also mean that another filter is installed on your host and is actively monitoring/filtering your USB connections. Such filters can be installed with either antivirus programs, Microsoft's RemoteFX USB Redirection, No Machine, Dell DPE, or Wireshark and its USBPcap component. Or any other application with a USB filtering mechanism.

    • This error can mean a lot of other not so common things. Take a look at the "Troubleshooting" section.
  • VERR_PDM_NO_USB_PORTS
      You are trying to use a USB3 device with a guest that does not support USB3 (see the "Guest support" section), or you haven't enabled the USB3 option in the VM settings.
  • No USB devices are listed
      Something is not right with the installation of the VirtualBox USB filter. If you are on Linux, are you a member of the "vboxusers" group? Did you verify it? Did you logout/login or reboot? If you're on Windows did you try reinstalling VirtualBox with the Run-As-Administrator option?
  • Device gets randomly disconnected
      Check the power options for that device. Make sure that the guest OS does not shut down the device in order to save power.
  • Unknown USB device detected
      Actually, this message has been removed from the latest VirtualBox versions, because there was actually nothing that VirtualBox could do about it. VirtualBox gets the USB VendorID/ProductID information from "The USB ID Repository", so it's actually them that you have to notify. See the "Submit new data" section for more information.
  • Distinguish identical devices
      Sometimes you have to plug two identical devices and you cannot distinguish them. Either you have to activate more criteria in the filter, like the "Serial No." or the "Port" that they're connected to. If they're really identical (even the serial number), there's not that much you can do.

      There is a technique that might work, but it's so rare and convoluted that it's not part of the FAQ. Start a new topic describing your problem.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:15

#6: Guest support
Not all guest systems support all levels of USB. This is a general guideline, but for more specifics you've got to check with your guest OS's documentation:
  • No USB
    • DOS, Minix, Win 3.11, Win NT*, do not support USB at all. There are some "hacks" around but nothing tested certain.
  • USB1 only
    • Win9* and early Linux kernels. Almost all of the other OSes, if they support USB at all, support at least USB2.
  • USB2 only
    • OSX up to 10.6, Linux up to around 2010, Win9* , XP, Windows 7.
    • Especially for Win9*, and other old guests, the real problem usually isn't the host controller drivers but rather drivers for specific devices. Something like a USB mouse or keyboard or joystick typically works. See Tutorial: Windows 95/98 guest OSes.
  • USB3 with external drivers
  • USB3
    • Most modern OSes support USB3.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 11. Apr 2017, 16:15

#7: Troubleshooting

  1. Shutdown your guest from within your guest, normal shutdown. Shutdown your host. Reboot your host. Relaunch your guest. This has helped at times, to have a clean start of both host and guest.

  2. If the device shows up in your host and is not captured by the filter, either the filter is incorrect, or there might be a problem with your filter installation. For example you may have a blank filter, or a narrowly defined filter (too many conditionals).

  3. If the device shows up, but as "Unavailable", eject it from your host (if you can), but leave it plugged in. It should show up as available.

  4. Do you have the VendorID and DeviceID correct? On Linux hosts, check the output of "lsusb". On Mac hosts, check the "System Information". On Windows hosts, check the device manager, or get USBDeview, or USBView, or UsbTreeView.

  5. If you're using a USB3 device, make sure that both your host and your guest support USB3. And of course you have to be using the 5.x.x series of VirtualBox. If you plug a USB3 device into a USB3 port then it will only work with VirtualBox > 5, as that's when VirtualBox introduced a virtual xHCI controller.

  6. If on a Linux host, are you a member of the 'vboxusers' group? If not, add yourself with the following command and then reboot your host, or logout and login to activate the change in group membership:
      sudo usermod -a -G vboxusers <your_username>
  7. If on Windows host, check that the VirtualBox USB Driver is installed in your host. Make sure your host didn't silently reject non-MS drivers (Google for Driver Signature Enforcement). Usually a re-installation of VirtualBox with the "right-click on the installer & Run-as-Administrator" trick, fixes this.

  8. If on a Windows host, check out these Windows-specific ways to troubleshoot potential driver installation issues:
    1. USB not working
    2. SOLVED: Failed to access the USB subsystem on Windows 7 host
    3. Remove Driver Filters to Resolve Device Manager Errors on Windows 7
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: USB basics and troubleshooting

Postby socratis » 1. Jun 2017, 18:33

#8: Asking for help

If you've tried everything so far, and you had no luck, maybe it's time to open a new thread. Please read the Minimum information needed for assistance. Use the complete version numbers (including the build numbers) to identify software:
  • What's your VirtualBox version? "The latest" is not enough, "VirtualBox 5.1.22 r115126" is much better.
  • What's your host and your guest version?
    • "OSX" isn't enough, "OSX 10.9.5 build 13f1911" is much better.
    • "Windows" isn't enough, "Win10 1607, build 14393.969" is much better.
    • "Linux" isn't enough, "Ubuntu 16.04, 4.4.0-59-generic #80-Ubuntu SMP" is much better.
Now, with the USB device plugged in and the VM not running, post the output of the following commands. Note that the 1st command applies to Windows hosts only, and the 2nd to Linux hosts only. It would be best if you unplugged any other unnecessary USB devices, for simplicity:

    cd "C:\Program Files\Oracle\VirtualBox"      <-- change it if not the default installation
    id <-- For Linux hosts only
    VBoxManage -version
    VBoxManage list extpacks
    VBoxManage list usbhost
    VBoxManage list usbfilters
    VBoxManage showvminfo "<Your_Virtual_Machine_Name>"

Finally, a log from a cold_start / login / plug_USB / unplug_USB / complete_shutdown cycle:
  1. Start the VM from cold-boot (not from a paused or saved state).
  2. After you've logged in, plug the USB device. Wait (idling) for a minute or two. Unplug the USB device.
  3. Shutdown the VM (not paused or saved).
  4. Right-click on the VM in the VirtualBox Manager and select "Show Log".
  5. Save only the first "VBox.log", ZIP it and attach it to your response (see the "Upload attachment" tab below the reply form).
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 19292
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5


Return to Generic Advice

Who is online

Users browsing this forum: No registered users and 1 guest