THIS HOWTO IS NOW OBSOLETE!
As of VirtualBox version 2.1.4, USB support works properly "Out-of-the-Box" I strongly recommend following the following HowTo for installing VirtualBox 2.1.4 (PUEL): http://ubuntuforums.org/showthread.php?t=1074160
Below are the original instructions for version 2.0 through 2.1.2. Be warned, this howto is no longer maintained.
This is an expanded version of my howto that is included in the USB Devices section of the Virtualization Mega-Thread. NOTE! The Community Documentation for VirtualBox on Ubuntu describes an obsolete method that may or may not work with current (Hardy and Intrepid) versions of Ubuntu running VirtualBox 2.*. If you have attempted to enable USB support by following any other method, you must reverse any changes that you made before continuing.
IF YOU ARE RUNNING A VERSION OF UBUNTU OLDER THAN 8.04, IT IS STRONGLY RECOMMENDED THAT YOU UPGRADE TO AT LEAST VERSION 8.04 LTS. I have only validated these instructions against Ubuntu 8.04 LTS and Ubuntu 8.10. They may not work with earlier version!
Note to KDE/Kubuntu users: These instructions are Gnome-centric, however they will work, with some modifications, in Kubuntu (and probably other Ubuntu derivatives). Some examples include:
- To access software sources & software installation in KDE, see Repositories/Kubuntu.
- Replace "gksudo gedit" with "kdesudo kate."
- K-menu --> System Settings --> Users and Groups is used to access user and group information.
Getting USB support working in VirtualBox 2.*
First of all, you will need the Personal Use End License (PUEL) version of VirtualBox. The Open Source Edition (OSE) version that is included in the Ubuntu Universe repository does NOT support USB.
I. Getting VirtualBox 2.1 PUEL edition
If you've previously installed the OSE version of VirtualBox, you'll need to completely remove it. Use System → Administration → Synaptic Package Manager and search for "virtualbox" and completely remove any virtualbox related packages. Right click on the package you want to remove and select "Mark for Complete Removal." Simply using "Mark for Removal" may leave files behind that could block the installation of the PUEL version. Click on "Apply" then confirm the changes and click apply again. When done, go ahead and close Synaptic Package Manager.
Go to System → Administration → Software Sources. Click on the “Third-Party Software” tab. Now, click on the “Add” button near the bottom of the window. Paste the following into the “APT line” box:
If you are running Hardy (8.04 LTS) replace “intrepid” with "hardy". At the time of this writing, packages for later versions are not available. If you are using a version older than hardy, DO NOT USE THIS HOWTO. Since versions prior to hardy are either no longer supported or will soon reach their end-of-life, this would be a good time to upgrade to at least hardy (8.04 LTS).
deb http://download.virtualbox.org/virtualbox/debian intrepid non-free
Click “Add Source” Do not close Software Sources yet..
Save the attached file (sun_vbox.txt) as sun_vbox.asc to your home directory or desktop. In Software Sources, click on the Authentication tab and then click on “Import Key File...” Browse to the location of sun_vbox.asc. Click on the file and then press OK. Notice that a key has been added to Trusted software providers for Sun Microsystems, Inc. (xVM VirtualBox archive signing key). Now you can close Software Sources.
NOTE: If you prefer, you can get the signing key directly from Sun at http://download.virtualbox.org/virtu...n/sun_vbox.asc
II. Install VirtualBox 2.1
Open System → Administration → Synaptic Package Manager. Click on the Reload button. Now search for virtualbox (the Quick search box sometimes does not work with third-party repositories, so use the Search button instead). Click on the checkbox next to “virtualbox-2.1” (or virtualbox-2.0 if you prefer the older version). Click “Apply” and follow the onscreen instructions. Once Virtualbox is installed, close Synaptic Package Manager.
You will now have to add all users who will be using Virtualbox to the “vboxusers” group. We'll take care of that below.
III. Getting USB working
Go to System → Administration → Users & Groups. Unlock "Users Settings" using the "Unlock" button near the lower right of the box (next to the close button) then click on “Manage Groups”
Scroll through the list of group names until you find “vboxusers” then click on it to highlight and click on the “Properties” button. You'll see a list of users on your system. Check off the users who you will want to give access to Virtualbox. Do NOT check off “root”
Before you close this window, you have a decision to make. Do you want all users of Virtualbox to have USB access or just SOME users of Virtualbox? If you want all users of Virtualbox to be able to use USB devices within Virtualbox, WRITE DOWN the Group ID number (on my system, the number is 126 – it may be the same or different on your system). You may now close out of Users & Groups and skip to “Edit /etc/fstab”
If you want only SOME users of Virtualbox to be able to use USB devices within Virtualbox, do the following:
- Click on "+ Add Group"
- In the "Group Name" text box, type "usbuser"
- Write down the Group ID number on a piece of paper
- Click on your user name in the "Group Members" table -- a check mark will appear in front of the user name. Do this for each user you wish to allow USB access in VirtualBox
- Click OK, and then Close, then Close again.
Open Applications -> Accessories -> Terminal and type "gksudo gedit /etc/fstab" (without the quotes). Add following lines to the end of the file:
IMPORTANT: Replace #### with the Group ID number that you wrote down earlier. Save the edited file (File -> Save) and then exit gedit.
# For USB access with Virtualbox
none /proc/bus/usb usbfs devgid=####,devmode=664 0 0
Reboot your system.
IV. Enable USB Controller in VirtualBox
This part of the HOWTO assumes that you have already created a Virtual Machine. Instructions on how to create a VM and install an operating system can be found elsewhere and is outside the scope of this HOWTO. While not required, you will enjoy a much better user experience with your VirtualBox guest operating systems if you install the guest additions. For a Windows guest, start your guest OS. After it is booted up and ready to use, make sure you are in windowed mode (as opposed to full screen), open "Devices" from the menu bar, and select "Install Guest Additions..." Normally, it will start up automatically, but if it doesn't, just open the Windows "start" menu, go to "My Computer" (or "Computer" in Vista) and double click on the CD labeled "VirtualBox Guest Additions."
Now you are ready to enable the USB controller for your guest OS. Open Applications → System Tools → Sun xVM VirtualBox. Click to highlight your Virtual Machine then click “Settings” -- In the left panel, click on USB. You'll see the USB options appear on the right. Check off “Enable USB Controller” and, if desired, “Enable USB 2.0 (EHCI) Controller. For now, don't worry about device filters. Click OK. Do this for each VM in which you wish to have USB access.
Start you guest OS. You can activate your USB devices using either the USB icon in the bottom-right icon bar of your virtual machine window or from Devices --> USB Devices in the menu bar across the top of your virtual machine window.
Remember, just as with operating systems installed normally, you may need to install drivers for your device(s) (such as USB printers, U3 enabled flash drives, etc.) on your guest OS before you will be able to successfully use your device with the guest OS. Follow your hardware manufacturer's or guest OS's instructions to install the appropriate drivers in the guest OS.
My USB keyboard and/or USB mouse is not working or is behaving erratically. DO NOT activate these devices for your virtual machines. VirtualBox uses virtual drivers for these devices. Activating them in your virtual machine may cause erratic behavior in both the guest and host OS.
I can activate my USB Hard Drive and/or Flash Drive, but it is not working in the guest OS . You'll need to create a device filter. Before opening VirtualBox, plug in your flash drive and/or your USB hard drive. Open VirtualBox and select your guest OS. Do NOT start the guest, just highlight it. Click on "Settings" in the toolbar and select USB in the left pane. Notice a large white area just below the heading "Device Filters." Right click anywhere in that large white area and select "Add filter from device." Now select your USB hard drive or Flash drive. Notice that the name of the device will now appear in the large white area with a checked box next to it. Repeat for other USB hard drives or flash drives as desired. In some cases, you'll need to unmount the device from your Ubuntu desktop before starting the guest OS. Once the guest OS has been started and is ready to use, plug in the USB hard drive or flash drive. The guest OS should recognize and mount it properly now.
When I activate a USB device in my guest OS, I can no longer use it from my host OS. This is normal. When you enable a USB device, it will be inaccessible to your host OS until you release it from your guest OS.
I cannot burn CD's or DVD's with my USB CDRW/DVDRW drive. You're actually better off using tools such as Brasero or K3B in Ubuntu to burn CD's or DVD's ... but if you must use your guest OS, it can be done very easily. Plug your USB CDRW/DVDRW drive. Open VirtualBox and select your guest OS. Do not start it yet. Open "Settings" and select "CD/DVD-ROM" from the left panel. In the right panel, check off "Mount CD/DVD Drive" and then select the "Host CD/DVD Drive radio button. Select your CDRW/DVDRW drive from the drop down list. Now, check off "Enable Passthrough." Click OK. Start your guest OS. You should now have full burning support for the drive. NOTE: This also works for internal CDRW/DVDRW drives.
USB Devices are visible under Devices --> USB Devices, but they are greyed out. First, double check your work. Go back to the top of this HowTo and check for any errors that you may have made and be sure that you haven't skipped any steps. (Even the most intelligent people in the world make mistakes. I've found the most mistakes are made by those who angrily insist that they made no errors.) Before posting for help, please do the following (and include your answers and actions in any post for help on this issue)
- Are all USB device effected or only some USB devices? If only some, then the USB support is functioning, but there is a problem with support for the particular device (for example, web cams are notoriously buggy under Virtualbox)
- Did you edit /etc/init.d/mountkernfs.sh in a previous attempt to enable USB support in VirtualBox? If yes, please remove or comment out your changes.
- Did you edit /etc/init.d/mountdevsubfs.sh in a previous attempt to enable USB support in VirtualBox? If yes, please remove or comment out your changes.
- Did you edit /etc/udev/rules.d/40-permissions or /etc/udev/rules.d/40-basic-permissions-rules in a previous attempt to enable USB support in VirtualBox? If yes, please remove or comment out your changes.
- If you've had to change any of the above files, please reboot your system. Now, start up VirtualBox and your guest OS. Does USB work now? If not, continue...
- Make sure that your guest OS is shut down. Now, select it (but don't start it) and click on Settings and then select USB. Verify that "Enable USB Controler" and "Enable USB 2.0" are checked off. Click OK. If you had to check either box off, start your guest OS. Does USB work now? If not, continue...
- Please run the following commands, one line at a time, in a terminal (Applications --> Accessories --> Terminal) and post the output. DO NOT cover up, block out, or otherwise alter the information from these commands. There is no information that can be used to hack your computer, and all of the information is relevant to diagnosing the problem.
mount | grep usb
cat /etc/group | grep vboxusers