LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   VirtualBox: USB device "is being exclusively used by the host computer" (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/virtualbox-usb-device-is-being-exclusively-used-by-the-host-computer-798620/)

catkin 03-29-2010 06:00 AM

VirtualBox: USB device "is being exclusively used by the host computer"
 
Hello :)

This summarises a virtualbox.org forums thread in which the question has become more about the host than VirtualBox.

A "USB devices greyed out" problem has come down to this:
Code:

c@CW8:~$ VBoxManage controlvm "WXP" usbattach d9d550c5-fe6c-49dc-8bec-83ea60978a7c
[snip]
ERROR: USB device 'SanDisk Cruzer Blade' with UUID {[snip]} is being exclusively used by the host computer
[snip]

The problem is affecting all available devices -- 2 x thumb drives, 1 Bluetooth adapter and a printer -- so I don't think it is driver-specific.

From the host side, what can I do to investigate what might be making the devices unavailable for VirtualBox?

Netsearching suggests this is an unusual problem; chances are there's something unusual about my system that is triggering it. The only thing I can think of is that I changed the vboxusers group's GID (after which I uninstalled VirtualBox, groupdeleted vboxusers, groupadded vboxusers, installed VirtualBox ...

Versions: VirtualBox 3.1.6 on Slackware 13.0 32-bit.

My intuition is that this is a udev problem, created by the group change but I've scanned all the rules (under /lib/udev and /etc/udev) and found nothing relevant.

{BBI}Nexus{BBI} 03-29-2010 05:20 PM

There's a script here:VirtualBox Test Script that checks your VirtualBox setup.

aus9 03-29-2010 06:35 PM

hi

it may be an udev rule as suspected but as I do not use your distro I will comment in general.

The more user friendly your desktop....the greater the chance that your usb devices HAVE been automounted.

I suggest you use your file manager and look to see if (with root powers)
where are usb devices mounted.....or use normal file manager and look firstly into folders
/mnt
/media

Also peek into your /etc/fstab in case its not an udev rule but an fstab that is mounting your device.

If your distro is that friendly...you should be able to right hand click the mounted icon...folder...and Unmount it.

2) if your log shows usb device is say...../dev/usb3....something
try a root command to umount it or run a fuser against it.

3) Then of course...vbox and usb only play if you are using the non-free edition but I suspect you already knew that?

catkin 03-29-2010 11:42 PM

Quote:

Originally Posted by {BBI}Nexus{BBI} (Post 3917237)
There's a script here:VirtualBox Test Script that checks your VirtualBox setup.

Thanks {BBI}Nexus{BBI} :) I wrote it!

catkin 03-29-2010 11:44 PM

Thanks aus9 :)

It's not mounted ...

aus9 03-30-2010 06:24 PM

hi

could you expand a little on how you are accessing root and the usb thumb drive/hard drive please?

Do you do it routinely as well?

I have never tested the reported UUID in vbox for a user versus root so will have to have a look myself but I am wondering if its your process?

To me....try insert stick into host slot
do not mount it in host
click on vbxo devices ....check box for usb device
mount it inside vbox for user
umount of user
----

do same process for root but mount for root

--------------

I will get around to it.....but I am wondering IF it reports different UUID...the error is in vbox as UUID is always supposed to be same unless you change the partitioning.

catkin 03-31-2010 01:06 AM

Quote:

Originally Posted by aus9 (Post 3918473)
could you expand a little on how you are accessing root and the usb thumb drive/hard drive please?

Thanks aus9 :)

I don't understand the question but will answer in detail hoping to provide the information you want ... Desktop is Xfce. Terminal emulator is mrxvt. Command line is /usr/bin/mrxvt -name root -ic /home/c/d/Repository/Icons/format-text-bold.xpm. Then enter root password and have root command prompt.

If I want to browse the FAT file system on the thumb drive on Linux (Slackware 13.0), I open Xfce's file manager, Thunar, and find it listed but greyed out. At this point it is not mounted. When I double click its icon it is mounted. To unmount it, I right click its icon and choose "Unmount Volume".

That's FYI -- I haven't been doing that after host boot and before trying to attach the thumb drive to a VirtualBox VM.

Once at a root command prompt, for testing purposes only (repeated while writing this post)
Code:

root@CW8:~# /opt/VirtualBox/VBoxManage list usbhost
[snip]

UUID:              b176c47d-0d2c-4fe2-97de-f8bbc5c64d0a
VendorId:          0x0781 (0781)
ProductId:          0x5567 (5567)
Revision:          2.0 (0200)
Manufacturer:      SanDisk
Product:            Cruzer Blade
SerialNumber:      1536401B4C138AB9
Address:            /proc/bus/usb/001/004
Current State:      Busy

[snip]

And, as evidence it is not mounted, firstly when mounted by Thunar as above and then after "Unmount Volume" in Thunar
Code:

root@CW8:~# df -hT | grep CHARLES8GB
/dev/sdc1    vfat    7.5G  132K  7.5G  1% /media/CHARLES8GB
root@CW8:~# df -hT | grep CHARLES8GB
[no output]

Quote:

Originally Posted by aus9 (Post 3918473)
Do you do it routinely as well?

No, I normally use only the VM's host window's Devices menu to attach USB devices. I did not know of VBoxManage list usbhost until investigating this problem.

Quote:

Originally Posted by aus9 (Post 3918473)
I have never tested the reported UUID in vbox for a user versus root so will have to have a look myself but I am wondering if its your process?

To me....try insert stick into host slot
do not mount it in host
click on vbxo devices ....check box for usb device
mount it inside vbox for user
umount of user

A valid "wonder". That's exactly what I normally do, assuming "click on vbxo devices" can be expanded to "Start a VM (not full screen). On the host window for the VM, open the Devices menu ...". The problem is that all the USB devices are greyed out so it is not possible to "check box for usb device"

Quote:

Originally Posted by aus9 (Post 3918473)
do same process for root but mount for root

I cannot do the same for root because root is not a GUI user (trying to start a GUI application in a terminal as above results in cannot connect to X server
Quote:

Originally Posted by aus9 (Post 3918473)
I will get around to it.....but I am wondering IF it reports different UUID...the error is in vbox as UUID is always supposed to be same unless you change the partitioning.

I don't think the UUID reported by VBoxManage list usbhost is the same as the partition UUID. I just tested again as user c (the usual VirtualBox user, member of vboxusers etc.). Collating results from the virtualbox.org forums thread and while writing this post, it looks as if VirtualBox creates these UUIDs for itself and on-the-fly:
Code:

UUID for c:    1f307a8a-2ecc-4a8d-9630-eebe225137dd
  29 March:    d9d550c5-fe6c-49dc-8bec-83ea60978a7c
UUID for root: b176c47d-0d2c-4fe2-97de-f8bbc5c64d0a
  29 March:    174e0a69-af28-4e32-b1a5-94ae8e94b005

To determine the thumb drive's partition's UUID, I searched for /dev files containing its serial number to get its /dev/sd<letter><number> and then searched for a link to that in /dev/disk/by-uuid
Code:

root@CW8:~# find /dev -iname '*1536401B4C138AB9*' -exec ls -l {} \;
lrwxrwxrwx 1 root root 10 2010-03-31 10:26 /dev/disk/by-id/usb-SanDisk_Cruzer_Blade_1536401B4C138AB9-0:0-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 9 2010-03-31 10:26 /dev/disk/by-id[snip]
root@CW8:~# find /dev/disk/by-uuid -lname '*sdc1*' -exec ls -l {} \;
lrwxrwxrwx 1 root root 10 2010-03-31 10:26 /dev/disk/by-uuid/4BA8-ADEB -> ../../sdc1

Ah! Of course! It is a VFAT file system and that's what their UUIDs look like.

catkin 03-31-2010 02:20 AM

Workaround
 
I found a workaround for the problem by adding a line to fstab
Code:

none            /proc/bus/usb  usbfs      devgid=765,devmode=664    0 0
That should not be and was not necessary on Slackware 13.0. As the VirtaulBox 3.1.6 User Manual says "If USB is not working on your Linux host, make sure that the current user is a member of the vboxusers group. On older hosts ...". "older hosts" is not defined but I guess they are ones on which VirtualBox cannot use the udev rules mechanism like this /etc/dev/rules.d/10-vboxdrv.rules on my system
Code:

KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0664"

Maybe that is not effective for a thumb drive anyway because it would (?) be superseded by this excerpt from /lib/udev/rules.d/65-permissions.rules
Code:

KERNEL=="sd*[0-9]", ATTRS{removable}=="1", GROUP="plugdev"
which uses the more generic plugdev group rather than vboxusers -- a neater solution because it is not only VirtualBox users who may want read and write access to file systems on USB devices.

BTW the VirtualBox user, "c", is a member of plugdev.

I'll leave this thread not SOLVED for a while because this is a workaround not a proper solution.

aus9 03-31-2010 06:48 PM

hi

yes that pesky vfat system gets you every time...well done

anyhow I made a kinda promise so here is part one stuff

--------------------
in host....usb mounted

Code:

df -hT | grep vfat
/dev/sdb1    vfat    488M  3.3M  485M  1% /media/disk

umounted returns null as expected

in host......usb NOT mounted

Code:

VBoxManage list usbhost
Sun VirtualBox Command Line Management Interface Version 3.1.6
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

Host USB Devices:

UUID:              49d59d0e-761a-46fb-b92f-00c435508461
VendorId:          0x0930 (0930)
ProductId:          0x6529 (6529)
Revision:          1.0 (0100)
Manufacturer:      TOSHIBA
Product:            TransMemory
SerialNumber:      09F08951425159F9
Address:            sysfs:/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8//device:/dev/bus/usb/001/005
Current State:      Busy

using root powers usb NOT mounted

Code:

blkid | grep vfat
/dev/sdb1: LABEL="" UUID="8CC9-F420" TYPE="vfat"


My inference.....lets not get fixated on UUID with vfat

aus9 03-31-2010 07:11 PM

part 2

I just did a rebuild and damn....I can't do the test!

mine is greyed out and clicking into box no good

by hovering...it seems usb is unavailable.

maybe its borked?

http://i39.tinypic.com/21mgkqt.jpg

aus9 03-31-2010 07:35 PM

part 3

ok so I used apt-get install with no complaints to get to part 2.

I then used my smxi script....only for smart ppl using Debian style sorry
...guru has a smvi script if you just want to add vbox or vmware

and it found I was missing some dependencies ....EDIT libidl0 I mis-spelt using fuzzy eyesight.....libid L for lima zero at end
libidl0
libqtcore4
libqtgui4

having prevously resolved other dependencies in part 2

so me thinks.....IMHO the solution is to move to a Debian system.

smxi is used to update your system...clean up stuff...tweak and put out the rubbish and night....send cards before birthday is expired etc

good luck

http://i44.tinypic.com/iym0b7.jpg

aus9 03-31-2010 07:47 PM

part 4

ok this is weird but exciting....I mounted usb stick in host
I clicked in devices and mounted usb in vbox
....host no longer shows it

I can't show you a snapshot that is true evidence of this...you just have to trust me.

I have never tested this for a long long time.....when I discovered vbox I knew I had to always umount the host....so this must be more recent development but highly appreciated

catkin 04-01-2010 11:55 PM

Quote:

Originally Posted by aus9 (Post 3919803)
I mounted usb stick in host
I clicked in devices and mounted usb in vbox
....host no longer shows it

I have never tested this for a long long time.....when I discovered vbox I knew I had to always umount the host....so this must be more recent development but highly appreciated

Hello aus :)

Where does "host no longer shows it"?

VirtualBox has got more convenient and more intuitive with each new release. They really work on making it more usable.

aus9 04-02-2010 06:57 PM

If its mounted in host.....usb stick shows in my file manager....I use LXDE so thats pcmanfm....but I guess the same would be true of other good managers.

Now when I mount it using vbox device manager...the "mounted" folder on host file manager now disappears is what I meant by ...host no longer shows it

catkin 04-03-2010 12:00 AM

Quote:

Originally Posted by aus9 (Post 3922317)
If its mounted in host.....usb stick shows in my file manager....I use LXDE so thats pcmanfm....but I guess the same would be true of other good managers.

Now when I mount it using vbox device manager...the "mounted" folder on host file manager now disappears is what I meant by ...host no longer shows it

Same using Xfce's file manager, Thunar, except Thunar does not mount the device until you open it; it's greyed out until then. That makes sense -- it minimises the risk of file system damage caused by unplugging a mounted device while causing minimal user inconvenience (the mounting delay is imperceptible to the user).


All times are GMT -5. The time now is 09:15 AM.