Make VirtualBox USB Support Work in openSUSE 11.4

1 minute read

VirtualBox and its USB support always have caused some trouble. Since VirtualBox 4, the USB support is not part of a different binary any more (PUEL vs. OSE), but lives inside an extension pack, which you can download from the VirtualBox download site.

On openSUSE, this means you can install the VirtualBox package using Yast (or zypper, or whatever you'd like to use) and then open VirtualBox, go to File > Preferences > Extensions, click the top "Add package" button, select the downloaded file and you're done.

Well, almost done. After you add a USB device filter to your VM and boot it, you'll notice that all entries in the Devices > USB menu are grayed out.

Reason for this is a permission problem. Usually, VirtualBox installs a udev rule that gives all users in the vboxusers group permission to access all USB files. openSUSE chose to disable this udev rule by default for security reasons without visible notice to the users.
So, to cut a long story short, open /etc/udev/rules.d/60-vboxdrv.rules, and replace the lines that are commented out with the ones below (these are almost like the commented-out lines, but replace NAME with SYMLINK+):

KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
#these two lines give access permission to vboxusers to properly work with usb nodes, this could be security risk (bnc#664520) !!
SUBSYSTEM=="usb_device", ATTR{devnum}=="?*", ATTR{busnum}=="?*",SYMLINK+="vboxusb/$attr{busnum}/$attr{devnum}", GROUP="vboxusers"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{devnum}=="?*", ATTR{busnum}=="?*",SYMLINK+="vboxusb/$attr{busnum}/$attr{devnum}", GROUP="vboxusers"

Now reboot and you should have all USB devices available (at least if you're in the vboxusers group, check this with the id command in a terminal window).

And while you're at it, please ignore forum posts that modify usbfs or anything like that, newer VirtualBox versions don't need these things any more.

If you only have a 10-vboxdrv.rules file, then you most likely installed VirtualBox not from the openSUSE repositories, but from the VirtualBox download site. Remove this version first and install the openSUSE version if you want to use this guide (and save you from recompiling the kernel module with every update).

(Post updated on 2011-08-15 to incorporate some user comments. Thanks guys!)