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.