VirtualBox

Opened 15 years ago

Closed 10 years ago

#3041 closed defect (obsolete)

VirtualBox does not detect any USB device

Reported by: Maciej Pilichowski Owned by:
Component: USB Version: VirtualBox 2.1.2
Keywords: Cc:
Guest type: Windows Host type: Linux

Description (last modified by Frank Mehnert)

VirtualBox does not detect any USB device

I don't mean that I don't get USB in guest. No. VirtualBox itself does not detects any USB -- when I just start main VB window and I add USB devices they are all (in "add" the list) unchecked (in the "added" list they are checked). Later when running any guest in the status bar there is VB icon showing USB activity -- VB says "no devices are attached".

This is not my host system fault because when I run lsusb I get correct USB devices list.

VirtualBox 2.1.0 and VB 2.0.6 (64-bit) -- exact the same problem.

Host, opensuse 11.1, 64-bit.

Attachments (3)

xaa (390.0 KB ) - added by Maciej Pilichowski 15 years ago.
strace log 1
vbox.out.bz2 (15.5 KB ) - added by Maciej Pilichowski 15 years ago.
vbox.out.bz2
vboxsvc.out.bz2 (4.6 KB ) - added by Maciej Pilichowski 15 years ago.
Ok, vboxsvc this time

Download all attachments as: .zip

Change History (44)

comment:1 by Frank Mehnert, 15 years ago

Did you attach any USB device to your guest? Did you read the part of the FAQ which mentions USB problems on openSUSE?

comment:2 by Maciej Pilichowski, 15 years ago

Did you attach any USB device to your guest?

Of course :-).

Did you read the part of the FAQ which mentions USB problems on openSUSE?

I read after your information. It did not help.

Little background: I used the same VBox 2.1 at opensuse 10.3 32-bit and I did not have such entry as suggested in FAQ and USB worked.

My current fstab by default has such entry usbfs /proc/bus/usb usbfs noauto 0 0

I added additionally none /proc/bus/usb usbfs auto,busgid=1000,busmode=0775,devgid=1000,devmode=0664 0 0

VBox failed to detect USB devices.

So I removed the usbfs /proc/bus/usb usbfs noauto 0 0

Result: no change.

So I removed the entry from the FAQ and added what I had in opensuse 10.3: /dev/bus/usb /proc/bus/usb usbfs auto,devmode=666 0 0

Result: still the same.

Of course after each alteration of fstab I rebooted computer. I am also member of vbouxusers group.

comment:3 by Maciej Pilichowski, 15 years ago

After googling, I set two lines in fstab for USB: none /proc/bus/usb usbfs devgid=1000,devmode=0666 0 0 /sys/bus/usb/drivers /proc/bus/usb usbfs devgid=1000,devmode=0666 0 0

1000 id of vboxusers

and I added mount -a to /etc/rc.d/boot.local

It solved the USB problem.

Please keep this report open though, because: a) previously I hadn't do such things, so it is regression b) the documentation is still incorrect

comment:4 by Michael Thayer, 15 years ago

Resolution: fixed
Status: newclosed

This should work in 2.1.2 without any hacks.

comment:5 by Maciej Pilichowski, 15 years ago

Resolution: fixed
Status: closedreopened

Unfortunately, nope. Hacks are still needed, without them VB (not the guest system) does not see attached USB devices. So guest system has no chance at all.

comment:6 by Michael Thayer, 15 years ago

I tried it here inside a freshly installed openSUSE 11.1 VM and USB worked out of the box. Did you remove the hacks properly before trying?

comment:7 by Maciej Pilichowski, 15 years ago

Yes, I commented out the line in /etc/init.d/boot.local and lines in /etc/fstab. I also uncommented the original entry in /etc/fstab. Then I rebooted computer.

Do you also use 64-bit OS11.1 + 64-bit VB?

Btw. I didn't notice this before -- without hacks when I am running VB in VB I have whole USB list grayed out (RMB on usb icon at the bottom of the window). While running with hacks -- the list is enabled. It looks more like USB subsystem is not visible for VB.

comment:8 by Michael Thayer, 15 years ago

Not sure I get you there. I was talking about the VM selector window without running a VM (which is a bit tricky inside another VM). Are you saying that you can select the devices using the selector window but that they are not available in the VM?

comment:9 by Maciej Pilichowski, 15 years ago

I was talking about the VM selector window without running a VM (which is a bit tricky inside another VM).

What do you mean by "another VM"?

Are you saying that you can select the devices using the selector window but that they are not available in the VM?

I am saying that I can run the main VB app add whatever USB (for ABC guest) I would like, yet it has 0 effect on running VB itself. I can run then this ABC guest system -- VB window for this guest shows up.

And VB window has status bar at the bottom, among others, there is USB icon showing what USB device is attached. With USB hack -- I get correct list, without it -- the list is always disabled no matter what device I attach.

So for now, only the main VB window work -- when defining settings for each guest, if I attach pendrive it shows on the "+" (add) list. If I attach scanner, it shows up at that list. It is the only place detecting USB devices work without hacks. But the essential part of VB is not defining guest systems, but running them.

So, the problem is still valid.

comment:10 by Michael Thayer, 15 years ago

Your user is probably not a member of the group "vboxusers" (this is needed for the new USB code to work properly). Add the user to the group, log out and log back in again. I'm afraid it took me far too long to think of that...

comment:11 by Maciej Pilichowski, 15 years ago

I know, and I am.

comment:12 by Michael Thayer, 15 years ago

Macias, sorry for the long response time. Can you take a look at the file /etc/udev/rules.d/10-vboxdrv.rules? The two lines there which refer to USB should both contain 'group="vboxusers"'. However, with our "all distributions" installer and releases 2.1.0 to 2.1.4, these two lines end up containing 'group="root"'. Can you check whether that is the case on your system?

comment:13 by Maciej Pilichowski, 15 years ago

There is one problem -- there is no such file in this directory. Prefix numbers start from 40.

comment:14 by Michael Thayer, 15 years ago

Do you have a file called /etc/udev/rules.d/60-vboxdrv.rules ?

comment:15 by Maciej Pilichowski, 15 years ago

Yes, the 60-* exists, the content, 3 lines (follows):

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"

spacing is mine. So if the same applies as to 10-* this file is correct, right?

comment:16 by Michael Thayer, 15 years ago

Right. You already checked that the group vboxusers exists and that you are a member of it. Can you check that these permissions have actually been correctly applied? Do

$ ls -l /dev/bus/usb/xxx/yyy

where xxx/yyy is the device node for some USB device you would like to access in the guest (look at the output of lshal to find which device node corresponds to which device).

comment:17 by Maciej Pilichowski, 15 years ago

To this device I now have access from guest because of the workarounds:

crw-rw-r-- 1 root vboxusers 189, 904 2009-02-25 19:51 /dev/bus/usb/008/009

comment:18 by Michael Thayer, 15 years ago

Which workarounds did you apply? We would like to have this working for every one out of the box :)

comment:19 by Maciej Pilichowski, 15 years ago

The ones I described above -- two extra lines in /etc/fstab

none /proc/bus/usb usbfs devgid=1000,devmode=0666 0 0 /sys/bus/usb/drivers /proc/bus/usb usbfs devgid=1000,devmode=0666 0 0

and mount -a in /etc/rc.d/boot.local.

comment:20 by Michael Thayer, 15 years ago

In that case there is obviously something which is escaping me here. You are a member of vboxusers, and members of that group have read and write access to the device that you listed above ("test -r /dev/bus/usb/008/009 && test -w /dev/bus/usb/008/009 && echo OK" should confirm this). So you should have full access without workarounds. I am currently out of ideas...

comment:21 by Maciej Pilichowski, 15 years ago

I can confirm I get "OK".

comment:22 by andyc, 15 years ago

I've been struggling getting USB devices to work on Debian SID with vbox 2.1.4. The devices in /dev/bus/usb have the correct group:

# ls -l /dev/bus/usb/005/006 crw-rw-r-- 1 root vboxusers 189, 517 2009-03-13 11:02 /dev/bus/usb/005/006

However, as I was attempting to apply the workaround documented above, mount complained:

# mount /proc/bus/usb mount: none already mounted or /proc/bus/usb busy mount: according to mtab, procbususb is already mounted on /proc/bus/usb

That's led me to discover a different workaround for Debian sid (it may work for other Debian distributions or Ubuntu too: I don't know, haven't tried).

Debian mounts usbfs in /etc/init.d/mtab.sh as:

domtab usbfs /proc/bus/usb "procbususb"

Having stoppped vbox, unmounted /proc/bus/usb and restarted vbox, usb devices now work in a WinXP guest.

What affect that has on the rest of the Debian install, I don't know.

So, from the above, it seems that vbox is still looking in /proc/bus/usb first when it should be looking in /dev/bus/usb first (well, that's what it looks like from an outsider's point of view).

comment:23 by Michael Thayer, 15 years ago

andyc: /proc/bus/usb is deprecated, and most people have already got rid of it. If VBox finds it mounted, it uses legacy code to handle USB. We do this to avoid breaking existing working setups. Otherwise we use newer, alternative code.

macias: some people have reported that USB device which were plugged into their computer before they booted up work in VBox, but hotplugged ones do not. Is that true for you? And would you be able to do an strace of a VirtualBox process in which it fails to use a USB device?

Something like:

strace -o vbox.out VirtualBox -startvm <VM name>

comment:24 by andyc, 15 years ago

/proc/bus/usb may be deprecated but, as I said, Debian sid as of this writing (2009-03-19) still mounts it in /etc/init.d/mtab.sh thus causing problems:

if [ -d /proc/bus/usb ] then

domtab usbfs /proc/bus/usb "procbususb"

fi

/etc/init.d/mountkernfs.sh also does something similar:

if [ -d /proc/bus/usb ] then

domount usbfs usbdevfs /proc/bus/usb usbfs -onodev,noexec,nosuid

fi

For those pieces of shell script to work, /proc/bus/usb must exist prior to the usbfs being mounted. Anyone have any idea to stop /proc/bus/usb existing on a standard Debian sid install?

comment:25 by Maciej Pilichowski, 15 years ago

Michael,

some people have reported that USB device which were plugged into their computer before they booted up work in VBox, but hotplugged ones do not. Is that true for you?

Nope, i.e. already plugged in device does not work.

would you be able to do an strace of a VirtualBox process in which it fails to use a USB device?

No problem, but please tell me in what situation -- with workaround for USB, or without it?

comment:26 by Michael Thayer, 15 years ago

Version: VirtualBox 2.1.0VirtualBox 2.1.2

Without /proc/bus/usb mounted. That (and the code in VBox dealing with it) is now legacy, and I would like to make sure that the new code works for everyone.

comment:27 by Maciej Pilichowski, 15 years ago

strace does not even start: Effective UID is not root (euid=1000 egid=100 uid=1000 gid=100) (rc=-10)

It may help to reinstall VirtualBox.

And btw. about legacy of /proc/bus/usb, I use opensuse 11.1 and it original fstab entry is: usbfs /proc/bus/usb usbfs noauto 0 0

I don't know how it affects the matter of legacy, but I guess all users expect to have VB working without any tweaks to the system.

comment:28 by Michael Thayer, 15 years ago

Try the following command as root:

strace -u <your user name> -f -o vbox.out VirtualBox -startvm <VM name>

Check the manpage of strace if this doesn't quite do the trick. If the compressed file is a manageable size, you can send it to me by e-mail (my login name followed by dot thayer at sun dot com).

Regarding the legacy status of usbfs, I seem to recall that it was SUSE (specifically GregKH) who made the first moves to deprecating it. Note the "noauto" bit in the line you wrote above - it will only be used if the user specifically enables it. This was actually left in as a compromise for applications like VirtualBox and others which at the time still depended on usbfs.

comment:29 by Maciej Pilichowski, 15 years ago

I can only run VBox as root with strace, because otherwise I get this error all the time: VirtualBox: Error -10 in SUPR3HardenedMain! VirtualBox: Effective UID is not root (euid=1000 egid=100 uid=1000 gid=100)

It is not strace fault, because I can either run it (vbox) as me (macias) or as root. Strace is not complaining, only vbox.

So please let me know if root logs from VBox are any good.

comment:30 by Michael Thayer, 15 years ago

If you can reproduce the problem running as root then certainly.

comment:31 by Maciej Pilichowski, 15 years ago

So, I know more -- it simply looks root can access USB devices (system) and normal user cannot. The difference is obvious -- when running guest system you can click on the USB icon (vbox status bar), in both cases the list would be displayed, but for root all entries are enabled, and for user all are grayed out.

strace log follows.

comment:32 by Michael Thayer, 15 years ago

That will not help, as if nothing goes wrong there is nothing to see. You could try changing the strace binary to be setuid root and running the strace command as user (without the -u parameter).

by Maciej Pilichowski, 15 years ago

Attachment: xaa added

strace log 1

comment:33 by Maciej Pilichowski, 15 years ago

How can I change it and more important how I change this back? I don't want to break my system.

comment:34 by Michael Thayer, 15 years ago

chmod u+s /usr/bin/strace

should make it setuid root, and

chmod u-s /usr/bin/strace

should change it back again.

comment:35 by Maciej Pilichowski, 15 years ago

No change, vbox is still complaining about uid.

comment:36 by Michael Thayer, 15 years ago

Sigh. OK, my next idea is starting VirtualBox, checking its pid and then attaching to it with strace:

strace -p <VirtualBox pid> -o vbox.out

by Maciej Pilichowski, 15 years ago

Attachment: vbox.out.bz2 added

vbox.out.bz2

comment:37 by Maciej Pilichowski, 15 years ago

Ok, done :-)

comment:38 by Michael Thayer, 15 years ago

Wow :) Could I ask you for something else now though? Could you do an strace of the VBoxSVC executable which should be in /usr/lib/virtualbox or somewhere similar? This time, it should be enough to do

strace -o vboxsvc.out <path to VBoxSVC>

then to let it run for a few seconds and to stop it again. I hope that what I need will be visible in that time. Thanks...

by Maciej Pilichowski, 15 years ago

Attachment: vboxsvc.out.bz2 added

Ok, vboxsvc this time

comment:39 by poxx, 13 years ago

I ran it through sudo nautilus and it works fine which means your not a root user

comment:40 by Frank Mehnert, 13 years ago

macias, that log file is unfortunately not sufficient. Could you repeat the test but make sure that you also start the VBox GUI after you started the VBoxSVC server?

Also, there is a slight chance that VBox 4.0.10 fixes your problem.

comment:41 by Frank Mehnert, 10 years ago

Description: modified (diff)
Resolution: obsolete
Status: reopenedclosed
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use