Sunday, November 16, 2008

How to use USB in Sun xVM Virtualbox?

In this article, I documented and enumerated the steps on how to make your USB working on a windows XP inside Virtual box. This article is help ubuntu Hardy and Gutsy user who are having problems on using there USB's on there virtual machine.

Step 1


  • During installation of VB, it creates a group named as "vboxusers". Add yourself to the group.

Step 2


  • Create a group named "usbusers" and put yourself in it.

Step 3

  • Now uncomment the 4 lines below 'Magic to make /proc/bus/usb work' in mountdevsubfs.sh , they will be commented out by default) so it looks like the following:

sudo gedit /etc/init.d/mountdevsubfs.sh

#
# 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



Step 4

  • Modify the rules in file “/etc/udev/rules.d/40-permissions.rules” for Gutsy, and “/etc/udev/rules.d/40-basic-permissions.rules” for Hardy:
Change the lines :

From:

# USB devices (usbfs replacement)
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
SUBSYSTEM=="usb_device", MODE="0664"

To :

# USB devices (usbfs replacement)
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usbusers", MODE="0664"
SUBSYSTEM=="usb_device", MODE="0664"



Step 5

  • add this line:
none /proc/bus/usb usbfs devgid=120,devmode=664 0 0
  • to your /etc/fstab file. Make sure that the "120" is your vboxusers group (use your own number). To find out your number run command "cat /etc/group | grep vboxusers".