Possible Fix for USB devices on Ubuntu 8.10 Intrepid

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Dudeman
Posts: 2
Joined: 18. Dec 2008, 18:29

Possible Fix for USB devices on Ubuntu 8.10 Intrepid

Post by Dudeman »

Like many of you, I was having the problem of not being able to access my USB devices in a guest Windows XP running under a Ubuntu 8.10 host. I had read all the faqs and posts, messed with all the groups, configuration files, fstab, you name it. All those things were very useful in getting VirtualBox to recognize my devices and allow me to add filters, but it would never allow me to activate them. When I booted up windows, my devices were all there, but showed up as grey in the drop down menu.

I saw a lot of people with my exact problem clearly stating that they had already gone through all the steps I had, but the responses were all links to the same old FAQs or snide remarks about how this has been answered a million times and they need to search better and go RTFM. I finally got mine working and the answer was not in any FAQ or manual or forum post or google search.

I noticed VB was a Qt application, so I tried booting Ubuntu into KDE. Once in KDE I noticed that some of my KDE applications were missing. I may have cleaned out some unused applications at one point, or maybe something got lost during an upgrade. I normally use gnome, and haven't done a fresh install since 7.04

Anyhow, I went into Synaptic and marked "kubuntu-desktop" for re-installation. This marked a whole slew of dependencies, and after they installed, VB would allow me to use my USB devices. And once back in Gnome they continued to work.

I'm not sure what fixed the problem, be it running in KDE, be it installing the missing dependencies, or just random chance, but these steps fixed my problem.

So if you're getting frustrated at people assuming you're a complete idiot/newb, and not giving you any help or direction, this is probably something worth giving a try.

That's the end of my rant. Thanks for your time.
SauliJ
Posts: 5
Joined: 11. Dec 2008, 08:38

Post by SauliJ »

Maybe running KDE helped you. Difficult to say. But definitely it is not always necessary.

My USB works ok in a guest Windows XP under Ubuntu 8.10 and Gnome. I have not used KDE for a long time. VirtualBox is 2.06.

1. I followed the USB on Ubuntu/Intrepid and USB on openSUSE instructions on http://www.virtualbox.org/wiki/User_FAQ
2. I enabled USB Controller in the VirtualBox frontend
3. I activated the USB in WIndowsXP VM window (Devices -> USB Devices -> MyUSBStickName)
4. I didn't have Ubuntu users on the USB, like having a file browser view there or anything
axet
Volunteer
Posts: 93
Joined: 3. Sep 2007, 23:20

Post by axet »

that do not works on fedora 10 with gnome (and fedora 7,8,9)
chandra
Posts: 3
Joined: 11. Jun 2008, 18:32

Possible Fix for USB devices on Ubuntu 8.10 Intrepid

Post by chandra »

This works for me:

1. Install VirtaulBox-2.1 following the instructions at:
http://www.virtualbox.org/wiki/Linux_Downloads

2. Ensure that the group

Code: Select all

vboxusers
exists and you are in it.

3. Execute this Perl script

Code: Select all

#!/usr/bin/perl
use warnings;
use diagnostics;
use strict;
use File::stat;
use File::Basename;

# Perl script to enable use of USB devices in VirtualBox
# on K/Ubuntu Intrepid Ibex 8.10 running VirtualBox 2.1

print "Script for enabling USB in VirtualBox 2.1 on K/Ubuntu Intrepid 8.10\n";

# Get GID of vboxusers group from /etc/group if it exists or exit otherwise

my $filename = "/etc/group";
open my $file, $filename or die "Unable to open $filename";
my $vboxusersGID = "";
while (<$file>)
    {
    # In line beginning with vboxusers
    # match first contiguous set of digits delimited by colons
    if (/^vboxusers\D+:(\d+):/) {$vboxusersGID = $1};
    }
close $file;
if ($vboxusersGID eq "")
    {
    print "Group \"vboxusers\" not found.\nCreate it, add yourself to it, and re-run this script.\nExiting.\n";
    }
else {
    print "GID of vboxusers is $vboxusersGID\n";
    }
exit unless ($vboxusersGID);

# Examine /etc/fstab to see if a line like that below exists
# none /proc/bus/usb usbfs devgid=$vboxusersGID,devmode=664 0 0

$filename = "/etc/fstab";
my $usbfsline = "";
open $file, $filename or die "Unable to open $filename";
while (<$file>)
    {
    if (/^[^#].+(usbfs\s+devgid=$vboxusersGID).*/)
        {
        $usbfsline = $1;
        print "Line containing \"$usbfsline\" already exists in $filename.\nExiting leaving $filename untouched.\n";
        }
    }
close $file;

# Conditionally
# (a) make a backup of /etc/fstab in /tmp/fstab.backup
# (b) append the line
# none /proc/bus/usb usbfs devgid=$vboxusersGID,devmode=664 0 0
# to /etc/fstab

unless ($usbfsline)
    {
    $filename = "/etc/fstab";
    my $path = dirname($filename);
    my $fstab = basename($filename);
    my $tempfile = "/tmp/$fstab";
    my $inode = stat($filename);
    my $uid = $inode->uid; # should be zero for a root-owned file
    system "cp", "$filename", "$tempfile"; # working copy of /etc/fstab in /tmp
    print "Making backup copy of $filename as $tempfile.backup\n";
    system "cp", "$filename", "$tempfile.backup";
    open $file, ">> $tempfile" or die "Unable to open $tempfile";
    print $file "\# For VirtualBox USB access; vboxusers has gid $vboxusersGID\n";
    $usbfsline = "none /proc/bus/usb usbfs devgid=$vboxusersGID,devmode=664 0 0";
    print $file "$usbfsline\n";
    close $file;
    system "sudo", "-u", "\#uid", "mv", "$tempfile", "$filename";
    print "Appended \"$usbfsline\" to $filename\n";
    # Remount devices
    system "sudo", "mount", "-a";
    }
# Send comments and corrections to chandra@ee.uwa.edu.au 
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

What is all the difficulties about USB on 8.10. It's in the VirtualBox FAQ to get it working.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply