Enable USB Sharing

By | 3 Sep 2008

To use USB devices under e.g. VirtualBox in Hardy, edit the file /etc/init.d/mountdevsubfs.sh and find the line:

# Magic to make /proc/bus/usb work

Remove the following four comments so that it looks like this:

#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs "" /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount --rbind /dev/bus/usb /proc/bus/usb

Also add the following line to your /etc/fstab (129 is the group-ID of vboxusers)1 see Stone.log:

none     /proc/bus/usb     usbfs     devgid=129,devmode=0666    0     0

Now enable the new settings by doing:

sudo /etc/init.d/mountdevsubfs.sh stop
sudo /etc/init.d/mountdevsubfs.sh start

Finally, edit the file /etc/udev/rules.d/40-basic-permissions.rules and find the line containing the usb_device subsystem. Extend the permissions to 0666 like this:

SUBSYSTEM="usb_device", MODE="0666"

Save the file and you should be able to use USB devices inside VirtualBox guest systems.

According to Ubuntu Unleashed, you might have to add 2 lines to the /etc/init.d/mountkernfs.sh for the usbfs to get mounted automatically upon boot.

I’m also not sure about the permissions. It might work also using 0664 or even 0644.

Leave a Reply