Page 1 of 1

[Solved]USB only working for some devices, others greyed out

Posted: 13. Jul 2009, 12:16
by virtual_ulm
I'm working on a Linux (RHEL 5.3) host, Vista guest, VirtualBox v3.0.2.

USB works fine for some devices, for example my camera. However, some devices (for which also filters exist), stay grayed-out ("State: unavailable") in the device selection list of the running VirtualBox.

Now, the manual says that VirtualBox can only work for drives that are not "claimed" by any linux driver. When I consult "/proc/bus/usb/devices", I see that the driver listed for my working camera is "none", and "usb-storage" for example for my non-working-in-VirtualBox USB stick.

Could this be the cause of the problem? If yes, how can I prevent a driver from claiming a certain USB device?

Thank you for any hint! If I need to post additional information, please tell me so.

Chris

Re: USB only working for some devices, others greyed out

Posted: 13. Jul 2009, 15:27
by hank_se
Although they are not exactly the same systems, but probably close enough, there is a solution for Fedora 11 that might work for RHEL, they are related after all.
The problem is that your system mounts usbfs under /proc/bus/usb, this is deprecated and should not be used for newer systems. If VirtualBox finds it mounted it falls back to old deprecated code, if not it will run newer code and probably your usb devices will work right out of the box. Look if you have the following file on your system: /etc/rc.d/rc.sysinit. Look if you have the following lines in it:
if [ ! -d /proc/bus/usb ]; then
modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb
else
mount -n -t usbfs /proc/bus/usb /proc/bus/usb
fi
If you have them comment them out like this:
#if [ ! -d /proc/bus/usb ]; then
# modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb
#else
# mount -n -t usbfs /proc/bus/usb /proc/bus/usb
#fi
Now take care editing that file, one typo and you will be on your own with a locked up system, I don't have access to a RHEL system.
See here what can happen:
http://forums.virtualbox.org/viewtopic.php?f=7&t=19536

If you decide to try it reboot and see if it works.

Re: USB only working for some devices, others greyed out

Posted: 14. Jul 2009, 00:27
by virtual_ulm
@hand_se, thank you very much for the qualified answer!

I have the code-piece you mention in my CentOS/RHEL 5.3 file /etc/rc.d/rc.sysinit So I guess you are right, VirtualBox falls back to old cold automatically.
However, I feel not confident tinkering with init-scripts, so I opted for the following solution:

As suggested in this forum I execute the following code as root:
umount /proc/bus/usb
mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664

This has the effect that the /proc/bus/usb filesystem is re-mounted with the proper options, and until the next reboot, USB-devices work in VirtualBox-Vista-guest.

(Of course the number given at devgid is the group ID of group "vboxusers".)