3

I'm a member of vboxusers group. I installed the extension pack. When running VirtualBox as non-root, USB devices are visible but grayed-out. When running VirtualBox as root then it works fine.

How to add access to USB devices when running virtualbox as non-root?

OS: Lubuntu 12.04, VirtualBox 4.3.2r90405 with extension pack.

01BTC10
  • 681
  • 2
  • 12
  • 22

2 Answers2

0

I am re-posting the solution that worked for me:

After numerous searching I've concluded with the help of this wiki to the below script that fixed the problem:

#!/bin/bash

#
# Heavily inspired by https://github.com/dnschneid/crouton/wiki/VirtualBox-udev-integration
#

vbox_usbnode_path=$(find / -name VBoxCreateUSBNode.sh 2> /dev/null | head -n 1)
if [[ -z $vbox_usbnode_path ]]; then
    echo Warning: VBoxCreateUSBNode.sh file has not been found.
    exit 1
fi

chmod 755 $vbox_usbnode_path
chown root:root $vbox_usbnode_path

vboxusers_gid=$(getent group vboxusers | awk -F: '{printf "%d\n", $3}')

vbox_rules="SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$vbox_usbnode_path \$major \$minor \$attr{bDeviceClass} $vboxusers_gid\"
SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$vbox_usbnode_path \$major \$minor \$attr{bDeviceClass} $vboxusers_gid\"
SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$vbox_usbnode_path --remove \$major \$minor\"
SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$vbox_usbnode_path --remove \$major \$minor\""

echo "$vbox_rules" > /etc/udev/rules.d/virtualbox.rules
rm -f /etc/udev/rules.d/*-virtualbox.rules
udevadm control --reload
adduser `logname` vboxusers

echo All actions succeeded.
echo Log out and log in to see if the issue go fixed.

Be sure to have VM VirtualBox Extension Pack installed and at least USB 2.0 (EHCI) Controller enabled at VM's USB settings.

After these, run the above script with sudo.

gon1332
  • 101
0

Okay, what worked for me was to use synaptic to completely uninstall (including configuration files) the commercial virtual-box 4.3 and install the virtualbox (open source edition). I then had to uncheck usb2 support, but my devices were then found (not grayed out) and I didn't need to use root either.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • I'm the original poster and I have switched to Debian sid a while ago... From what I remember the non-root user need to be added to the vboxusers group AND one of: {add the non privileged user to the udev group to grant access to any USB devices }, {Add the non privileged user to the same group as the device (there is many)}, {change the permission of the device: https://unix.stackexchange.com/questions/141255/give-a-specific-user-permissions-to-a-device-without-giving-access-to-other-user}. Finally reboot or create new session + reload the vbox driver. – 01BTC10 Jul 01 '17 at 06:04
  • However the easiest solution is the one you described since the install script then take care of fixing permission. I might be wrong but maybe you get only usb1 speed which is very slow. – 01BTC10 Jul 01 '17 at 06:06