HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Discussions related to using VirtualBox on Linux hosts.

HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 8. Nov 2009, 19:25

Generally, after installing virtualbox, just register in the group vboxusers (created by the installer), nothing more and all is well.

However, many users reported encountering difficulties in the use of USB ports with virtualbox (i.e > 3.0.6). There are many different tracks on the Internet, most recommend the modified /etc/fstab
but in ubuntu karmic there is a method cleaner, simpler and more appropriate:
This works well with Karmic x 64 :D

1 - Add in /etc/udev/rules.d/z80_user.rules (which is a symlink to /etc/udev/user.rules) the 2 lines below:

SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0666"



2 - Eventually, if any, remove /etc/fstab line
none /proc/bus/usb usbfs devgid = 505, devmode = 664 0 0
if it had been added manually
if nothing is touching :D :)

3 - Reboot for the consideration of udev (I think that instead of rebooting, it would be better to do instead:
udevcontrol reload_rules

in a terminal, but I have not tried it yet ...)

It's still very simple, just 2 lines to copy/paste/edit in this file is provided for this (rules user)
and does that override the rules of origin of virtualbox. Thus, there is no risk of damage by wrong fstab manip: (
udev or other ...
Last edited by brazz on 13. Nov 2009, 02:20, edited 4 times in total.
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby ogoun » 10. Nov 2009, 14:43

Hi,

thanks for the information. I also encounter a problem with USB flash drives.

Before switching to Ubuntu 9.10 it was solved by the line in the /etc/fstab.

I wanted to try your solution but I don't have a file called z80_user.rules in /etc/udev/rules.d

I only have a 10-vboxdrv.rules:
Code: Select all   Expand viewCollapse view
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"


Do I only have to change the "MODE"s?
ogoun
 
Posts: 8
Joined: 13. Oct 2009, 14:07
Primary OS: Other
VBox Version: PUEL
Guest OSses: WinXP

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 10. Nov 2009, 16:42

Oh! I think now, this is only tyrue on karmic standard, not karmic 64 :(
but if you're under karmic "normal" :D then here it is, in /etc/udev/rules.d normally after installation should have:

Code: Select all   Expand viewCollapse view
ls -l /etc/udev/rules.d
total 32
-rw-r--r-- 1 root root   208 2009-11-08 17:41 10-vboxdrv.rules
-rw-r--r-- 1 root root   208 2009-11-08 17:28 10-vboxdrv.rules~
-rw-r--r-- 1 root root 11592 2009-10-30 18:01 51-hso-udev.rules
-rw-r--r-- 1 root root  1958 2009-10-27 10:03 70-persistent-cd.rules
-rw-r--r-- 1 root root   411 2009-10-25 12:34 70-persistent-net.rules
-rw-r--r-- 1 root root  1157 2009-09-24 02:10 README
lrwxrwxrwx 1 root root    13 2009-10-27 02:33 z80_user.rules -> ../user.rules


what are the 2 lines I have indicated, is burdening rules of 10-vboxdrv.rules
Note that z80_user.rules is just a link on /etc/udev/user.rules


I hope all this will be useful.
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby ogoun » 11. Nov 2009, 10:23

Thanks for the swift reply. I'm on x86_64 and my rules.d looks like this:

Code: Select all   Expand viewCollapse view
ls -l /etc/udev/rules.d/
insgesamt 16
-rw-r--r-- 1 root root  208 2009-11-03 10:00 10-vboxdrv.rules
-rw-r--r-- 1 root root  854 2009-11-03 09:33 70-persistent-cd.rules
-rw-r--r-- 1 root root  411 2009-11-02 14:30 70-persistent-net.rules
-rw-r--r-- 1 root root 1157 2009-10-16 08:01 README
ogoun
 
Posts: 8
Joined: 13. Oct 2009, 14:07
Primary OS: Other
VBox Version: PUEL
Guest OSses: WinXP

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 11. Nov 2009, 12:04

Unfortunately, I was already reported problems with these karmic x64, someone has even recreated z80_user.rules by a link on /etc/udev/user.rules he had created, but it seems it ' is not taken into account.
I think there are differences between x32 and x64 ... And I am not under x64
Sorry
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby Shaggy410 » 11. Nov 2009, 18:17

Well I'm running Karmic x32, with vbox 3.0.10 and I don't have any of the files that you mention above, and I can't figure how to make the USB work in my guest OS. :S
Shaggy410
 
Posts: 2
Joined: 11. Nov 2009, 18:13
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: WXP

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby Shaggy410 » 11. Nov 2009, 19:04

brazz wrote:Many users reported encountering difficulties in the use of USB ports with virtualbox (i.e > 3.0.6). There are many different tracks on the Internet, most recommend the modified /etc/fstab
but in ubuntu karmic there is a method cleaner, simpler and more appropriate:

1 - Add in /etc/udev/rules.d/z80_user.rules (which is a symlink to /etc/udev/user.rules) the 2 lines below:

SUBSYSTEM=="usb_device", GROUP="vboxusers", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="vboxusers", MODE="0666"



2 - Eventually, if any, remove /etc/fstab line
none /proc/bus/usb usbfs devgid = 505, devmode = 664 0 0
if it had been added manually
if nothing is touching :)

3- Reboot, of course :D

It's still very simple, just 2 lines to copy / paste / edit a file ..

Note: it seems that this only works with Karmic x32 not in karmic x64 !



well, after a huge struggle (about 45 minutes fighting with this, and installing a server at the same time @.@)

If the steps above doesn't work for you, other solution is to go to the fstab file (/etc/fstab) and use a sudo gedit /etc/fstab, and in the line that says:
none /proc/bus/usb usbfs devgid=118,devmode=664 0 0

change the number in the devgid for the number of group in which the vboxusers are (in my case the group number was 0)
after that reboot your machine and that's it, you can select your usb devices from the devices tab
Shaggy410
 
Posts: 2
Joined: 11. Nov 2009, 18:13
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: WXP

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 11. Nov 2009, 19:29

Well, it will probably work for virtualbox, but in any case, if you have nothing in your /etc/udev directory, then it is time to let the tests virtualbox and watch your system because it is very strange to have an /etc/udev empty after installing karmic ...
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby Sasquatch » 11. Nov 2009, 21:00

Will everyone please read the VirtualBox FAQ before they FUBAR their system? You should NOT have to mess around with udev rules. Changing them can seriously damage your system if you don't know what you're doing.
Read the Forum Posting Guide before opening a topic.
VB FAQ: Check this before asking questions.
User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions + Xorg config
Howto: Use Shared Folders
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Sasquatch
Site Moderator
 
Posts: 11503
Joined: 17. Mar 2008, 13:41
Location: Netherlands
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows XP, Linux

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 11. Nov 2009, 22:03

Oh, but I do not want to start a troll! Easily since it was always planned to add users in udev rules. Of course, we must be careful attention to what is written, attention to the order of execution (that is why the files all begin with a number), etc. But that is exactly like adding scripts in init and so on and no more dangerous than doing anything in fstab! and let me tell you that time as editor in ubuntu doc, I do not always do anything.
I ended up there this discussion does nothing technically.
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby Sasquatch » 11. Nov 2009, 22:06

Well, I have a 64 bit Karmic, no need to change anything. Another system with 32 bit Karmic, upgraded from Intrepic, no udev rule you specify. So, where did you get it from?
Read the Forum Posting Guide before opening a topic.
VB FAQ: Check this before asking questions.
User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions + Xorg config
Howto: Use Shared Folders
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Sasquatch
Site Moderator
 
Posts: 11503
Joined: 17. Mar 2008, 13:41
Location: Netherlands
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows XP, Linux

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 12. Nov 2009, 12:15

Well, after I bothered to go under karmic x64, tada! I am for the first time in a 64-bit OS!
After all these years ...
Well, except that I had a glass of Muscadet then (my French wine region where U.S. troops landed in 1917) but it was not for that !
I stop the madness. In fact everything works perfectly, do not forget to reboot after the change, and it's good.
This fits well (it's always easier after) to what is shown from page 152 of the manual.
What I love in this document is "The various distributions are very creative script from Which the usbfs filesystem is mounted."
They have a sense of humor, Sun, very creative, excellent!
Cheers!


Note: On udev facts, see http://www.reactivated.net/writing_udev_rules.html great paper !
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby Sasquatch » 12. Nov 2009, 22:15

So you agree with me that messing around with the udev rules are not needed.
Read the Forum Posting Guide before opening a topic.
VB FAQ: Check this before asking questions.
User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions + Xorg config
Howto: Use Shared Folders
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Sasquatch
Site Moderator
 
Posts: 11503
Joined: 17. Mar 2008, 13:41
Location: Netherlands
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows XP, Linux

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby brazz » 12. Nov 2009, 22:44

No, what I said like-doc is that if ubuntu, virtualbox the settings are done in udev for Fedora that can be anything on a Mac is something else,
and thus more. Hence the comment a little ironic Sun "...various distributions are very creative script..."
But regarding karmic ubuntu, this is where it happens, and there is no danger in creating-as shown-its own rules in a file specific udev.
To go further because the use of udev is not limited to virtualbox, see the documentation below.
http://www.reactivated.net/writing_udev_rules.html
brazz
 
Posts: 9
Joined: 4. Nov 2009, 21:43
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows

Re: HowTo manage USB in virtualbox 3.0.10 on Ubuntu

Postby Sasquatch » 12. Nov 2009, 23:35

I still stand with my original statement, it should NOT be needed, nor done. Group membership is all that's needed. As a last resort, you can add the fstab entry for mounting /proc/bus/usb.
Read the Forum Posting Guide before opening a topic.
VB FAQ: Check this before asking questions.
User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions + Xorg config
Howto: Use Shared Folders
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Sasquatch
Site Moderator
 
Posts: 11503
Joined: 17. Mar 2008, 13:41
Location: Netherlands
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows XP, Linux

Next

Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: Perryg, unh and 18 guests