Karmic Update: and VB 3.08: All you need to do is add Virtualbox permissions to your user under users and groups….bout time!
EDIT: With Ubuntu 9.04 and VirtualBox 3.x.x, none of the following is necessary other than adding yourself to the vboxusers group. Hallelujah !!
Update: I’ve just installed VB in Linux Mint 6 Xfce (8.10) and I lined through the items below that are no long needed with Ubuntu 8.10 and forward. The rest will do the trick:
The purpose of this how-to is to get usb devices, such as printers, working in a VirtualMachine Windows environment in Ubuntu/Kubuntu. Without usb support, a virtual machine is really only good for testing, and not production.
First off, if you haven’t done so already download and install the non-free version of VirtualBox 3.x.x (no dinero, requires accepting license agreement) from here: VirtualBox 3,0
I did this in Kubuntu 8.04 RC, but below is for Ubuntu 8.04. This is written to apply to Gutsy, Ubuntu 7.10 also.
Go through the new VM set up routine in VirtualBox and install, let’s say XP in VirtualBox.
Here’s how I got usb devices working in an XP Virtual Machine in Hardy (8.04).
Add yourself to the group VirtualBox created during install called “vboxusers” The VB install creates this group, find it, don’t add another one.
Create a group named “usbusers” and put yourself in it.
sudo groupadd usbusers
sudo gpasswd -a john usbusers
Or do the above in Control Center under ‘users and groups’.
Now uncomment the 4 lines below ‘Magic to make /proc/bus/usb work’ in mountdevsubfs.sh , they will be commented out by default) so it looks like the following:
sudo gedit /etc/init.d/mountdevsubfs.sh
#
# 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
Now then,
Modify the rules in file “/etc/udev/rules.d/40-permissions.rules” for Gutsy, and “/etc/udev/rules.d/40-basic-permissions.rules” for Hardy:
Change the lines :
From:
# USB devices (usbfs replacement)
SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, MODE=”0664”
SUBSYSTEM==”usb_device”, MODE=”0664”
To :
# USB devices (usbfs replacement)
SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, GROUP=”usbusers”, MODE=”0664”
SUBSYSTEM==”usb_device”, MODE=”0664”
Now on to……
The Grande Finale,
add this line:
none /proc/bus/usb usbfs devgid=120,devmode=664 0 0
to your /etc/fstab file (at the bottom). Just make sure that 120 is your vboxusers group (use your own number).
Reboot the computer.
Open VirtualBox and click on “Settings”.
Click on the “USB” item in the left pane to edit the USB prefs.
Click on the “Add device” button to add a filter and select your printer from the list and click on the “Ok” button.
Start your VM and Windows should detect your printer.
The above was taken mostly from various scattered posts in the Ubuntu forums, some from me, and put together here, all mods in one place, in order, for future reference.
Comments and/or edit recommendations welcomed.
June 1, 2008 at 5:13 pm |
Thank you! It works! I have spent many hours without any luck till I see this post. Shame on virtualbox developers, the should write this manual or make use /dev/bus/usb instead of usbfs.
June 1, 2008 at 11:57 pm |
Good point, and thank you for your comment.
June 11, 2008 at 12:48 pm |
In Hardy, the “From” lines:
# USB devices (usbfs replacement)
SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, MODE=”0664”
SUBSYSTEM==”usb_device”, MODE=”0664”
do exist, but they’re in 40-basic-permissions.rules rather than 40-permissions.rules
June 12, 2008 at 12:38 am |
Thank you! I’m going to look that over again when I get a chance!
June 19, 2008 at 11:30 pm |
Thanks Ian….change tested and noted for Hardy:
Modify the rules in file “/etc/udev/rules.d/40-permissions.rules” for Gutsy, and “/etc/udev/rules.d/40-basic-permissions.rules” for Hardy:
June 25, 2008 at 11:56 am |
Wow! It really works!!! Ubuntu 8.04 + LaserJet 1320 Thx a lot! It was really a peace of magic. =)
July 8, 2008 at 8:08 pm |
Has anyone had this work with an iPod and iTunes? I’m getting an iPhone2 on Friday, and the only machines I own with a USB 2.0 port run Linux (my three macs all have USB 1.1). I was hoping to get around installing windows directly on any of my machines (it’s been 2 years since I have had windows installed directly, and I’d really like not to go back). Do I stand a chance of using this as a way to work with my iPhone without installing windows, or waiting for syncs at 11mbit/s
July 9, 2008 at 9:57 am |
I think that it probably will work. I haven’t tried though, even though I own an iPod Video. I sync it with Amarok. I did try to sync my Blackberry in an XP virtual machine, XP recognized the BB fine, but BB desktop manager couldn’t identify the BB handheld. That may have been my fault. Give it a go, and let us know!
July 18, 2008 at 3:53 pm |
I tried this with Ubuntu 8.04 and iTunes and a 5th Gen Video iPod. These steps worked perfectly for me and everything is working great. Thanks again!!
July 18, 2008 at 4:09 pm |
That’s good to know as I myself have an iPod video. thanks for the post !
August 31, 2008 at 12:13 am |
Hi Huntsville,
How did you get iTunes and IPOD to work? This does not seems to work for me, even though USB seems to be working. Do you have any other info about this? Thanks.
September 6, 2008 at 1:29 am |
This helped me in Intrepid too. Thanks for the useful post.
September 13, 2008 at 12:13 am |
thanks – this worked for a samsung e900 phone in xp under hardy
September 20, 2008 at 5:53 pm |
I am using Hardy 8.04.1. Virtual Box 2.0.2. I was having trouble make flash drives show up under winxp. The printer was working but flash drives were not. They showed on VB usb icon but were grayed out.
I had followed several other post so did not need all the steps but it was good to check them.
Step 1 added user/groups used gui to help me.
Step 2, I must have already made magic line visible did not need to do any thing. (Some one might not know how to read the file if a line is commented out so might explain that for them.
Step 3 was easy. I did do apt-get install gedit to use it in place of VI for step three.
My virtual box was user 121 but the user gui helped with that also.
I did not need to add filter under VB 2.0.2 just right click on the usb icon and add check mark for the usb device that I wanted added. Did need to reboot XP for flash drive to work.
Thank you so much for the nice post. It just worked for me and now I can move files and print when needed. Great Work.
October 30, 2008 at 4:35 am |
Please do not claim that you can write in English! I read it 10 times and still cannot understand what you are trying to say….
October 30, 2008 at 11:32 am |
A Russian didn’t have any problem with it?
Tell me what it is that’s not clear, please and I’ll change it.
November 9, 2008 at 11:35 pm |
Thank you !!!
December 15, 2008 at 10:54 pm |
Thank you for writing such a clear and easy to follow guide. Unfortunately I cannot get my system to work. I have checked, and re-checked all the files you mention
mountdevsubfs.sh
40-basic-permissions.rules
fstab
I also have the usbusers group created with my login as a member. All are correctly entered. I am farther than before. Now, all of my USB devices show up in VirtualBox in the little icon, but they are all GREYED out.
I have Ubuntu 8.04 as the host. VirtualBox 2.06 as the software and WindowsXP SP3 as the guest OS. I have the 2.06 additions installed.
Any further help would be greatly appreciated. Thank you.
January 13, 2009 at 9:56 am |
Thanks!
After much googling I got the guide at http://www.ubuntu-unleashed.com/2008/04/howto-install-virtualbox-in-hardy-heron.html .
It seems they missed a step or 2.
Yours was what worked…btw …I have Sun VirtualBox 2.1.0 running on a Ubuntu Hardy Host and with an Win XP SP3 guest.
Thanks again!
January 13, 2009 at 11:38 pm |
You’re welcome….actually, that was what started this blog….nowhere could seem to get the instructions right so I took it on myself
March 27, 2009 at 3:22 pm |
[...] ici. Partagez [...]
August 30, 2009 at 7:13 pm |
Has anyone had _any_ luck with iPod shuffles and Windows XP SP3?
I have a client that has a ipod shuffle and yet I have not been able to get it to work no matter what I do. I tried this and several other items on the virtualbox forum and still can not get it to work. If you have any more advice or input I would greatly appreciate it. Thanks!
August 31, 2009 at 5:51 pm |
Thank you!
Connected my Nokia e65 this way!