Page 1 of 6 123 ... LastLast
Results 1 to 10 of 58

Thread: USB in VirtualBox: HOWTO

  1. #1
    Join Date
    Nov 2006
    Location
    Conn., United States
    Beans
    1,644

    USB in VirtualBox: HOWTO [OBSOLETE]

    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:
    Code:
    deb http://download.virtualbox.org/virtualbox/debian intrepid non-free
    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).

    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:
    1. Click on "+ Add Group"
    2. In the "Group Name" text box, type "usbuser"
    3. Write down the Group ID number on a piece of paper
    4. 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
    5. Click OK, and then Close, then Close again.


    Edit /etc/fstab

    Open Applications -> Accessories -> Terminal and type "gksudo gedit /etc/fstab" (without the quotes). Add following lines to the end of the file:
    Code:
    # For USB access with Virtualbox
    none	/proc/bus/usb	usbfs	devgid=####,devmode=664	0	0
    IMPORTANT: Replace #### with the Group ID number that you wrote down earlier. Save the edited file (File -> Save) and then exit gedit.

    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.

    V. TROUBLESHOOTING

    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)
    1. 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)
    2. 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.
    3. 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.
    4. 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.
    5. 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...
    6. 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...
    7. 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.
      Code:
      mount | grep usb
      cat /etc/group | grep vboxusers
      cat /etc/fstab
    Attached Files Attached Files
    Last edited by HotShotDJ; February 19th, 2009 at 04:58 AM. Reason: Added notes for KDE users & guest additions instructions
    "When you dual-boot Windows, Windows exists along side of Linux. When you use VirtualBox, Windows exists at the pleasure of Linux." -- ThomasAaron @ System76

  2. #2
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: USB in VirtualBox: HOWTO

    This information was posted in the virtualization mega thread.

    I will add a link to this thread as well, but we are trying to keep the number of stickies to a minimum.

    I think it would be best if :

    1. It the sticky needs additional information, send me a PM and I will maintain it.

    2. If we are going to maintain a sticky, we also need to encourage it's use.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  3. #3
    Join Date
    Mar 2006
    Location
    Hurley, Wisconsin
    Beans
    186
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: USB in VirtualBox: HOWTO

    Thanks for the great howto. Do you know if it would be possible to use MS Streets & Trip within VirtualBox? I have been trying to get VB to "see" the usb GPS but so far nothing seems to work. When I try to active the GPS I get a com port not present or being used by other application error message. I would like to use Ubuntu on this Dell Inspiron 1200 on trips and not have to install my other hard drive.
    Tim

  4. #4
    Join Date
    Nov 2006
    Location
    Conn., United States
    Beans
    1,644

    Re: USB in VirtualBox: HOWTO

    Quote Originally Posted by SVWander View Post
    I have been trying to get VB to "see" the usb GPS but so far nothing seems to work. When I try to active the GPS I get a com port not present or being used by other application error message.
    I've done a little research on this issue. After you activate the device via the VirtualBox Devices --> USB Devices menu or the USB icon in the bottom-left VirtualBox window, you should see your GPS hardware in the device manager even though MS Streets & Trips isn't seeing it. If that is the case, in order to make the GPS unit "visible" to your software, you need to go to the Windows device manager and then disable the GPS device, then re-enable it.
    "When you dual-boot Windows, Windows exists along side of Linux. When you use VirtualBox, Windows exists at the pleasure of Linux." -- ThomasAaron @ System76

  5. #5
    Join Date
    Mar 2006
    Location
    Hurley, Wisconsin
    Beans
    186
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: USB in VirtualBox: HOWTO

    Quote Originally Posted by HotShotDJ View Post
    I've done a little research on this issue. After you activate the device via the VirtualBox Devices --> USB Devices menu or the USB icon in the bottom-left VirtualBox window, you should see your GPS hardware in the device manager even though MS Streets & Trips isn't seeing it. If that is the case, in order to make the GPS unit "visible" to your software, you need to go to the Windows device manager and then disable the GPS device, then re-enable it.
    Thanks for the quick answer! I have tried what you suggested and do have the USB device enabled in VirtualBox. Or at least on the menu bar heading Device it shows a Prolific Technology Inc USB Serial Controller D [0300]. However the font is grayed out. When I right click on the USB icon on the lower right side of the screen it will say the same thing. BUT when I hover over the same icon it will say that no USB device is present. Very confusing. In the Device Manager will it show up as a USB device? I have disabled and enabled the Hub and the USB controller but it didn't help. Do you have any ideas what I am doing wrong or even if it is possible to get Street & Trips working in VirtualBox?

  6. #6
    Join Date
    Nov 2006
    Location
    Conn., United States
    Beans
    1,644

    Re: USB in VirtualBox: HOWTO

    Quote Originally Posted by SVWander View Post
    Thanks for the quick answer! I have tried what you suggested and do have the USB device enabled in VirtualBox. Or at least on the menu bar heading Device it shows a Prolific Technology Inc USB Serial Controller D [0300]. However the font is grayed out.
    Ok. Do other USB devices work?

    EDIT: I just thought of something. Have you installed the Guest Additions?

    If not start up your guest OS in windowed mode (not Full Screen or seamless). After it has completely booted, open the Devices menu in the VirtualBox menu and select "Install Guest Additions." If it doesn't autostart (be patient, it takes time to load), you'll have to go to My Computer in Windows and manually start it by opening it (Guest Additions will appear as a CD). Follow onscreen instructions. When the Guest Additions finish installing, restart your guest OS.

    Is the GPS device still grayed out?

    Also, you can set a device filter and see if that helps. First plug in your GPS device. Highlight the guest OS without starting it, go to settings and select USB (Enable USB Controller and Enable USB 2.0 should both be checked). You'll see a large white box underneath the heading "USB Device Filters" which should be empty at the moment. Right Click anywhere within that white box and select "Add Filter from Device." Are you able to select your GPS device from the pop-up menu? If so, it will now appear in the USB Device Filters box with a check mark next to it. Click on the OK button in the lower right corner of the USB settings page. Now you can start your guest OS.

    Now try disabling and the re-enabling the device using the Windows device manager (NOT VirtualBox's device menu!).
    Last edited by HotShotDJ; January 18th, 2009 at 08:21 PM.
    "When you dual-boot Windows, Windows exists along side of Linux. When you use VirtualBox, Windows exists at the pleasure of Linux." -- ThomasAaron @ System76

  7. #7
    Join Date
    Jan 2009
    Location
    Paranaque
    Beans
    54
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: USB in VirtualBox: HOWTO

    Hi! I was able to activate the 4 USB ports in Virtual Box. One had a USB printer, one had an external HDD, one had a flash drive and the other was unknown. On the main menu of Virtual Box under USB Device filters, it indicates 4 are active.

    When I turn on the virtual machine to load my XP OS, the printer is identified and I was able to install the drivers for it. I cannot see the flash drive and the external HDD in My Computer. Is there something else I should do in order to access the files from these external storage sources?

    Thanks in advance.

  8. #8
    Join Date
    Nov 2006
    Location
    Conn., United States
    Beans
    1,644

    Re: USB in VirtualBox: HOWTO

    Quote Originally Posted by nirvblakr View Post
    I cannot see the flash drive and the external HDD in My Computer. Is there something else I should do in order to access the files from these external storage sources?
    There are two things you can try... either one should work.

    1. (EDIT: I've found that this first method is rather "hit or miss" -- you're probably better off with #2) Unmount the drive from the Host OS (Linux). When you plug in the HDD or the flash drive, they should appear on your Ubuntu desktop (unless you changed your desktop configuration). Right click on the icon for the drive and select "Unmount Volume." It should now be available to VirtualBox.

    2. Create a device filter. Plug in your flash drive and/or your HDD. 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 HDD 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 HDD's or flash drives as desired. Now when you start up your guest OS, it will automatically take control of the device from the host OS when it is plugged in.

    Keep in mind, whether you choose option 1 or option 2, that when you give control of a device to the guest OS, it will NOT be available for use in the host OS until it is released from the guest OS.
    Last edited by HotShotDJ; January 19th, 2009 at 08:19 PM.
    "When you dual-boot Windows, Windows exists along side of Linux. When you use VirtualBox, Windows exists at the pleasure of Linux." -- ThomasAaron @ System76

  9. #9
    Join Date
    Jan 2009
    Location
    Paranaque
    Beans
    54
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: USB in VirtualBox: HOWTO

    Thanks for the response. I tried the first method of unmounting the flash drive in my Ubuntu OS but I can't still see the drive in my XP Host OS.

    I tried the 2nd method. I placed an x mark on enable usb controller and enable usb 2.0 controller. The 4 USB device filters are active with names of the printer on one, the flash drive on the 2nd one, the ext HDD on the 3rd and an unknown device on the 4th. All have x marks on the box before the name of the device.

    I turned on my Host OS again and yet I can't still see the flash drive.

    BTW, do I have to install the guest additions for me to access the external drives?

    Hope you can shed light on this.

  10. #10
    Join Date
    Nov 2006
    Location
    Conn., United States
    Beans
    1,644

    Re: USB in VirtualBox: HOWTO

    Quote Originally Posted by nirvblakr View Post
    I turned on my Host OS again and yet I can't still see the flash drive.

    BTW, do I have to install the guest additions for me to access the external drives?
    Before moving forward, can you verify that the other USB devices are working from within the guest OS? If they are, then we can just focus on the flash drive. Also, I don't believe that guest additions are required for USB support in VirtualBox, however, it is probably a good idea to install them -- you'll get support for many other features.

    EDIT: Ok, I did some testing on my system with some spare USB hard drives I have. I ran into a similar issue as you did with one of them. In my case, when I tried to activate it, Windows tried, and failed, to load the USB Mass Storage Driver. It was a simple fix. After setting up the device filter, I unmounted the drive from my Ubuntu desktop and then unplugged it from the computer. I then started up my guest OS (Windows Vista Home Premium). Once it was completely booted up and ready to use, I plugged in the problematic USB hard drive. It was then picked up and worked fine within the guest OS.
    Last edited by HotShotDJ; January 19th, 2009 at 08:18 PM.
    "When you dual-boot Windows, Windows exists along side of Linux. When you use VirtualBox, Windows exists at the pleasure of Linux." -- ThomasAaron @ System76

Page 1 of 6 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •