2010-01-09

HowTo use USB inside Sun VirtualBox non-OSE on a Linux host

Situation:

You have installed the non-OSE version of Virtualbox on Linux. Your Guest-OS, i.e. Windows, is installed but you cannot access connected USB-devices. Your USB equipment is displayed grayed out, you cannot check it.

Solution:

The solution to this issue consists of the following steps:
  1. If VirtualBox is running, shutdown the guest-OS and close Virtualbox.
  2. Make sure you have the non-OSE version of virtulabox installed. openSUSE installs by defaut the OSE version, which is not USB enabled.
  3. Open the file /etc/init.d/boot.local as root and append the line

    /mount -a

    Save the file.

  4. No we need to figure out the group-ID of vboxusers. Open a textconsole window an enter:

    grep vbox /etc/group

    You should get a response like:

    vboxusers:!:109:robert

    109 is the group-ID. It might be different in your case. Remember the number, we will need it later.


  5. Open the file /etc/fstab as root and modify it as follows:

    The entry starting with usbfs is commented out by placing a # in front of it. So it looks like # usbfs ...

    Add an new entry:

    none /proc/bus/usb usbfs auto,busmode=0775,
    devmode=0664,busgid=xxx,devgid=xxx 0 0

    Note: The two lines above should appear as one line in your fstab file. Do not place spaces before and after the colons. I have inserted a break for better readability.  Of course you have to replace the 'xxx' strings by the number you found in step 4.

  6. Do you remember the output of step 4.? Did it state your user name as shown in my example? If so proceed with step 7. If not you have to add your username to the group vboxusers. You can do this with the group management tool of your distro or by typing the following into a text console as root:

    groupmod --add-user xxx vboxusers

    In this line you have to replace the 'xxx' by your username. Do not insert the group-ID from step 4. here!
  7. If you have previously started VirtualBox some tmp files should be removed. In order to do so enter the following as root at a text console:

    rm -r /tmp/.vbox-xxx-ipc/

    As in the example above, the xxx is a placeholder and must be replaced by your username.

    Be careful while typing the rm command. rm -r (-r = recursive) has the power to destroy working installations!

  8. Now we are comming to the final steps of this HowTo.

    Open a text console and enter as user:

    env VBOX_USB=usbfs /usr/bin/VirtualBox

    At the VBox control panel scroll down to the USB section and click it. Activate USB controller and USB 2.0 controller. Add at least an empty USB filter (the topmost icon right beside the listbox). Quit this window by clicking OK. Now start the guest OS and check the USB devices. Of course you should have connected an USB device...
  9. Typing the whole string

    env VBOX_USB=usbfs /usr/bin/VirtualBox

    in order to start VBox is very unconvenient. A desktop icon would be a good place to keep this command.

My Motivation:

I installed Virtualbox in spring 2008 for the first time. Installing Windows XP was no problem. And I could use some apps which have no counterpart on linux. As I wanted to use an USB scanner for the first time I struggled. Lots of googleing finally gave me all the information I seeked that time. Each website presented a part of the puzzle. But no one showed the whole game.
Now I have a functioning scheme which is tested on different computers running openSUSE 11.0 and 11.1 as 32 bit as well as as 64 bit versions.
Hopefully this short text will be of use for you.

Copyright

This HowTo is based on many publications on different websites. I collected them during 2008. The solely applicable license is the GNU Public License (GPL).

No comments:

Post a Comment