RSS



Get USB devices mounted on your Virtualbox XP machine in Gutsy (Ubuntu 7.10)

Wed, Oct 24, 2007

ArsGeek, Linux, Technology, Ubuntu, Windows, howto

Talk about it in our Forums

vbox.pngThere’s nothing more frustrating than not being able to mount your USB devices in your virtual machines. Well, maybe there are lots of things that are more frustrating but this morning my inability to do something that should be simple, easy and fun was driving me nuts.

So I figured out how to do it. It’s not terribly pretty but here’s what you need to do.

First, Gutsy got rid of the previous versions of Ubuntu’s way of handling USB mounts by not using USBFS anymore. Doh. That’s an issue for Virtualbox and your virtual XP installs. So you’ll need to download and install the latest Vbox release, 1.5.2. Click on that link to download the .deb file. Save it on your desktop and then double click on it to install it.

For a quick and easy tutorial on using Virtualbox and installing a virtual XP instance, see UbuntuGeek.

Once you have your virtual XP machine running on your Gutsy host, it’s time to do a wee bit of hacking. Turn of your XP instance and let’s roll up our sleeves and get to work.


First, open a terminal session (Applications-> Accessories-> Terminal) and type in the following to edit a script file:

gksudo gedit /etc/init.d/mountdevsubfs.sh

Once you’ve got that open in Gedit, type CTRL-F to search for a string. Search for ‘magic’ (sans quotes).

That should bring you to this:

#
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb

All those pound signs are comments. Remove them from the last four lines so you end up with this:

#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Save the file and exit Gedit. Round one goes to the user!

Now we’re going to create a group called usbusers. Go to System-> Administration-> Users and Groups. Type in your password and then click the Manage Groups button. From there click the Add Group button and name it usbusers. Check off your username below. Exit these windows and round two goes to us.

groups.png

Now we’ve got to change a file in udev. So, let’s gedit it and gedit over with. I’ll apologize for the bad jokes in a later post.

gksu gedit /etc/udev/rules.d/40-permissions.rules

Again, CTRL-F to bring up the search dialog and search for ‘usbfs replacement’ (again, sans quotes). Once you find it, you should be looking at this:

USB devices (usbfs replacement)
SUBSYSTEM==”usb_device”, MODE=”0664″

You’ll want to change it to this:

# USB devices (usbfs replacement)
SUBSYSTEM==”usb_device”, GROUP=”usbusers”, MODE=”0664″

Save your file and exit out of Gedit.

Now, the last bit of hackery which may or may not be required for you. It was for me. We’re going to add a mount to /etc/fstab for usb devices using usbfs.

gksudo gedit /etc/fstab

At the bottom, add the following line:

none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

Save the file and exit Gedit. Phew! Now, the easiest way to get all of these changes working on your system is to restart it. So go ahead and do that and then I’ll see you back here in a few.

Back? Great. Time to plug in your USB device, whether it’s a thumb drive, an iPod or something else, plug it in and let Ubuntu detect it.

Now, we’re going to open up Virtualbox and make some changes to your XP machine BEFORE you start it up. So go to Applications-> System Tools-> Virtualbox and get it started up.

Highlight your XP machine (if it’s not the only instance of a virtual machine) and click the Settings button at the top of Virtualbox. You should now have a USB option on the left hand side of your settings. Click the add icon on the right hand side (see the pic below) and select the device from the list. In my example, it’s a 512MB memory key. Now click the Okay button.

vboxaddusb.png

Start up your virtual XP machine and you will see a notice pop up courtesy of Ubuntu about unsafe device removal. Nod your head sagely and let’s continue on. Once XP is up and running, it should automatically detect the new USB device, and do it’s best to install it. With my memory key, it was as simple as turning the virtual XP machine on and letting XP take care of it.

You may have to go to the Devices menu on your virtual machine (once it starts up) select USB Devices and then uncheck whatever it is you’re trying to mount.  Repeat the process, this time checking it off and it should mount if it didn’t automatically.

Technorati Tags: , , , , , , , ,

Click the icon, share the link:
  • Digg
  • del.icio.us
  • MisterWong
  • Furl
  • Reddit
  • Technorati
  • BlinkList
  • feedmelinks
  • PopCurrent
  • Blogosphere News
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1980 posts on ArsGeek.


Contact the author

56 Comments For This Post

  1. jon Says:

    It’s been two or three months since I had to make usb work in Virtualbox but the only thing I remember having to change was fstab.
    I got my answer from ubuntuforums.org
    I’ll try and get it working again and report back.

  2. Taffy Says:

    This has been my first attempt at using VirtualBox, everything but my USB worked out-of-the-box. I’ve struggled for a day, using the user manual and the forum. I came upon this article, followed it and voila, it works. Thank you for your efforts here, this old, non geek is extremely grateful.

  3. arsgeek Says:

    Taffy,

    Glad I could help. I know how frustrating it can be to come up against something like this - my aim is to make these solutions accessible and easy to follow.

  4. scribe Says:

    Thanks for sharing this. I sure will check it up.

  5. Vorona Says:

    I followed your explanations (very clear) and it worked perfectly (of course with the good commands to act as super-doer relatively to a different system), there wasn’t even any need to download a new VBox as the former one, which was actually one of latest version, showed immediatly the USB devices again. Quick’n clean ! Thanks for your effort. Your tutorial is linked on some posts of Ubuntu forum (french). It gave me the opportunity to discover this interesting site !

  6. arsgeek Says:

    Glad it worked for you!

  7. Gilmoth Says:

    Thanks for your clear explanation.
    At last a post that fully cover the USB support on VirtualBox.
    I’ve make an italian translation and a link to this page on my blog.
    Many thanks again for your good work.

  8. Richard Ogin Says:

    I tried your solution and it did not work successfully with the VirtualBox OSE from the gutsy repositories. This may be a recent change, but as several sites informed me, such as https://help.ubuntu.com/community/VirtualBox#head-c40d4d80c0cb00351a492592b1ddbfe95f7ee513, users now have to get the personal edition of VirtualBox as innotek removed usb compatibility (and something else that I forget) from the OSE. After installing the personal edition, everything worked perfectly following your instructions. Hopefully this will save future readers some headaches.

    Thanks for the write-up btw.

  9. revel Says:

    Great fix. Well done for working out how to do this. I have been using it to update my logitech harmony remote. Works perfectly.

  10. Neil Says:

    Well done, indeed! Now I can use my external WD hard drive with VBox. Thanks for the clearly written and very useful fix for an annoying problem.

  11. Elias Says:

    Great tutorial, dude!
    Thanks!

  12. G2g591 Says:

    Thank you very much, now I can finally print with out rebooting into windows (damn Lexmark for poor linux compatability)

  13. linuxnwannabe Says:

    great instructions. Always have a headache trying something new. No headache this time. Gutsy Gibbon os.
    Good Job two thumbs up.

  14. MartBerlin Says:

    thanks for this, it helped me, after days of struggle, but not 1:1 as on my system there is a mtab with different settings on mounting usbfs, so the mounting-command in fstab was disregarded because it was allready busy (i guess mtab will be executed before fstab, which i did not know it existed at all). After all i recognized on xp in the box, that obviously it is only USB 1.1, which is too slow for a dvb-t-stick or to play a video from a usb-hd:-(. Anyway, this site was of great Help, i wouldn’t have found and solved the Problem with script. THANKS a lot!

  15. Manish Says:

    Absolutely great. Your work is appreciated. Thank you so much,

  16. SparticusCat Says:

    Thanks Alot!! Its people like you who are moving open source to eventually be dominant. Nice Job!

  17. Alex Says:

    great job. really needed this.

  18. Carl Branstetter Says:

    I just wanted to thank you so much for a clear and workable solution.
    Got my Dacal CD library to work without a hitch. Now with my VirtualBox XP I’ll never have to boot XP again–I hope.

  19. Swâmi Petaramesh Says:

    Excellent and very useful post. Thank you ! It works plain good.

  20. Akshat Says:

    Thanks
    A brilliant post!
    I wonder why this isn’t the default behaviour of the application

  21. anon Says:

    perfect

  22. Thave Says:

    Hi all
    I tried this procedure but I could not see usb device in my windows box. I am running ubuntu 7.10 32 bit in a tecra laptop. Please help me out

    Thanks in advance

  23. Ogobongo Says:

    Thanks!
    That worked fine for me, too!

  24. Patrick Kraaij Says:

    Doesn’t work for me neither.
    When I click ‘Settings’, the USB section doesn’t appear.

    You are saying that I have to uncheck my username on the group ‘usbusers’, isn’t that strange?

    Can you help me out?

  25. statto Says:

    I haven’t had success with this either (USB doesn’t appear in settings), though I noticed my version was 1.5.0.

    I tried to install the new version but it won’t let me. I’m guessing it’s because I need to remove the other version first, but then I’ll lose my XP installation.

    Decisions decisions.

  26. cmetcjr Says:

    Statto:

    Your XP install should remain intact if you simply uninstall. Your settings and harddrive images will still be in /home/USERNAME/.VirtualBox

    (I am assuming you are using linux, since you are talking about an XP install. I suppose it is also possible that you are using a mac…)

  27. Hannes Nortje Says:

    Thanks this worked great and solved a lot of problems.

  28. Olivier Says:

    I have followed this tutorial and this is what happened:

    I have made all the changes stated in this tutorial and when I want to modify the settings in virtualbox I get these error notifications:

    “Failed to load the settings of the virtual machine windows XP”

    The host DVD drive named ‘/dev/cdrom’ could not be found.

    Result Code:
    0×80070057
    Component:
    HostDVDDriveCollection
    Interface:
    IHostDVDDriveCollection {1909c533-1a1e-445f-a4e1-a267cffc30ed}
    Callee:
    IMachine {31f7169f-14da-4c55-8cb6-a3665186e35e}
    Callee RC:
    0×80004001

    Then, when I click OK, I can see the settings but USB is nowhere to be found.
    The Virtual machine still boots though and I am still able to read cd’s.

    Help, anyone?
    thx!

  29. Mark Says:

    Nice one! Worked first time. It’s a pity that the developers at Ubuntu haven’t arranged the upgrade so that old settings automatically migrate to the new regime. Is that too much to ask for something as basic as USB support?

  30. Andria LeBaron Says:

    Thank you so much for this. I did a writeup on my blog, and I linked to this article. worked like a charm for me!

  31. ark3typ3 Says:

    Thank you very much for this, It saved me an even bigger headache of trying to get an unsupported TV tuner to work outside of a Virtualized environment :)

  32. ysae Says:

    Thank you for sharing this. Just one minor addition:
    You can omit the fstab change by creating the usbusers group first and providing a group parameter for the mount in /etc/init.d/mountdevsubfs.sh like you did for the udev stuff.

    To do this just change the domount line to the following (one line, just the last parameter added):

    domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644,listgid=GID

    You have to replace GID by the group id of the usbusers group, of course. It can be found in the group settings dialog when adding or editing the usbusers group.

  33. RandyNose Says:

    Dude. This worked for me. I had found most of the other info execpt for the last line that had to be edited.

    none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

    It was frustrating, as that left the USB devices greyed out in VB, I could “see” them just not use them. So within reach, yet no cigar. A fellow Twitter Tweet gave me your link, and I’ve not added this to my RSS feeds.

    Again Thanks,
    Randy

  34. RandyNose Says:

    Oop, I ment to say I’ve now added this to my RSS feeds list…

  35. Daddy=Jacques=Bombay Says:

    Many thanks my friend.
    3 minutes ” work ” AND IT WORKS 100%
    Great stuff
    Good job
    Weldone !!!!!

  36. LiNuts Says:

    GOOD How-to! I highly recommend it! Hey I’ve tried out a lot of how-tos out there, but nothing worked to me. What really seems curious is that in fact they were not so bad at all, what they were missing i founded here! Nobody but you mentioned that I SHOULD INSTALL VIRTUALBOX PUEL VERSION(THE VERY LATEST VERSION YOU CAN FIND OUT THERE WOULD DO) I did many steps, including some of those you described here and IT’S DARN WORKING NOW! THANKS FROM SANTO DOMINGO, DOMINICAN REPUBLIC!

  37. Jason Says:

    Thanks for an excellent how-to! It solved my problem perfectly on 7.10.

    Just a quick tip you may want to add - make sure that you ‘Power Off’ the VBox machine and not ‘Save the Machine State’ or the Settings option will be unavailable.

    Thanks again,
    Jason

  38. mr Says:

    Thank u, so useful!

  39. etranger Says:

    Very well done. Many thanks…

    But pay attention to the space between NONE and /PROC/… in the command-line:
    none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

    greetings,

    etranger

  40. Sporty Says:

    Your a genius! Thanks! :)

  41. Rykel Says:

    Hi, I am using Ubuntu Hardy, but the following lines in your instruction could NOT be found on my system. Please help??

    USB devices (usbfs replacement)
    SUBSYSTEM==”usb_device”, MODE=”0664?

  42. Test Yser Says:

    I had a similar issue with VirtualBox 1.6.2 on a windows xp host and windows xp guest- my external usb drives were not being recognized by the guest. To resolve this problem, for the virtual machine (when it was powered off), in settings -> general -> advanced tab, I had to enable IO APIC and also PAE/NX. The latter option may not be available on all PCs, so try enabling IO APIC. I also added my USB drive to the filters under settings -> usb filters.

    After I did so, when I started the virtual machine, it was able to immediately recognize my external usb drive.

    regards

  43. Paulo Says:

    @Rykel: don’t worry. Just add those lines in the USB section.

    # USB devices (usbfs replacement)
    SUBSYSTEM==”usb_device”, GROUP=”usbusers”, MODE=”0664?

    It worked for me :)

  44. Paulo Says:

    @Rykel: don’t worry. Just add those lines in the USB section.

    # USB devices (usbfs replacement)
    SUBSYSTEM==”usb_device”, GROUP=”usbusers”, MODE=”0664?

    It worked for me :)

  45. Lars Says:

    Thanks very much!

    according to http://ubuntuforums.org/archive/index.php/t-541195.html the devgid in fstab must match the usbusers group id, which is 1001.

    And for Rykel: the last character is a “, not a ? :-)

    I’m also on Hardy 8.04 and it works great for my win-only-possible xerox printer!

  46. micro Says:

    Great solution! I modified a little for my needs (eg another gid) and did the stuff from the console (groupadd) and edited /etc/group by hand. No need for restart. Simply mount the new mount in fstab. BTW, I used your tips to fix the problem in my Slackware box. I had to guess the different steps. The general idea is to:
    a) add a group and the users to this group as secondary
    b) issue /proc/bus/usb proper group id permissions
    c) correct the proper devices default group ownership

    Then completely logout the relevant user, mount the new fstab addition, restart udev and possibly hal. no need to restart the machine.

  47. ea Says:

    very nice article.
    if you dont want to reboot, you can also do:
    /etc/init.d/mountdevsusbfs.sh stop and then start again
    /etc/init.d/udev stop and start the service again
    and last but least mount /proc/bus/usb.

  48. Bhanu Says:

    I have problem is mounting usbdevice in ubuntu virtual box ,host system is windows xp.

    i cannot find magic

    gksudo gedit /etc/init.d/mountdevsubfs.sh
    Once you’ve got that open in Gedit, type CTRL-F to search for a string. Search for ‘magic’ (sans quotes).
    That should bring you to this:
    #
    # Magic to make /proc/bus/usb work
    #
    #mkdir -p /dev/bus/usb/.usbfs
    #domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
    #ln -s .usbfs/devices /dev/bus/usb/devices
    #mount –rbind /dev/bus/usb /proc/bus/usb

    i cannot find this

    what i should do ?

    plz help

    Thanks in advance

  49. Bradj47 Says:

    It didn’t work for me. It’s exactly the same from before I tried all this.

  50. Will Says:

    Thank you

    That was very clear, with little techno bable. Most other sites explaining how to do this, amused you knew a lot of stuff. It works very well also.

    Thanks

  51. tsopatsopa Says:

    Thanks dude. it worked 100%

  52. IT Says:

    Thaks you very much dude!!!!!
    your awesome!

  53. Alexander Haug Says:

    Godaddy promo codes news. Several of the frequent Godaddy coupon codes are not valid. Here are latest promo codes that are activated. These coupons will save you money thru 2010 and 2011. $7.49 Domain names and renewals - Use Godaddy.com coupons OK9, ZINE10, or GOO3. 25% discount on orders of $100+ - Use Godaddy promo code OK25. 30% Discount when you buy any com domain - Use Godaddy promo code OK30. $12.99 SSL Certificates - Use Go Daddy coupon codes GOOSSL, OKSSL, or ZINESSL. Hosting Promo Code - 20% Off Hosting - Use Godaddy coupon codes OK20H, ZINE20H1 or GOO20H. 10% off any size order - Use Godaddy.com promo codes OK7, GOO1 or ZINE8. $5 Off $30 or More - Use Godaddy promo codes GOO2 or ZINE9. 20% Off Any order of $50 or more - Use Godaddy promo code OK8.

  54. Pinetop Cabin Rentals Says:

    Thanks for writing this article…. I really appreciated it!
    Pinetop Cabin Rentals

  55. Jason Says:

    This worked for me - ubuntu 9.04 with windows 7 guest, was greyed out until i checked the vboxusers group and added myself to it. Thanks for the help guys.

  56. Catherine Says:

    “Well, its quite good that I am not actually using Virtualbox XP machine, or else, this can be one of my problem. Its good that you found out this information, since this is quite helpful specially for others who are experiencing this problem.

7 Trackbacks For This Post

  1. Support this story on Stirrdup Says:

    Get USB devices mounted on your Virtualbox XP machine in Gutsy (Ubuntu 7.10)

    This story has been submitted to Stirrdup. Your support can help it become hot.

  2. Apple Ipod, Ipod Nano and Ipod Video News » Get USB devices mounted on your Virtualbox XP machine in Gutsy (Ubuntu 7.10) Says:

    [...] ã??ã??ã??ã?®ç·¨é??å¾?è&… wrote an interesting post today onHere’s a quick excerpt [ vbox.png]There’s nothing more frustrating than not being able to mount your USB devices in your virtual machines. Well, maybe there are lots of things that are more frustrating but this morning my inability to do something that should be simple, easy and fun was driving me nuts. So I figured out how to do it [...]

  3. ::A Geek in Korea:: » Blog Archive » My Week in Ubuntu: Finally. Says:

    [...] Second: Enable USB support for VirtualBox. I followed this guide. [...]

  4. Suprablog HQ » Review: VirtualBox Says:

    [...] was a bear, due to mapping of the USB drives. I found this site linked on the Wikipedia article: Get USB devices mounted on your Virtualbox XP machine in Gutsy. So thanks to the nice people there, and following their well-defined instructions, I was able to [...]

  5. ZenLinuxNH Blog » Blog Archive » Using the Garmin Edge 305 and VirtualBox Says:

    [...] to set up the USB system requirements that VirtualBox needs on Ubuntu Gutsy, you need to follow this guide. It will walk you through creating a separate group for USB access and enabling the usbfs support [...]

  6. How to: Make the USB Ports Working in VirtualBox using Kubuntu Hardy Heron | Ubuntu Site Says:

    [...] said, let’s get started. This is actually a modified version from arsgeek.com on how he made the USB ports mounted in Windows XP. Windows XP is the guest OS in his Ubuntu Gutsy [...]

  7. USB in VirtualBox on Gutsy « 0ddn1x: tricks with *nix Says:

    [...] USB in VirtualBox on Gutsy Filed under: Linux — 0ddn1x @ 2008-10-17 14:42:14 +0000 http://www.arsgeek.com/2007/10/24/get-usb-devices-mounted-on-your-virtualbox-xp-machine-in-gutsy-ubu... [...]

Leave a Reply