LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This 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


Reply
  Search this Thread
Old 10-17-2009, 09:54 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
VirtualBox USB config test script; testers wanted


Hello

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.

EDIT2: latest version of the script is in this post.
Code:
#! /bin/bash

# A quick-and-dirty script to sanity-check VirtualBox USB setup.

# Usage: no arguments or options

# Set up environment
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
set -o nounset
unset IFS

# Set up line feed
lf=$'\n'

# Get VirtualBox installation directory ($INSTALL_DIR)
CONFIG="/etc/vbox/vbox.cfg"
[[ ! -r "$CONFIG" ]] && \echo "ERROR: Could not find VirtualBox installation (no $CONFIG file)" >&2 && \exit 1
. "$CONFIG"

# Ensure VirtualBox PUEL version is installed
license_afn="$INSTALL_DIR/LICENSE"
[[ ! -r "$license_afn" ]] && echo "ERROR: Could not read '$license_afn'" >&2 && \exit 1
! grep 'PUEL' "$license_afn" > /dev/null && echo 'ERROR: Installed VirtualBox is not the PUEL version so USB not supported' >&2 && \exit 1
\echo 'VirtualBox PUEL version found.  OK'

# Get user name
while true
do
    \echo -n 'Name of user used to run VirtualBox: '
    read user
    grep "^$user:" /etc/passwd > /dev/null && break
    echo "User $user not found in /etc/passwd. Try again (or Ctrl+C to exit)"
done

# Check fstab for usbfs line
tmp_afn="$(mktemp "/tmp/$0.XXXXXX")"
[[ $? -ne 0 ]] && \echo "ERROR: unable to create temporary file (this is not a VirtualBox USB problem)" >&2 && \exit 1

grep -v '^#' /etc/fstab | grep usbfs > /"$tmp_afn"
while read line
do
    [[ "${array:-}" != '' ]] && echo "ERROR: Found more than one usbfs line in /etc/fstab. Cannot continue:$'\n'$(cat /etc/fstab)" >&2 && \exit 1
    \echo "usbfs line found in /etc/fstab.  OK."
    \echo "Here is the usbfs line from /etc/fstab: "$line

    # Get GID and access mode
    array=($line)
    options="${array[3]}"
    IFS=','; array=($options); unset IFS
    for ((i=0; i<${#array[*]}; i++))
    do
        option="${array[$i]}"
        case "$option" in
            'devgid='* )
                gid="${option#devgid=}"
                ;;
            'devmode='* )
                mode="${option#devmode=}"
                ;;
        esac
    done
    [[ "${gid:-}" = '' ]] && \echo "ERROR: No devgid option on usbfs line in /etc/fstab" >&2 && \exit 1
    [[ "${mode:-}" = '' ]] && \echo "ERROR: No devmode option on usbfs line in /etc/fstab" >&2 && \exit 1
done < "$tmp_afn"
[[ "${array:-}" = '' ]] && echo "ERROR: no usbfs line in /etc/fstab" >&2 && \exit 1

# Check GID
buf="$(grep "^[^:]*:[^:]*:$gid:" /etc/group)"
[[ "${buf:-}" = '' ]] && \echo "ERROR: devgid ($gid) from usbfs line in /etc/fstab does not exist in /etc/group!" >&2 && \exit 1
\echo "devgid ($gid) from usbfs line in /etc/fstab found in /etc/group.  OK."
\echo "Here is group $gid from /etc/group: $buf"
IFS=':'; array=($buf)
IFS=','; array=(${array[3]}); unset IFS
OK='no'
for ((i=0; i<${#array[*]}; i++))
do
    user_in_group="${array[$i]}"
    case "$user_in_group" in
        "$user" )
            OK='yes'
            break
            ;;
    esac
done
[[ "$OK" = 'no' ]] && \echo "ERROR: User ($user) is not in usbfs devgid group ($gid)!" >&2 && \exit 1
\echo "User ($user) is in usbfs devgid group ($gid).  OK."

# Check access mode
#echo "DEBUG: len mode '${#mode}' mode-no-nums '${mode//[0-9/}" != '' ]] && \echo "ERROR: access mode ($mode) from usbfs line in /etc/fstab is not 3 integers" >&2 && \exit 1
[[ "${#mode}" -ne 3 || "${mode//[0-9]/}" != '' ]] && \echo "ERROR: access mode ($mode) from usbfs line in /etc/fstab is not 3 integers" >&2 && \exit 1
group_mode="${mode:1:1}"
let group_write=group_mode-4
[[ $group_write -lt 2 ]] && \echo "ERROR: access mode ($mode) from usbfs line in /etc/fstab does not include 'group write'" >&2 && \exit 1
\echo "Access mode ($mode) from usbfs line in /etc/fstab includes 'group write'.  OK"
\echo "All tests passed.  OK.  :-)"

exit 0
Best

Charles

Last edited by catkin; 10-22-2009 at 11:10 AM. Reason: Added trap for no usbfs line found in /etc/fstab
 
Old 10-17-2009, 01:03 PM   #2
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Just ran, but have to run. Wife dragging me out -

Code:
[radar@msi-k8t ~]$ ./vbox_usbtest.sh 
ERROR: Could not find VirtualBox installation (no /etc/vbox/vbox.cfg file)
[radar@msi-k8t ~]$ uname -r
2.6.27.25-170.2.72.fc10.x86_64
[radar@msi-k8t ~]$ cat /etc/redhat-release 
Fedora release 10 (Cambridge)
 
Old 10-17-2009, 01:59 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by TBC Cosmo View Post
Just ran, but have to run. Wife dragging me out -

Code:
[radar@msi-k8t ~]$ ./vbox_usbtest.sh 
ERROR: Could not find VirtualBox installation (no /etc/vbox/vbox.cfg file)
[radar@msi-k8t ~]$ uname -r
2.6.27.25-170.2.72.fc10.x86_64
[radar@msi-k8t ~]$ cat /etc/redhat-release 
Fedora release 10 (Cambridge)
Thanks TBC Cosmo

Did you install VirtualBox from a Fedora package? If so, how does you system compare with madmadmod's post?
 
Old 10-17-2009, 08:42 PM   #4
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
I decided to install puel to provide feed back. I got exactly the same error message as TBC Cosmo.
Quote:
ERROR: Could not find VirtualBox installation (no /etc/vbox/vbox.cfg file)
Version Installed: VirtualBox-3.0.8_53138_mdv2009.1-1.i586.rpm

rpm -qi VirtualBox outputs:
Code:
Name        : VirtualBox                   Relocations: (not relocatable)
Version     : 3.0.8_53138_mdv2009.1             Vendor: Sun Microsystems, Inc.
Release     : 1                             Build Date: Fri 02 Oct 2009 12:48:15 BST
Install Date: Sun 18 Oct 2009 02:14:34 BST      Build Host: tinderlin.germany.sun.com
Group       : Applications/System           Source RPM: VirtualBox-3.0.8_53138_mdv2009.1-1.src.rpm
Size        : 95142659                         License: VirtualBox Personal Use and Evaluation License (PUEL)
Signature   : DSA/SHA1, Fri 02 Oct 2009 14:59:22 BST, Key ID dcf9f87b6dfbcbae
URL         : http://www.virtualbox.org/
Summary     : Powerful PC virtualization solution
Description :
VirtualBox is a powerful PC virtualization solution allowing
you to run a wide range of PC operating systems on your Linux
system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
and others. VirtualBox comes with a broad feature set and
excellent performance, making it the premier virtualization
software solution on the market.
Quote:
uname -r
2.6.29.6-desktop-2mnb
Quote:
cat /etc/release
Mandriva Linux release 2009.1 (Official) for i586
Hope the above info helps.
 
Old 10-17-2009, 09:26 PM   #5
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Quote:
Originally Posted by catkin View Post
Thanks TBC Cosmo

Did you install VirtualBox from a Fedora package? If so, how does you system compare with madmadmod's post?
Installed one from virtualbox.org. BTW my USB has worked fine.

Code:
[radar@msi-k8t ~]$ rpm -qi VirtualBox
Name        : VirtualBox                   Relocations: (not relocatable)
Version     : 3.0.2_49928_fedora9               Vendor: Sun Microsystems, Inc.
Release     : 1                             Build Date: Fri 10 Jul 2009 12:35:02 PM EDT
Install Date: Thu 16 Jul 2009 06:28:01 PM EDT      Build Host: tinderlin.germany.sun.com
Group       : Applications/System           Source RPM: VirtualBox-3.0.2_49928_fedora9-1.src.rpm
Size        : 103486924                        License: VirtualBox Personal Use and Evaluation License (PUEL)
Signature   : (none)
URL         : http://www.virtualbox.org/
Summary     : Powerful PC virtualization solution
Description :
VirtualBox is a powerful PC virtualization solution allowing
you to run a wide range of PC operating systems on your Linux
system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
and others. VirtualBox comes with a broad feature set and
excellent performance, making it the premier virtualization
software solution on the market.

Last edited by TBC Cosmo; 10-17-2009 at 09:33 PM.
 
Old 10-18-2009, 10:41 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks both

Here's a new version of the script now written to work with RPM thanks to your input. Not having an RPM based system I have not been able to test it much.
Code:
#! /bin/bash

# ck_vbox_USB.sh, a quick-and-dirty script to sanity-check VirtualBox USB setup.

# Usage: no arguments or options

# Change history
# 18oct9 Charles
#    * Added RPM enquiry (and skeleton dpkg enquiry)

# Set up environment
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
set -o nounset
unset IFS

# Set up line feed
lf=$'\n'

function ck_PUEL {

    typeset msg OK_flag ERROR_flag
    OK_flag='NO'
    ERROR_flag='NO'

    # Default (?) VBox config file
    if [[ -r '/etc/vbox/vbox.cfg' ]]; then
        . /etc/vbox/vbox.cfg
        license_afn="$INSTALL_DIR/LICENSE"
        if [[ -r "$license_afn" ]]; then
            if grep 'PUEL' "$license_afn" > /dev/null ; then
                OK_flag='YES'
            else
                ERROR_flag='YES'
            fi
        else
            echo "WARNING: Could not read '$license_afn' identified by /etc/vbox/vbox.cfg" >&2
        fi
    fi

    # RPM
    if type rpm > /dev/null 2>&1 ; then
        case "$( rpm -qi VirtualBox 2>&1 )" in
            *PUEL* )
                OK_flag='YES'
                ;;
            *'is not installed'* )
                ;;
            * )
                ERROR_flag='YES'
        esac
    fi

    # .deb
    if type dpkg > /dev/null 2>&1 ; then
       \echo 'WARNING: this script is not programmed for .deb package systems'
    fi 

    # Report findings
    if [[ "$OK_flag" = 'YES' ]]; then
        \echo 'VirtualBox PUEL version found.  OK'
        if [[ "$ERROR_flag" = 'YES' ]]; then
            \echo 'WARNING: VirtualBox non-PUEL version also found.  ???' >&2
        fi
    elif [[ "$ERROR_flag" = 'YES' ]]; then
            \echo 'ERROR: Installed VirtualBox is not the PUEL version so USB not supported' >&2 && \exit 1
    else
           \echo 'WARNING: unable to determine which version of VirtualBox, if any, is installed'
    fi

} # ck_PUEL

# Check for VirtualBox PUEL version
ck_PUEL

# Get user name
while true
do
    \echo -n 'Name of user used to run VirtualBox: '
    read user
    grep "^$user:" /etc/passwd > /dev/null && break
    echo "User $user not found in /etc/passwd. Try again (or Ctrl+C to exit)"
done

# Check fstab for usbfs line
tmp_afn="$(mktemp "/tmp/$0.XXXXXX")"
[[ $? -ne 0 ]] && \echo "ERROR: unable to create temporary file (this is not a VirtualBox USB problem)" >&2 && \exit 1

grep -v '^#' /etc/fstab | grep usbfs > /"$tmp_afn"
while read line
do
    [[ "${array:-}" != '' ]] && echo "ERROR: Found more than one usbfs line in /etc/fstab. Cannot continue:$'\n'$(cat /etc/fstab)" >&2 && \exit 1
    \echo "usbfs line found in /etc/fstab.  OK."
    \echo "Here is the usbfs line from /etc/fstab: "$line

    # Get GID and access mode
    array=($line)
    options="${array[3]}"
    IFS=','; array=($options); unset IFS
    for ((i=0; i<${#array[*]}; i++))
    do
        option="${array[$i]}"
        case "$option" in
            'devgid='* )
                gid="${option#devgid=}"
                ;;
            'devmode='* )
                mode="${option#devmode=}"
                ;;
        esac
    done
    [[ "${gid:-}" = '' ]] && \echo "ERROR: No devgid option on usbfs line in /etc/fstab" >&2 && \exit 1
    [[ "${mode:-}" = '' ]] && \echo "ERROR: No devmode option on usbfs line in /etc/fstab" >&2 && \exit 1
done < "$tmp_afn"
[[ "${array:-}" = '' ]] && echo "ERROR: no usbfs line in /etc/fstab" >&2 && \exit 1

# Check GID
buf="$(grep "^[^:]*:[^:]*:$gid:" /etc/group)"
[[ "${buf:-}" = '' ]] && \echo "ERROR: devgid ($gid) from usbfs line in /etc/fstab does not exist in /etc/group!" >&2 && \exit 1
\echo "devgid ($gid) from usbfs line in /etc/fstab found in /etc/group.  OK."
\echo "Here is group $gid from /etc/group: $buf"
IFS=':'; array=($buf)
IFS=','; array=(${array[3]}); unset IFS
OK='no'
for ((i=0; i<${#array[*]}; i++))
do
    user_in_group="${array[$i]}"
    case "$user_in_group" in
        "$user" )
            OK='yes'
            break
            ;;
    esac
done
[[ "$OK" = 'no' ]] && \echo "ERROR: User ($user) is not in usbfs devgid group ($gid)!" >&2 && \exit 1
\echo "User ($user) is in usbfs devgid group ($gid).  OK."

# Check access mode
[[ "${#mode}" -ne 3 || "${mode//[0-9]/}" != '' ]] && \echo "ERROR: access mode ($mode) from usbfs line in /etc/fstab is not 3 integers" >&2 && \exit 1
group_mode="${mode:1:1}"
let group_write=group_mode-4
[[ $group_write -lt 2 ]] && \echo "ERROR: access mode ($mode) from usbfs line in /etc/fstab does not include 'group write'" >&2 && \exit 1
\echo "Access mode ($mode) from usbfs line in /etc/fstab includes 'group write'.  OK"

\echo "All tests passed.  OK.  :-)"

exit 0
 
Old 10-18-2009, 10:49 AM   #7
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
I think your script is a good idea. Here's the new output:

Code:
[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.  :-)
 
Old 10-18-2009, 11:01 AM   #8
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
I presume my test failed because I have no usb entries in my /etc/fstab.

Quote:
./vboxtest
VirtualBox PUEL version found. OK
Name of user used to run VirtualBox: xxx
ERROR: no usbfs line in /etc/fstab
Usb does work with VirtualBox even though I don't have any entries in my /etc/fstab.

Last edited by {BBI}Nexus{BBI}; 10-22-2009 at 03:55 PM.
 
Old 10-18-2009, 12:13 PM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by {BBI}Nexus{BBI} View Post
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"?
 
Old 10-18-2009, 12:14 PM   #10
New2Linux2
Member
 
Registered: Jan 2004
Location: Arizona
Distribution: Debian
Posts: 153

Rep: Reputation: 43
Sorry, but I'm getting the "could not find installation path" error, also.

Ubuntu 9.0.4 with 2.6.28-15-generic kernel

/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
 
Old 10-18-2009, 12:26 PM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by New2Linux2 View Post
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.
 
Old 10-18-2009, 12:40 PM   #12
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Hi,

Ran it, got
Code:
testvb
VirtualBox PUEL version found.  OK
Name of user used to run VirtualBox: trona
ERROR: no usbfs line in /etc/fstab
Now, this is Slackware 13.0, there aren't supposed to be any entries in /etc/fstab for USB.

But... there's all those suggested entries (which I have commented-out), so let's uncomment them and see what happens:
Code:
<in /etc/fstab>
none             /proc/bus/usb    usbfs       devgid=102,devmode=664 0 0
usbfs            /proc/bus/usb    usbfs       auto             0   0
and
Code:
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
ERROR: Found more than one usbfs line in /etc/fstab. Cannot continue:$'\n'/dev/sda2        swap             swap        defaults         0   0
/dev/sda3        /                ext4        defaults         1   1
/dev/sda5        /usr             ext4        defaults         1   2
/dev/sda6        /usr/local       ext4        defaults         1   2
/dev/sda7        /home            ext4        defaults         1   2
/dev/sda8        /opt             ext4        defaults         1   2
/dev/sda9        /var             ext4        defaults         1   2
/dev/sda10       /var/lib/mysql   ext4        defaults         1   2
/dev/sda11       /spare00         ext4        defaults         1   2
/dev/sda12       /spare01         ext4        defaults         1   2
/dev/sda13       /spare02         ext4        defaults         1   2
/dev/sda14       /spare03         ext4        defaults         1   2
/dev/sda15       /var/lib/virtual ext4        defaults         1   2
/dev/sda1        /fat-c           ntfs-3g     umask=022        1   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro  0   0
none             /proc/bus/usb    usbfs       devgid=102,devmode=664 0 0
usbfs            /proc/bus/usb    usbfs       auto             0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
Oh, damn.

All righty, then, let's do only one
Code:
none             /proc/bus/usb    usbfs       devgid=102,devmode=664 0 0
#usbfs            /proc/bus/usb    usbfs       auto             0   0
and
Code:
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.

Oh, well, you gets what you gets.

Last edited by tronayne; 10-18-2009 at 01:23 PM.
 
Old 10-18-2009, 12:46 PM   #13
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
Quote:
Originally Posted by catkin View Post
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"?
It could be down to the kernel version why the entries no longer need to be in the fstab file anymore.
 
Old 10-19-2009, 12:32 PM   #14
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks tronayne

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.
 
Old 10-19-2009, 12:44 PM   #15
New2Linux2
Member
 
Registered: Jan 2004
Location: Arizona
Distribution: Debian
Posts: 153

Rep: Reputation: 43
Quote:
Originally Posted by catkin View Post
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.
Ok. I'm not that familiar with using dpkg, but this is what I get:
Code:
dave@dave-laptop:~$ sudo dpkg -I virtualbox-3.0
dpkg-deb: failed to read archive `virtualbox-3.0': No such file or directory
dave@dave-laptop:~$
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?
 
  


Reply

Tags
configuration, script, usb, virtualbox


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
70+ bug-fixes fro WindowMaker [testers wanted] gnashley Slackware 7 12-12-2009 08:38 AM
LXer: SwapBoost v0.1alpha - early testers wanted LXer Syndicated Linux News 0 07-08-2007 09:46 PM
Wanted: 2.6.20.2 .config for laptop, Please herbietheferret Linux - Kernel 4 04-05-2007 06:23 AM
Beta testers wanted for new distro (IBLS) ico2 Linux - Distributions 4 12-31-2005 07:18 AM
Wanted: A place to UL/DL kernel config files. FallGuy Mandriva 6 11-07-2003 03:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 05:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration