Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Being as we've had so many questions here about getting USB to work with VirtualBox I've knocked up this script to check the configuration. It tests OK on my system. Any volunteers to test it? It can be run without any special privileges.

EDIT: only the PUEL versions of VirtualBox have USB support; the OSE versions do not; the script attempts to identify the version in use and reports an error if the OSE version is found.

[radar@msi-k8t ~]$ ./vbox_usbtestv2.sh
VirtualBox PUEL version found. OK
Name of user used to run VirtualBox: radar
usbfs line found in /etc/fstab. OK.
Here is the usbfs line from /etc/fstab: none /sys/bus/usb/drivers usbfs devgid=505,devmode=664 0 0
devgid (505) from usbfs line in /etc/fstab found in /etc/group. OK.
Here is group 505 from /etc/group: usb:x:505:radar
User (radar) is in usbfs devgid group (505). OK.
Access mode (664) from usbfs line in /etc/fstab includes 'group write'. OK
All tests passed. OK. :-)

I presume my test failed because I have no usb entries in my /etc/fstab.

Usb does work with VirtualBox even though I don't have any entries in my /etc/fstab.

That's interesting. Here's from the VBox 3.0.6 User Manual:

On newer Linux hosts, VirtualBox accesses USB devices through special files in the file system. When VirtualBox is installed, these are made available to all users in the vboxusers system group. In order to be able to access USB from guest systems, make sure that you are a member of this group.

On older Linux hosts, USB devices are accessed using the usbfs file system. Therefore, the user executing VirtualBox needs read and write permission to the USB file system. Most distributions provide a group (e.g. usbusers) which the VirtualBox user needs to be added to.

Clearly, then, not having a usbfs line in fstab is not a showstopper on "newer Linux hosts". I'd like to add that into the script but what are "newer Linux hosts"?

/etc/vbox/ does exist, but is an empty directory (presumably left over from the OSE version even after it was purged to install the PUEL version.)
Therefore, /etc/vbox/vbox.cfg isn't there. I have searched the entire filesystem for vbox.cfg and cannot find it on my system. Most of the virtualbox executables reside in /usr/lib/virtualbox/ the main vbox executable is in /usr/bin/. The user manual and license files are in /usr/share/doc/virtualbox-3.0/. I am unable to find a .cfg file in relation to virtualbox.

The first line of my License file is:

Quote:

VirtualBox Personal Use and Evaluation License (PUEL)

If there is any other information I can provide, please let me know. Like so many others, I would really like to be able to access USB devices in vbox VMs.

[EDIT]Update: From the manual:

Quote:

The group vboxusers will be created during installation. Note that a user who is
going to run VirtualBox must be member of that group. A user can be made member of
the group vboxusers through the GUI user/group management or at the command
line with

Code:

sudo usermod -a -G vboxusers username

Also note that adding an active user to that group will require that user to log out
and back in again. This should be done manually after successful installation of the
package.

Doing this has granted me access to USB devices on my system. When stuck, RTFM. Doh.[/EDIT]

Last edited by New2Linux2; 10-18-2009 at 12:35 PM.
Reason: got it working

If there is any other information I can provide, please let me know. Like so many others, I would really like to be able to access USB devices in vbox VMs.

Thanks for the useful feedback. It would be helpful to know if the command line .deb tools in ubuntu 9.04 can be used to display the version of VBox installed, similar to RPM's rpm -qi. Maybe dpkg -l or -p ??? It would also be helpful to know what the same command outputs when given the name of a package that is not installed.

testvb
VirtualBox PUEL version found. OK
Name of user used to run VirtualBox: trona
usbfs line found in /etc/fstab. OK.
Here is the usbfs line from /etc/fstab: none /proc/bus/usb usbfs devgid=102,devmode=664 0 0
devgid (102) from usbfs line in /etc/fstab found in /etc/group. OK.
Here is group 102 from /etc/group: vboxusers:x:102:trona,dronayne
User (trona) is in usbfs devgid group (102). OK.
Access mode (664) from usbfs line in /etc/fstab includes 'group write'. OK
All tests passed. OK. :-)

And, miracle of miracles, the blasted thing is recognized by XP in VirtualBox; wow, zowie. The /etc/fstab entry with the devgid=102 is the Slackware 13.0 group identification for plugdev. The one downside of all this is that with that entry in /etc/fstab the automagic mount of the device is disabled in Slackware; i.e., mounts in the virtual XP machine, does not mount in Slackware.

Do I rightly understand that USB was not working with VirtualBox until you had the devgid=102,devmode=664 usbfs line in fstab nd not the other usbfs line?

I do not know the implications of more than one usbfs line in fstab so have re-written the script to report "WARNING: More than one usbfs line in /etc/fstab. Effect on VirtualBox unknown" and to continue running.

If VirtualBox is now taking the USB devices for the VM(s) making them unavailable to Slackware, you may be able to return them to Slackware by using the VM's window's Devices->"USB Devices" menu and de-selecting them.

The /proc/bus/usb/devices file's "Driver=" entries show which driver has claimed each device. Experimenting with a USB memory stick, this showed driver usb-storage when it was being used by Slackware (mounted under /media) and usbfs when it was attached to a VM (when it was unmounted from /media).

If you have some USB devices that you never want to use with a VM, I think you can configure this, per-VM, in VirtualBox's GUI. They have to be plugged in then the VM's USB config section allows you to add them to the filter list after which you can configure each one to be automatically attached or not.

Thanks for the useful feedback. It would be helpful to know if the command line .deb tools in ubuntu 9.04 can be used to display the version of VBox installed, similar to RPM's rpm -qi. Maybe dpkg -l or -p ??? It would also be helpful to know what the same command outputs when given the name of a package that is not installed.

So that's what dpkg returns for a package that it doesn't recognize as installed. In Synaptic and Aptitude, the version installed is "3.0.8-53138_Ubuntu_jaunty" (downloaded and installed from "virtualbox-3.0_3.0.8-53138_Ubuntu_jaunty_i386.deb" package.) "apt-get" doesn't have anything in it's man page about displaying versions of installed packages. The man page for "apt" is next to non-existent and my system doesn't recognize "apt" as a valid command anyway. Does anyone else know how to get similar information for .deb packages?