virtualbox-kvm icon indicating copy to clipboard operation
virtualbox-kvm copied to clipboard

Faliure to enumerate USB devices

Open vineethrp opened this issue 1 year ago • 1 comments

Bug Description

After building as per the instructions here, VirtualBox comes up fine, but gives an error message as follows:

Failed to enumerate host USB devices.
Could not load the Host USB Proxy service: VERR_NOT_FOUND.
Result Code:
NS_ERROR_FAILURE (0X00004005)
Component:
HostWrap
Interface:
IHost {e54f6256-97a7-4947-8a78-10c013ddf4b8}

image

How to Reproduce

  • Build VirtualBox as per the instructions
  • Start VirtualBox

VM configuration

Guest OS configuration details: No VMs configured. This error is seen as soon as VirtualBox UI comes up

Host OS details:

  • Host OS distribution: Ubuntu 23.10.1
  • Host OS kernel version: 6.5.0-17-generic

Logs

Following logs are required:

dmesg did not show any relevant errors. I shall provide any logs to aid the debugging

vineethrp avatar Feb 11 '24 03:02 vineethrp

Hi vineethrp; Can you add the glibc version on your host OS details? There is boo#1219766 on opensuse that makes a relationship between recent virtualbox USB failure on guests with glibc 2.39. Your description seems a bit different so it may not help your specific problem.

bdamascen0 avatar Feb 12 '24 00:02 bdamascen0

Thanks for the response bdamascen0. I checked the libc and it is 2.38 on my host:

$ sudo apt show libc6
[sudo] password for vineeth: 
Package: libc6
Version: 2.38-1ubuntu6.1
Priority: required
Section: libs
Source: glibc
Origin: Ubuntu

The opensuse issue seems to be a bit different as you mentioned.

I tried this on a fedora 39 which also has 2.38 and I see the same issue there as well. Please let me know if you need any more information which would help debugging. Thanks.

In the meantime, I shall try building upstream VirtualBox and see if I can reproduce it there as well.

Thanks

vineethrp avatar Feb 12 '24 02:02 vineethrp

I just built the standard VirtualBox from source and I am getting the same issue. I am not really an expert in packaging VirtualBox for various distributions, but I've seen additional scripting happening for USB devices: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/virtualbox-host.nix#L120

My suspicion is that for this to work, more needs to be done on the packaging side than just building the binaries from source.

parthy avatar Feb 12 '24 10:02 parthy

Thanks parthy. I just did an experiment to confirm this - Installed virtualbox package on my host and added my user to vboxusers group and when I ran VirtualBox again, I could see that the USB error went away, and I am able to pass through the usb devices to the guest. And I could see /dev/vboxusb getting populated as well. So indeed looks like we need some udev rules to be setup for the USB pass through to work.

vineethrp avatar Feb 12 '24 16:02 vineethrp

I'll close this since it's more of a packaging problem and not about this particular backend implementation. If you feel like there is more we should discuss here, feel free to re-open.

parthy avatar Feb 12 '24 16:02 parthy

I am fine with closing the bug. But would it be possible to add some more details in the documentation so that interested folks need not look around trying to figure out how to enable USB pas sthrough?

I am adding a snippet of documentation here which you could make use of:

** Enabling USB pass through

VirtualBox binary is not responsible for setting up the USB pass through, rather it depends on some /dev/ entries. The script VBoxCreateUSBNode.sh takes care of this via a set of udev rules. To setup USB Pass through, you could do the following

*** Create a group vboxusers and add user to the group

sudo groupadd -r vboxusers -U <username>

*** Create system folder for the script

$ sudo mkdir /usr/lib/virtualbox
$ sudo cp <out/release/linux.amd64/bin/>VBoxCreateUSBNode.sh /usr/lib/virtualbox
$ sudo chown -R root:vboxusers /usr/lib/virtualbox

*** Create the udev rules

Create a udev rule file (for eg: 60-vboxusb.rules) in /etc/udev/rules.d with the following entries:

$ cat /etc/udev/rules.d/60-vboxusb.rules
SUBSYSTEM=="usb_device", ACTION=="add", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb_device", ACTION=="remove", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor"
SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor"

*** Reload udev rules (Command depends on OS distribution and version)

$ sudo systemctl reload udev

You could either logout/relogin or restart the host for the user to be in the group. Or use any group login command to login in a shell for the changes to take effect.

Also, the above steps are just guidance. You need not follow the exact steps but could acheive the same results if /dev/vboxusb entries are populated which VirtualBox can access

vineethrp avatar Feb 12 '24 17:02 vineethrp