VirtualBox with USB Support on Ubuntu

There are two versions of Virtual Box:
- OSE (Open Source Edition) which is in the repos
- Closed Source Edition, or Standard, or just plain “Virtual Box”

OSE does not have USB support. There are a few other features from the closed source version that aren’t included in OSE, you can see the list here. So, if you want to have USB support in VirtualBox, you need to install closed source edition and make a change to /etc/fstab. Here are the steps:

1. Remove OSE
$ sudo apt-get autoremove virtualbox-ose

2. Add the VirtualBox repo for Intrepid Ibex. Click System > Administration > Software Sources. Click the ‘Third Party Software’ tab. Click ‘Add’ and enter:
deb http://download.virtualbox.org/virtualbox/debian intrepid non-free

Save the VirtualBox GPG key from here, then import it into Synaptic by clicking the ‘Authentication’ tab and then ‘Import Key File’.

Click the ‘Reload’ button in Synaptic to reload the repositories.

3. Install the latest virtualbox package (as of this writing it is virtualbox-2.2) by selecting it in Synaptic, or running this command from a terminal:
$ sudo apt-get install virtualbox-2.2

4. Add yourself to the vboxusers group:
$ sudo gpasswd -a YOURUSERNAME vboxusers

5. Find the devgid for ‘vboxusers’:
$ grep vboxusers /etc/group

It will return something like:
vboxusers:x:125:username

Add this line to the bottom of /etc/fstab, replace the devgid number with your devgid:
none /proc/bus/usb usbfs devgid=125,devmode=664 0 0

After you reboot you should now have USB support in VirtualBox.

Last tested on Ubuntu 9.04 Jaunty Jackalope.

Posted in Ubuntu   |   Comments (41 )

Comments

what is the command for running virtualbox? I tried searching for a command but the closest i get is “vboxwebsrv”

$:/usr/bin$ ls vb*
vboxwebsrv

Second, when i run it from Applications>System Tools>Sun xVM VirtualBox I get an error.


VirtualBox- Critical Error

Failed to create the VirtualBox COM object.
The application will now terminate.

Callee RC:
NS_ERROR_FACTORY_NOT_REGISTERED (0×80040154)

Any guesses on how to solve this?

-casper911ca

***Edit:

I noticed it was a COM error, The very reason you had us reboot. My mistake, everything is working great.

-casper911ca

[...] support requires a quick patch to a system file (many thanks to Sam Lesher for this patch). Go back to your terminal and [...]

the devgid is not necessarily 46! It is system specific
>grep vboxusers /etc/group
will give you the devgid, mine was 128 not 46 so I changed accordingly.

http://ubuntuforums.org/showthread.php?t=962726&highlight=virtualbox+fstab

Thanks zcat, I updated the post with the correction.

Excelent job! helped me a lot.

Save the VirtualBox GPG key from here, then import it into Synaptic by clicking Settings > Repositories > Authentication > Import Key File.

How does one “save the GPG key from here”? What does this mean?

[...] “VirtualBox with USB Support on Ubuntu 8.10 Intrepid Ibex Posted by Sam Lesher on November 29, 2008 [...]

Thanks a bunch!

Cody:
Right-click on the “here” link and save the file.
And select it from “Import Key File”.

Hey guys, total Linux noob here, I’ve followed all the steps up to the last, but for the life of me I cant figure out what “Add this line to the bottom of /etc/fstab” means???

Thanks ahead of time.

/etc/fstab is a file.

open a terminal, and then edit it with super user priveliges:

sudo gedit /etc/fstab

add the line to the bottom of the file, making sure that you and that line with a carriage return. reload the fstab by typing

sudo mount -a

or restart your computer.

thanks for the info sam

thanks man

digitalMonkey

What do you mean by carriage return?

Whats reload the fstab do?
sudo mount -a
does nothing in command prompt.

This is so confusing!

Mate, I found this confusing as well, as a relatively new person to Linux.

“carriage return”:
When you have the /etc/fstab file open like described above you type the last line that is explained, but make sure to press the enter button to finish it off. I don’t understand why, but that’s what is meant. Then, save the file with the save button and it will save it as typed, only since you opened the gedit using the sudo command, if that makes sense.

Then, close the gedit window and you’ll default back to the terminal window where it will then make sense to type:

sudo mount -a

I hope this helps. There were a couple of assumptions that confused me as a learner as well!

Cheers.

YOU ROCK!!! THAT DID IT!

[...] مطلب با تغییراتی کم یا زیاد به نقل از اینجا و اینجا هستش [...]

Thanks dude! After two days trying to get it work I’ve got it!

Thanks, this actually solved the problem I was having with VirtualBox in general. After I restarted the pc the next morning everything started throwing out error messages at me and I’ve spent half the morning posting and looking up solutions to just get the darn thing working. This solved my problem with install (noob at ubuntu and VirtualBox) ;)

Thanks for explaining, I have no doubt that my USB stick will now work too.

Cheers

Thank you a lot I have solved the problem. Great explication.

Cheers

Thanks for the feedback, Mariano. Glad it helped :-)

[...] Installera VirtualBox enligt denna sida [...]

Virtualbox 2.04 with ibex still no joy as far as usb goes !!

Shame:(

oops, didn’t see the OSE details, will try that……

Thank You very much, I looked everywhere and I didn’t find anything useful I was finally able to use usb in VB thanks to this

Is it me or are there some steps missing?

I get to

Add this line to the bottom of /etc/fstab, replace the devgid number with your devgid:

What happend how o i do this?

MrBronz, I’m not understanding the problem you’re having. You can edit the file /etc/fstab by doing this at a terminal:

$ sudo gedit /etc/fstab

Then continue with the instructions — add the line from the instructions to the bottom of that file and save it.

Awesome how-to… Very well written had VB running in under 5 minutes! Many thanks, J

Thanks so much for this how-to! Worked like a charm!

Installed VirtualBox-2.2 on Ubuntu 8.10 and put the VM on a usb key. all works fine including file sharing except I cannot acces other usb devices from a usb device.
Also,if you try this, do not add yourself to the vboxuser group or you will get a fatal error on your vm and all your usb devices will disappear from your host untill you logout.
Searched for a solution but it seems VirtualBox is meant to be in your /home folder for it to work correctly.
This way though it is possible to carry your OS and run it on different machines.

Didn’t work for me :(

I followed the instructions on a Hardy 8.04 and it worked smoothly.
Thanks !

GR

I just tried with Ubuntu 9.04 Host and VirtualBox 3.0.2 and it all worked.

Thanks!

[...] will need the official release of VirtualBox for USB support and configure usbfs for user-level permission. This will enable the otherwise greyed out iPhone device from the USB Devices [...]

everything went fine, when i started win with vb and it detected the usb hub…

but when I attach an usb device i nothing happens in winxp

Hi
I am beginner and need some help in making inter networking between host and virtual machine.On my machine these software are installed
1. ubuntu 9.04 (Host)
2. virtual Box 3.0.8
3. ubuntu 9.04 (virtual machine)
i have assigned the IP to host eth0 using file /etc/networking/interfaces. while on virtual machine eth0 ip assigned by VirtualBox. i am replacing this IP with same class which assigned host.
The problem is that, when i was send a ping command from host to virtual machine or virtual machine to host , then response is unreached host.

any tutorial or web link that helpful for me.thanks for advanced.

Anyone know if autoremove of VBox OSE will remove existing OSE virtual machines? I’d rather not back those (large) files up if I don’t have to. Thanks for the nice write-up.

Works for me on Ubuntu 9.10 Karmic with VirtualBox 3.1

@Martin, autoremove didn’t delete my ~/.VirtualBox folder, so you should be ok. If you’re worried just use remove

Worked for me too on Kubuntu 9.10!

Great post by the way, I’ve looked through a thousand posts and none of them cited the fact that ubuntu repositories only had VirutalBox OSE. For a newbie that’s useful information!

Unfortunately we still need Windows XP for some tasks and without USB support, VirtualBox didn’t help much!

By the way, you can do everything through the graphic GUI of Kubuntu. Removing VirtualBox OSE, adding repositories & authorities, and installing VirtualBox 3.1! All in software manager!

@Martin : Yes autoremove doesn’t delete .Virtualbox folder, even if you remove the packages through the software manager. But always keep a backup of it in case…:-)

Thank you Sam!

Leave a comment

(required)

(required)