Updated: November 3, 2010
This is is a question often asked. Not only that, I have received a formal request from one of my readers to write a tutorial on this topic. Studying the internals of the problem into some depth, I really did discover that most people are having a hard time playing with USB devices in VirtualBox. Therefore, I decided to make the world a better place and write this howto.
Using USB devices of any kind, like thumb drives, Web camera and others, in your virtual machine can improve the quality of your virtual experience. It makes the virtual machine more usable. You can enjoy the virtual machine as more than just a test bed or a dire necessity because one of your programs may not work in the host operating system. It can become a second reality, where you use your system resources to the max, including all kinds of cool peripherals. Convinced? Surely. Now, let's examine the functionality, up close.
We will examine the problem in Linux. In Windows, the issue is far more trivial, but still, you might want to read anyway. The choice of the guest operating system is not important, the only difference in the setup concerns the host operating system.
Important note: You will need VirtualBox PUEL edition. The OSE edition does not offer USB support. Make sure you download the right version, otherwise you may hit an insurmountable obstacle.
You know all about this. I've written tons of tutorials on how to do this, including some fairly elaborate multi-boot setup. Windows, Linux, take your pick.
Click on Settings for your virtual machine, go to USB tab. Check the two boxes, since you do want USB 2.0 support. In theory, this is all, but there's one step we will need to do afterwards to get this really working. True for Windows, Linux needs a bit more sweat. We will address that soon.
USB filter is a nice feature that allows you to automatically connect USB devices to your virtual machine. Any device listed in the filter box will be plugged in when you power the guest operating system. Other devices will require that you manually connect them.
This is required to have the USB support enabled. Much like VMware Tools for VMware products, the Guest Additions expose additional functionality in the virtual machine, boost performance, enhance sharing, and more. We've had a long tutorial, which explains how to achieve this in both Windows and Linux virtual machines.
We will try to connect a 16GB Kingston DataTraveler G2 USB thumb drive, which has a single JPG image on it, just for fun. Testbed: Ubuntu Lucid with VirtualBox 3.2, running a Windows XP virtual machine.
Boot your virtual machine. Now try to connect a USB device. Go to Devices > USB Devices and choose the one you need. Oops, the options will all be grayed out.
So what do you do?
Yes, this geeky step is part of the setup. You will need to add your user to the VirtualBox group to be able to share USB resources. You can do this from the command line or try the GUI menus.
All right, so we're running Ubuntu with Gnome desktop. Therefore, go to System > Administration > Users and Groups. In the menu that opens, click on Manage Groups. Scroll and look for the vboxusers group.
Click on the Properties button. Make sure your user is listed and checked in the Group Members field.
You will need to logout and login back into the session for the effects to take change. Now, power on the virtual machine once more and see what happens.
This time, it will work properly. If you've used filters, the device will be automounted. You will have the USB device ready for use in your virtual machine. It can be a storage device or some other cool gadget. You may even use iPhone, iPod or similar, in case the host operating system does not support the device sync or whatnot.
In the past, you would have to change all kinds of other permissions manually, so there's hope and progress after all, but an automation of this step would make it so much easier for the average user. But we're done, everything works!
For a whole library full of tutorials, guides, howtos, tips and tricks on virtualization, feel free to click on any of the links below, preferably all.
Setting up the USB sharing in VirtualBox is not the easiest or the most intuitive step, but it can be done without donating a kidney. You do not need to dabble in code. You will have to pay attention to some of the steps, though, and you should be up and running in minutes, once your virtual machines is installed and fully set up.
Anyhow, that would be all. Another mystery unraveled, another tutorial made easy. I hope you enjoyed this; expect more good things to come. Thank you Carl for the idea!
P.S. I have written this tutorial for Ubuntu, Gnome. If you need tutorials for other Gnome desktops or for KDE desktops, feel free to ping me and I'll bake a sequel. In general, it's pretty much the same. Add your user to the vboxusers group. Log out, log in. C'est tout.
P.S.S. If you find this article useful, please support Dedoimedo.