Virtual Box USB tips

Adding USB Devices in Virtual Box

USB support is currently only available in the .rpm downloaded from Sun. Downloads - VirtualBox

Once Virtual Box is installed, make sure you are in vboxusers. Either with the following in konsole:

groupmod --add-user <login_name> vboxusers

OR: Or open YaST -> Security and Users -> UserManagement, and edit your user and add them to the vboxusers group.
http://thumbnails18.imagebam.com/3268/04774532673006.gif](http://www.imagebam.com/image/04774532673006/)

I am editing this post because USB now works ‘Out of the Box’.

Adding yourself to the vboxusers as quoted above remains true.

To use a USB device - Simply plug it in, launch Virtual Box but not the machine. Select the machine and then it’s USB settings and add. When you click add it will show you a list of available devices on your SUSE host, select what you require and proceed to start the Virtual Machine.

Hi
Excellent howto :slight_smile: I do have one question with regard to the usbfs
entry. Does it not work by just changing the noatuo to auto?

The reason I ask as I use my GPS and to get it to work in nema mode
with gpsd, I just change this rather than deleting. I was wondering
of the impact with other similar devices and using virtualbox.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 (i586) Kernel 2.6.27.21-0.1-pae
up 1 day 17:47, 1 user, load average: 0.16, 0.14, 0.13
ASUS eeePC 1000HE ATOM N280 1.66GHz | GPU Mobile 945GM/GMS/GME

@malcolmlewis
I’ll look in to it, but it may be tomorrow before I can try.:slight_smile:

as user root
For VirtualBox 2.2.0 on OpenSUSE 11.1 you should add the following to /etc/fstab and delete any other lines with usb:
Place your user ID in place: eg;devgid=112
Code:

/sys/bus/usb/drivers /proc/bus/usb usbfs devgid=XXX,devmode=664 0 0

Nice howto. Where in the VirtualBox stuff does it state this step is required? For 11.0 maybe, but it shouldn’t have been needed since version 2.1.4 and I have installed that and 2.2.0 on 11.1 without any mod to fstab and so have others. It should work with the default usbfs statement. Maybe you know of a particular usb device it’s needed for?

The HOWTO is very nice but many people have tried the above solution and USB still wouldn’t work for them. I do not have the fstab edits that are recommended and USB just works in VirtualBox 2.2.0 (and 2.1.4) for me.

The thread, Sun Virtual Machine - openSUSE Forums, has a long discussion about this problem. The solution might have been found by hank_se, and clarified for me by consused, if you read well into that series of posts. The files /etc/udev/rules.d/60-vboxdrv.rules and /etc/udev/rules.d/10-vboxdrv.rules are the bad actors, apparently, particularly if both files are present.

I only have the 10-vboxdrv.rules file. As I said, USB just works.

I hope someone will find this helpful.

I forgot to post the only usb related line, from my fstab.

usbfs  /proc/bus/usb  usbfs  noauto  0  0

I would like to than everyone for their comments so far. It does seem that there are differing experiences and levels of success with USB support. The HowTo can and will be edited if required. Actually my intention was to focus on the steps of adding the device to the VM and the need to have the device removed when actually starting the machine, connecting it only when the VM is up and running. That is my experience anyway. I find the VM locks up at startup if the USB device is connected already.

All comments and criticisum welcome. Thank you.

Hi
Very true about udev rules, positioning is a big issue. In getting the
barry utilities (blackberry) to work as a user I needed to move the
default rule to 65 as it was at 10 as well as some rule tweaks…


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 (i586) Kernel 2.6.27.21-0.1-pae
up 1 day 22:23, 2 users, load average: 0.07, 0.10, 0.03
ASUS eeePC 1000HE ATOM N280 1.66GHz | GPU Mobile 945GM/GMS/GME

I’m sure I read about that problem with some device or other, but luckily I haven’t experienced it with usb sticks. On 11.1/kde 3.5, I plug it in before starting virtualbox, pick it up with the vm’s usb filter setting, start up the vm that captures it, and finally the guest os (openSUSE 11.1 gnome) mounts it. On shutting down the vm, 11.1 gets it back with the normal pop-up requesting action - all very smooth. And I’ve repeated the test hundreds of times over the last couple of weeks. I have also had success with a Zoom guitar effects processor, but no printers where trouble has been reported. Good luck, you could end up with a big howto and lots of comments;).

Good How-To. Appreciate your effort. I’ve been able to use USB with virtualbox for quite a while now. However, the only issue I have is, usbfs is not being mounted automatically at boot-up. So, after boot-up, if I run mount -a as root and then run VirtualBox (as user), usb support is enabled. If I forget to execute mount -a manually, usb support is disabled.

Here is the line from my fstab. Anyone know how to change it so that it is automatically mounted at boot-up?

/sys/bus/usb/drivers   /proc/bus/usb   usbfs    auto,devmode=664,devgid=119   0 0

Thank you

(Although I prefer to only mount usbfs via boot.local, which is IMHO the cleaner solution)

I seems we are all experiencing different results, I suppose that had to be the case, just to make it fun.:wink:

I have taken the various steps to implement all the suggestions:
ie;

  1. That it just works - No changes needed. (Not for me)
  2. @malcolmlewis - Does it not work by just changing the noatuo to auto? (No)
  3. @thisoldman - I only have the 10-vboxdrv.rules file. (So do I - But no go)

etc…

So to sum up. The HowTo I posted works for me. But it appears some users find that not all the steps therein are necessary. But what we don’t know is; If USB would still work if you HAD followed all the HowTo?
Not suggesting you mess with your already functioning sys like I did. But hopefully this info will help users (If they read it all).

Thanks for all the contributions!

Not surprising, because that is just what VirtualBox 2.1.4 or 2.2.0 provides you with normally and it obviously didn’t work for you as you had to modify fstab;).

However, the thread that I was involved in with hank_se, implied renaming that file in /etc/udev/rules.d/ (mv 10-vboxdrv.rules 60-vboxdrv.rules), in the situation where a clean install of VirtualBox 2.1.4 or 2.2.0 only has usb working for root and not a normal user. That has since been supported and clearly asserted by a recent poster to that thread. However, since my 11.1 system already works without mods, I was unable to verify it.

To give each of the “works for me” fixes an equal and reliable test, requires a clean install i.e. remove all debris from a previous version, including ~/.VirtualBox where many users have their machine settings (it’s the default), so actually doing it is tedious. I would suggest therefore that this is not always done, and that may account for the disparate experiences and solutions:.

Thanks for this helpful information @consused
Your reasoning does indeed make sense. I suppose a level playing field is too much to be hoped for. We’ll have to be content with a swap shop of experiences, at least for the time being. Virtual Box does seem to be making good progress. Perhaps soon we will see something a little less contrary.

So give up you don`t know what your doinglol!

Loser :wink:

Mike

Good luck again

Mike: I’m not sure what you imply here. But it could be seen in a rather negative light.
@Akoellh is a valued contributor here with considerable experience.

Yes, and I have returned here to confirm just how “contrary”. Of course it is possible that in a series of many repetitive tests of clean installs of 2.1.4 and 2.2.0, I could have missed a reboot or removal of previous settings, but I don’t think so:|. My system just worked for usb - no mods required.

Not anymore:O. Not for 2.1.4 and 2.2.0 from the most recent clean install. @hank_se will be pleased. Never mind - I hear you say - there are at least 3 solutions to choose from. Agreed, and I used the easiest one, and it works. Possibly a recent openSUSE update caused it to revert. But I don’t like mysteriously inconsistent systems:confused:.

Just to provide my update as well for everyone’s benefit if they are missing something silly like me.

I was trying all the steps after having installed OSE version, then realized that USB is not supported there :’(, installed the version with the personal user license and then it works, none of the steps were required.

I am using the latest version 2.2.4 version on 11.0.

I’ve installed VirtualBox 3.0.12 on my Lenovo 3000 N100 running a new installation of openSuse 11.1. I’ve built an XP VM and upgraded it to SP3. Can’t get my USB flash drive to be mounted on the guest OS. (Installed using: VirtualBox-3.0.12_54655_openSUSE111-1.x86_64.rpm)

I’ve tried all the solutions suggested here and nothing seems to work. This was my experience:

-followed the steps in post#1. This didn't work: when I re-insert the USB flash drive after starting the guest OS (XP), it's still mounted by the host (11.1) and shows "not available" in the guest.

-re post #5 (rules.d): I have only 10-vboxdrv.rules, no second vbox rules entry.

-re post #9:tried following the steps with no luck: when I re-insert the USB flash drive after starting the guest OS, the host (11.1) captures it.

-per post#10, tried:

linux-oe0e:~ # mount -a
linux-oe0e:~ # mount
/dev/sda6 on / type ext3 (rw,acl,user_xattr)
/proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
udev on /dev type tmpfs (rw
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/sda7 on /home type ext3 (rw,acl,user_xattr)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
securityfs on /sys/kernel/security type securityfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
gvfs-fuse-daemon on /home/eric/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=eric)
/sys/bus/usb/drivers on /proc/bus/usb type usbfs (rw,devgid=1000,devmode=664)

This resulted in ff error message when I started VirtualBox:

You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. We strongly recommend that you change this, as it is a severe mis-configuration of your system which could cause USB devices to fail in unexpected ways.

This is what my fstab looks like:

/dev/disk/by-id/ata-TOSHIBA_MK8034GSX_X6OFT2AQT-part5 swap swap defaults 0 0
/dev/disk/by-id/ata-TOSHIBA_MK8034GSX_X6OFT2AQT-part6 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/ata-TOSHIBA_MK8034GSX_X6OFT2AQT-part7 /home ext3 acl,user_xattr 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
#usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/sys/bus/usb/drivers /proc/bus/usb usbfs devgid=1000,devmode=664 0 0

I would like to see the ff clarified in this how-to:

  1. When people refer to a “clean install” of VirtualBox, does that mean I have to rebuild my whole guest OS (2 days’ work with all the updates) as well, or can I export that and re-import it when I’ve re-installed VirtualBox?

  2. Why does the recommended usbfs line in the fstab lead to the noted error message?

@SuseNeo, Given this howto was not the latest experience with 11.1 and VirtualBox, did you read this thread here post #10 onwards (and other threads before it).

Also, the clean install you mentioned never required a rebuild of guest OS in the .vdi and you can pick em up from the new VirtualBox’s setting menus. :wink: