Chinaunix首页 | 论坛 | 博客
  • 博客访问: 163130
  • 博文数量: 27
  • 博客积分: 2179
  • 博客等级: 大尉
  • 技术积分: 335
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-21 12:53
文章分类

全部博文(27)

文章存档

2012年(1)

2010年(9)

2009年(7)

2008年(10)

我的朋友

分类: LINUX

2010-04-11 23:16:16

找工作回来,电脑交换给同乡使用。电脑出现了问题,然后他就重新安装了,不知道怎么回事,连我Linux下的分区都搞坏了,只好重新安装系统。还好偶原来一般安装软件都在一个独立的分区,重新安装的软件不多,只有几个,VirtualbBox就是其中一个。

下载安装好最新的后,发现在guest里面用不了U盘。怎么解决呢?

一、想起了VirtualBox安装目录下有一个UserManual.pdf的使用手册,便查看关于USB的相关设置


 

11.5.7 USB not working

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, you need to make sure that the user has

permission to access the USB filesystem (usbfs), which VirtualBox relies on to retrieve

valid information about your host’s USB devices. The rest of this section only applies

to those older systems.

Note: The current rdesktop-vrdp implementation does not support accessing

USB devices through the sysfs!

As usbfs is a virtual filesystem, a chmod on /proc/bus/usb has no effect. The

permissions for usbfs can therefore only be changed by editing the /etc/fstab file.

For example, most Linux distributions have a user group called usb or similar, of

which the current user must be a member. To give all users of that group access to

usbfs, make sure the following line is present:

# 85 is the USB group

none /proc/bus/usb usbfs devgid=85,devmode=664 0 0

Replace 85 with the group ID that matches your system (search /etc/group for “usb”

or similar). Alternatively, if you don’t mind the security hole, give all users access to

USB by changing “664” to “666”.

The various distributions are very creative from which script the usbfs filesys-

tem is mounted. Sometimes the command is hidden in unexpected places.

For SuSE 10.0 the mount command is part of the udev configuration file

/etc/udev/rules.d/50-udev.rules. As this distribution has no user group called

usb, you may e.g. use the vboxusers group which was created by the VirtualBox

installer. Since group numbers are allocated dynamically, the following example uses

85 as a placeholder. Modify the line containing (a linebreak has been inserted to

improve readability)

总的来说意思有如下几点:

  1. 确保正在使用VirtualBox的用户是否为用户组vboxusers一员.

  2. 确保该用户是否有权限去读写usbfs这个文件系统

  3. 修改/proc/bus/usb没有效果,只能通过修改/etc/fstab文件。

  4. 修改/etc/fstab文件,让USB用户组必须有权限去读写usbfs.加入:

    none /proc/bus/usb usbfs devgid=85,devmode=664 0 0

    其中devgid, 85USB用户组的iddevmode,664 为对usbfs 文件系统的权限664

  5. 如果系统没有usb用户组,那么你需要用vboxusers这个在安装VirtualBox的时候产生的用户组。

二、了解后,接着下一步:

2.1、添加当前用户为vboxusers一员

[root@localhost yorks]# cat /etc/group |grep vboxusers

vboxusers:x:501:

[root@localhost yorks]# /usr/sbin/usermod -G vboxusers -a yorks

[root@localhost yorks]# cat /etc/group |grep vboxusers

vboxusers:x:501:yorks


2.2、查看是否有USB的用户组

[root@localhost yorks]# cat /etc/group|grep usb

[root@localhost yorks]# cat /etc/group|grep USB

[root@localhost yorks]#

这里两个都没有,因为没有任何东西输出。

2.3、修改/etc/fstab文件。

[root@localhost yorks]# echo "none /proc/bus/usb usbfs devgid=501,devmode=664 0 0" >> /etc/fstab

[root@localhost yorks]# tail -2 /etc/fstab

/dev/sda7 /home ext3 defaults 0 0

none /proc/bus/usb usbfs devgid=501,devmode=664 0 0

[root@localhost yorks]#

注意:501是在2.1查到的vboxusersid.

2.4、重新执行/etc/fstab的挂载操作。

[root@localhost yorks]# mount -a

mount: none already mounted or /proc/bus/usb busy

[root@localhost yorks]#

出错了。

2.5google: none /proc/bus/usb usbfs devgid=501,devmode=664 0 0,结果:

里面的说的。发现/proc/bus/usb/sys/bus/usb/drivers不同,于是就试着修改,/proc/bus/usb换成/sys/bus/usb/drivers

再次测试:

[root@localhost yorks]# mount -a

[root@localhost yorks]#

这次没有错误了。接着打开VirtualBox,出现了这个提示:

不鸟它。启动guest,插上U盘,提示找到新硬件...OK啦。。享用吧


阅读(4142) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~