Install VirtualBox with USB support
If you've installed VirtualBox as instructed in my tutorial "Install and configure VirtualBox for virtual OSes" you most likely have discovered that the open source edition of VirtualBox does not have USB support. In fact there are a few other features the open source edition does not offer that the closed-source edition does (such as offering the Remote Display Protocol so you can connect to a virtual machine remotely). But to get these features you will have to uninstall your current VirtualBox OSE installation, install the closed source version, and then configure your set up to allow USB support. It's not difficult so pretty much anyone can undertake this. In this article you will see how to uninstall VirtualBox OSE, install VirtualBox, and configure VirtualBox to allow USB support. For the purposes of this article, I will using a Ubuntu 9.04 installation to make things easy. NOTE: If you have virtual machines installed you will lose the data on those VMs.
Remove VirtualBox OSE
This is the easiest part of the tutorial. All you need to do is open up a terminal window and issue the command:
sudo apt-get autoremove virtualbox-ose
Once the OSE version has been removed it is time to install the closed source version of VirtualBox.
Installing closed source VirtualBox
The first thing to do is to add the proper sources to your /etc/apt/sources.list file. Open up that file, with your favorite editor, and add the following line to the end of that file:
deb http://download.virtualbox.org/virtualbox/debian jaunty non-free
Now save the VirtualBox repository key on your machine (for the sake of simplicity place it in ~/Downloads) and issue the following command:
sudo apt-key add ~/Downloads/sun_vbox.asc
which will add the repo key to your system. Before you run the install update apt with the command:
sudo apt-get update
Now you can install the closed source version of VirtualBox with the command:
sudo apt-get install virtualbox-2.2
During the installation you will also have to OK the compilation of the proper kernel module. If you do not do this you may not be able to create any VMs.
The last step for the installation is to add your user to the vboxusers group. Do this with the following command:
sudo gpasswd -a USERNAME vboxusers
Where USERNAME is your login. You will be prompted for your username.
Configure USB
Now it's time to configure the system to allow USB support. You have to get the user ID of the vboxusers group. To do this issue the following command:
grep vboxusers /etc/group
which will report something like:
vboxusers:x:123:
What you need to now do is add a line to the /etc/fstab file. This line will be (if we stick with the user ID report you see above):
none /proc/bus/usb usbfs devgid=123,devmode=664 0 0
With that file saved you are ready to reboot and start up VirtualBox with USB support.
Final thoughts
There are a lot of reasons why you would want to have USB support added to VirtualBox. For those iPhone owners out there it will give you a means to administer your phone without having to have a separate machine (or dual boot) in order to do so. This also greatly expands the capabilities of VirtualBox. The only downfall is you are giving up the open source version in order to gain USB support. For many this will be a worth wile trade-off. For others, giving over to closed sourced software isn't worth having USB support. It would be nice, however, if Sun would open source the USB supported version.
Advertisement
thnx dude, it helped me to work with usb better under VB. thnx 4 the post. +
…and I just added the user group and line in /etc/fstab and the usb support runs flawlessly also on the VirtualBox open-source version. :)
how to comply it?
I figured out why I couldn’t get updates: I had enabled the option to automatically download source code with the actual application. Having a non-free version, my computer was unable to find the source code, and gave up with the rest of the updates.
I did as you said earlier, but have been busy and forgot until reminded by my update manager.
Unfortunately.
It claims that it cannot check for updates because it cannot verify the authentication for the package. I need the new authentication file to keep my system up to date, and having not received updates in a while, my system could be vulnerable, so if I do not receive information quickly, I may have to temporarily remove the application.
This article may need to be split by version, or at least corrected every new release.
Still, it is quite fast, only taking a few weeks rather than…
yyyyyeeeeeeaaaaarrrrsssss……………(years)!
…I really need to get this homework off my back.
You downloaded from the Sun site?
http://www.virtualbox.org/wiki/Linux_Downloads
Should be fine w/ Maverick, but I haven’t tried it.
Let us know.
I am running Ubuntu 10.10, maverick, but could not get this to install. First, I backed up my VMs and uninstalled VirtualBox, the free version. I used “Software Sources” to add the apt line, changing “jaunty” to “maverick”, and put in the apt key, but it claimed it couldn’t find the files. I also tried viewing the files in firefox, and found them under i386 and amd64, the former being the one I should be able to install. Furthermore, I am not entirely sure this post is new enough for anyone to respond…I am all alone…unless you see this, in which case I will be notified by e-mail if and when you reply…so please do.
Ok, hang on there.
I went to Synaptic Package Manager and found out about the “re-install” option. That brings V-box to appear under System Tools. So that looks good.
Now I go to bed and see how far i can get tomorrow.
mdm
Ok, I tried following the instructions as listed. See below for the results of the sudo apt-get install virtualbox-3.1 command.
However, under Applications/System Tools there is no listing for Virtualbox (as with OSE version). So how do i start Virtualbox ?? Obviously, something went wrong….
I’m using Ubuntu 9.10
I’m in the pre-noobie status…. TIA,
mdm
masonmd@blacktower:~$ sudo apt-get install virtualbox-3.1
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libsdl-ttf2.0-0
The following NEW packages will be installed:
libsdl-ttf2.0-0 virtualbox-3.1
0 upgraded, 2 newly installed, 0 to remove and 61 not upgraded.
Need to get 45.6MB of archives.
After this operation, 91.5MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com karmic/main libsdl-ttf2.0-0 2.0.9-1build1 [16.4kB]
Get:2 http://download.virtualbox.org karmic/non-free virtualbox-3.1 3.1.2-56127_Ubuntu_karmic [45.6MB]
Fetched 45.6MB in 3min 11s (238kB/s)
Preconfiguring packages …
Selecting previously deselected package virtualbox-3.1.
(Reading database … 152823 files and directories currently installed.)
Unpacking virtualbox-3.1 (from …/virtualbox-3.1_3.1.2-56127%5fUbuntu%5fkarmic_i386.deb) …
Selecting previously deselected package libsdl-ttf2.0-0.
Unpacking libsdl-ttf2.0-0 (from …/libsdl-ttf2.0-0_2.0.9-1build1_i386.deb) …
Processing triggers for ureadahead …
Processing triggers for desktop-file-utils …
Setting up virtualbox-3.1 (3.1.2-56127_Ubuntu_karmic) …
addgroup: The group `vboxusers’ already exists as a system group. Exiting.
Messages emitted during module compilation will be logged to /var/log/vbox-install.log.
Success!
* Starting VirtualBox kernel module * done.
Setting up libsdl-ttf2.0-0 (2.0.9-1build1) …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
masonmd@blacktower:~$
I am a newbie running Jaunty 9.04 64bits on HP Pavilion Laptop, I previously didn’t have any virtualbox installed. I installed Sun Vbox following the above given instructions on this blog with the latest version issued by Sun: 3.1.2. r56127.
Everything ran smoothly without any tweaking: USB support was available from the menu toolbar trouble-less.
Wonderful tutorial. It worked brilliantly for me swapping Virtualbox OSE for Virtualbox 3.x.
Regarding keeping existing virtual machines, what I did was before doing anything else I renamed the folder .Virtualbox in my home directory. Then I followed the instructions including the final reboot, but before starting the upgraded version of Virtualbox I changed the renamed folder back to .Virtualbox.
When I started the program it told me that I had to convert the virtual machines to a new format. I did that and was then able to boot my virtual machine and get usb support. Wonderful.
Thanks very much.
I add virtualbox repository via ubuntu tweak. Then run synaptic and click reload. The virtualbox now appeared in the packages list. When I select to install this packages synaptic ask my confirmation to remove virtualbox ose as the concequences. After clicking apply, synaptic will download virtualbox and only if the download is succeeded it will remove virtualbox ose and install virtualbox.
i’m interested for try this..!
It may be that using sudo apt-get is the problem; in the post above when I wanted to try the “closed” version, note I went to the Sun site rather than use the CLI or apt-get.
Today I wanted to test again and used Ubuntu, and again I didn’t have any problems; however, I am downloading the package from the Sun VBox site, not apt-get, and I am uninstalling the OSE version via Synaptic, not the CLI.
Tried Many times, all with Fresh installs. Still getting same error, this method DOES NOT Work.
” rhyno says:
August 4, 2009 at 1:53 am
Followed Directions..
me@host:~$ virtualbox
The program ‘virtualbox’ is currently not installed. You can install it by typing:
sudo apt-get install virtualbox-ose
bash: virtualbox: command not found”
Thanks so much for posting. This solved my problem. I hate having to use XP to use iTunes but it appears to be a necessary evil at this point.
The article provided new information for me because I noticed all of the Linux distros I’ve tested include the OSE version. Jack helped me realize that it is possible to use the closed version which provides USB support–not available in the OSE–which is what I really needed the other day.
The question was whether or not the .vdi file generated in the OSE version would remain intact if used in the “closed” version. I didn’t have any problems with the scenario as posted earlier other than recreating the machine which is only a few clicks.
Today I wanted to test again and used Ubuntu, and again I didn’t have any problems; however, I am downloading the package from the Sun VBox site, not apt-get, and I am uninstalling the OSE version via Synaptic, not the CLI.
The entire process today took about 20 minutes, and I never had to use the CLI.
Others prefer the CLI, and the directions provided by Jack appear valid and typical.
I did notice one message generated today that I missed the other day: root user does not have to add him/herself to vboxusers–it’s automatic.
Maybe VBox can run under Wine–don’t know–but googling around will help one find information for any popular Linux distro which will be needed by most, especially when getting Shared Folders to work–whether running Windows as Host or Windows as Guest.
Jack–can you help us out with that one? Or maybe you have.
Followed Directions..
me@host:~$ virtualbox
The program ‘virtualbox’ is currently not installed. You can install it by typing:
sudo apt-get install virtualbox-ose
bash: virtualbox: command not found
??
Jack and Gravity–
Per previous discussions and responses:
No problems at all with the following process:
1. Copy/paste the .vdi file to the Host desktop (copy just in case).
2. Uninstall VB OSE edition via Synaptic.
3. Delete all virtualbox files in Home.
4. Install the new “closed” version of VB–I did it directly from VB download site.
5. Copy/paste the .vdi back in to the new VB folder.
Note: Some may get lost if they need to enable Show Hidden Files.
6. Create settings the in new machine and add the .vdi hard drive.
7. Add “new filter” twice for my two USB devices–the mouse and a USB flash–make sure it’s new filter, don’t assign–new filter in USB settings will pick up any USB Device.
8. Start virtual machine.
9. Re-install VBox Additions.
10. Adjust parameters such as display/audio if necessary–for some reason my audio had been muted.
11. Click on Devices on top bar; add the USB flash.
12. New driver is installed
13. USB flash shows as Removable Disk F:/ on VB hard drive.
14. Copy files, open .mp3, transfer, or whatever.
Note: I didn’t have a need to assign a user–never have had to–but I have read in the Sun instructions it must be done; maybe default user has no need to if running as root–don’t know.
I’m using Linux Host with a nLite version of Windows XP as Guest.
If you are using Windows 7, just add the CD/DVD .iso option. It will install on first boot; then, install the Virtual Machine Additions. After that, release and remove both .iso files so you can write to the optical device.
Quite easy, and I don’t even think I used the CLI–no need to with a Windows Guest.
Does this work if you install Windows 7 with it?
One other little Gotcha with keeping your old VMs from the OSE edition. I have found that with the pre-installed VMs USB is not rolled into them. You will have to install a new VM for USB to work properly. At least that is my experience. Anyone have a different experience?
Here’s the scoop: When you run the new VirtualBox for the first time it imports all of your previous information automatically. I did move the *vdi files out and then move them back after the install. They ran perfectly.
jasray: Okay in the VirtualBox OSE installation the directory is:
~/.VirtualBox
within that directory is a subdirectory called HardDisks which is where the vdi files are located. I am testing now. I have to reboot and then i will report back. ;-)
jasray: The only reason I didn’t say to try that is because I haven’t had the opportunity to test it. I didn’t
want to say to do that not knowing 100% it will work. i will test it either tonight or tomorrow to make sure backing that directory up will work and then i will report back.
Yes, there’s the entire install–home/jasray/.virtualbox/VDI/name of install
Move it; uninstall; re-install; use existing machine during setup. In fact, I can take the machine to any computer and do the same. Isn’t that the idea with veedee eyes?
Why would I lose data? Sorry, I don’t follow . . . am I missing something?
Let me know before disaster strikes!
Hmmm . . . interesting because I just ran into this problem this morning with the USB option missing–the easy go around was to simply use Filezilla; however, don’t I have a .vdi file somewhere?