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 workCode language: PHP (php)

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/usbCode language: PHP (php)

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"Code language: JavaScript (javascript)

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

Your email address will not be published. Required fields are marked *

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)