Adding USB Devices in a Windows Virtual Machine with VirtualBox
One of the most confusing things for me when I first experimented with VirtualBox was the question of how to add USB devices. I run Linux (Ubuntu) as my main OS now, but sometimes I need to dig around in Windows (e.g. work related stuff) so for those cases I run it in a virtual machine. I recently needed to add a data acquisition device for use in the virtual machine on Windows, so I thought I’d document the procedure here.
You need to have VirtualBox installed on your machine, and a Windows virtual machine set up. I am going to run Windows XP in a virtual machine on Ubuntu in this tutorial.
You also need Virtual Guest Additions installed in the virtual machine to enable the USB support, amongst other things. If you’re confused about this aspect, there is plenty of information available if you ‘google’ it.
Sorting out the Group Permissions
The only reason that USB support is confusing at all is that you need to add your user to the VirtualBox group before any USB devices will show up for use. VirtualBox doesn’t offer any other useful information; it just complains that there are no available devices. The problem is that VirtualBox is not allowed to share your USB devices, so the next steps will fix this.
First you need gnome-system-tools. Run the following command in a terminal to install it:
sudo apt-get install gnome-system-tools
Now go to the dashboard and type ‘user’. You should see an icon for Users & Groups appear. Select it, and the following window will appear:
Select ‘Manage Groups’. The following window will appear:
Scroll down to ‘vboxusers’ and then select ‘Properties’. The following window will appear:
Make sure your user is ‘ticked’. It probably won’t be by default. Then select ‘OK’.
Now USB should work. But you have to log out and back in again first. You should do that now. When you log back in, open Virtual Box and select the settings for your virtual machine. Select the USB settings, and make sure USB is enabled. Now you just need to add the USB device you want to use in your machine. Make sure it’s connected to your computer, and then select the ‘add’ button. I’m going to add my National Instruments DAQ device:
Now, when you start your virtual machine, Windows should detect new hardware and install it for you:
Finally, when it’s done, you can test out your hardware. I am using a DAQ device so I started the software for it and captured an analog signal 🙂
That’s it, you’re done. Any time you need to add more USB devices, you can add them to your virtual machine in the same way.