Data Centers

How to enable USB in VirtualBox

If your data center relies on VirtualBox and your virtual machines rely on USB, you've probably noticed that USB doesn't work unless you enable it. Here's how to do that.

If there's one thing that frustrates VirtualBox users more than anything, it's that USB doesn't work out of the box. No matter how much we'd all like this to to be the case, with every new iteration, the developers continue to keep USB out of the long list of things that just wor.

Why would you want or need USB working with VirtualBox? What if you want to backup data to an external drive, or transfer data between virtual machines that aren't on the same subnet? For such instances, having the ability to easily share data via USB could make VirtualBox a significantly easier VM solution.

For those that need USB working on VirtualBox, I'm going to walk you through the process of getting this working. I'll be demonstrating on VirtualBox 5.2 running on an Elementary OS host (based on Ubuntu). The process isn't really challenging, you just have to know what to look for.

SEE: Special report: The cloud v. data center decision (free PDF) (TechRepublic)

With that said, let's take care of this.

Installing the latest version of VirtualBox

The first thing we want to do is make sure to install the latest version of VirtualBox. To do this, remove the current version with the command:

sudo apt purge virtualbox

Once that completes, add the necessary repository with the command:

sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian <UBUNTU-RELEASE> contrib"

Where UBUNTU-RELEASE is the version of Ubuntu you are using. If you're unsure which version of Ubuntu you have installed, issue the command lsb_release -a.

Next, download and install the signature key for the repository with the command:

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

Now we can install the latest release with the following commands:

sudo apt-get update
​sudo apt install virtualbox-5.2 dkms

Install the Extension Pack

The first thing that must be done is the installation of the VirtualBox Extension Pack. There is a catch here. The open source Extension Pack only supports USB 1.0. If you need USB 2.0 or 3.0 support, you must install the closed source version, released by Oracle. To get the Oracle version, head over to the Downloads page and download the file for All supported platforms. Once that has downloaded, open up VirtualBox and do the following:

  1. Click File | Preferences
  2. Click the Extension tab and then click the + button (Figure A)
  3. Navigate to where you saved the Extension Pack
  4. Select the Extension Pack and click Open
  5. When prompted, click the Install button
  6. Scroll through the EULA and then click I Agree
  7. Type your sudo password
  8. Allow the installation to complete

Figure A

Figure A

Installing the Extension Pack via GUI.

vboxuser

There is one final step for this. In order for VirtualBox to have access to the USB subsystem, the user running VirtualBox must belong to the vboxuser group. To do this, open up a terminal and issue the following command:

sudo usermod -aG vboxusers <USERNAME>

Where USERNAME is the name of the user.

Once the command runs, logout and log back int.

Activate USB support

Open up VirtualBox, right-click on the virtual machine that needs access to USB, and click Settings. In the VM settings window, click USB. You should see that USB is now available. Click on the + button under USB Device Filters to add a new device (Figure B).

Figure B

Figure B

Adding an attached USB device to the Virtual Machine.

When you start up that VM, it will now have access to the USB device. If you need to give it access to more than one USB device, go back into the Settings window of the VM, click on USB, and add the next device. Repeat that until the VM has access to all necessary USB devices (Figure C).

Figure C

Figure C

A Kubuntu VM with access to USB.

A bit more usable now

Congratulations, VirtualBox is a bit more usable now. You no longer have to jump through hoops to get data from an external device to your VMs (or vice versa). Your data center will thank you for it.

Also see

Image: Jack Wallen

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox