1. 程式人生 > >VirtualBox 及一些特殊USB(無驅動)的識別問題(二)解決了不能識別一些特殊USB的問題(其實就是插著USB重啟,很簡單)

VirtualBox 及一些特殊USB(無驅動)的識別問題(二)解決了不能識別一些特殊USB的問題(其實就是插著USB重啟,很簡單)

原來手機怎麼也連不上Linux ,碰巧這幾天又在搞VirtualBox虛擬,剛好手機當時又插上USB的,重啟了下,識別出來了:),只要重啟電腦,不作如下設定,手機都能被識別(不知原因) ;作個標記,有時間再慢慢研究。(或者按下面流程過一遍,再恢復原狀,手機就可以被識別了 ),求解?(請各位知道具體情況的留言,謝過)

再論述一下我的問題吧:

解除安裝了手機之後,仍可以用 lsusb 檢視到其USB與PC的連線;如下:
“Samsung SemiConductor, Inc. ”

但問題來了,這時候mount -a 就不能成功載入我的手機了,當然,df 也沒有它的蹤影;請各位指點!

如果要在VB下識別USB,正常程式還是按以下的來;


這是別人的總結,也不知道其連結了,在此謝過;

VirtulaBox下U盤設定
一、想起了VirtualBox安裝目錄下有一個UserManual.pdf的使用手冊,便檢視關於USB的相關設定。
總的來說意思有如下幾 點:
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, 85為USB使用者組的id。 devmode,664 為對usbfs 檔案系統的許可權664
5.如果系統沒有usb使用者組,那麼你需要用vboxusers這個在安裝VirtualBox的時候產生的使用者組。

二、瞭解後,接著下 一步:
2.1、添加當前使用者為vboxusers一員
[

[email protected] yorks]# cat /etc/group |grep vboxusers
vboxusers:x:501:
[[email protected] yorks]# /usr/sbin/usermod -G vboxusers -a yorks
[[email protected] yorks]# cat /etc/group |grep vboxusers
vboxusers:x:501:yorks


2.2、 檢視是否有USB的使用者組
[[email protected] yorks]# cat /etc/group|grep usb
[[email protected]
yorks]# cat /etc/group|grep USB
[[email protected] yorks]#
這裡兩個都沒有,因 為沒有任何東西輸出。

2.3、修改/etc/fstab檔案。
[[email protected] yorks]# echo "none /proc/bus/usb usbfs devgid=501,devmode=664 0 0" >> /etc/fstab
[[email protected] yorks]# tail -2 /etc/fstab
/dev/sda7 /home ext3 defaults 0 0
none /proc/bus/usb usbfs devgid=501,devmode=664 0 0
[[email protected] yorks]#
注意:501是在2.1查到的 vboxusers組id.

2.4、重新執行/etc/fstab的掛載操作。
[[email protected] yorks]# mount -a
mount: none already mounted or /proc/bus/usb busy
[[email protected] yorks]#
出錯了。

2.5、google: none /proc/bus/usb usbfs devgid=501,devmode=664 0 0,結果:
************Fedora中文論壇裡面的說的。發現/proc/bus/usb和/sys /bus/usb/drivers不同,於是就試著修改,將/proc/bus/usb換成/sys/bus/usb/drivers。**********
再次測 試:
[[email protected] yorks]# mount -a
[[email protected] yorks]#
這次沒 有錯誤了。接著開啟VirtualBox,出現了這個提示:
不鳥它。啟動guest,插上U盤,提示找到新硬體...OK啦。。享用吧。

從這個連結也得到了一些啟發:

附:VirtualBox USB解決方案之官方原文

USB

To get USB support, you need the PUEL (non-free) version. Via the GUI, there is an option to enable USB. Furthermore, your user must be able to access /proc/bus/usb/* Since Gutsy, /proc/bus/usb is not mounted by default. Version 2.0.6 removes the need for the following lines to be added, but /proc/bus/usb must still be mounted. Previously, in Intrepid, you needed to add the following lines to /etc/init.d/mountdevsubfs.sh right after domount devpts "" /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE but before the ending } for the dostart shell function. For Gutsy and Hardy you just need to edit /etc/init.d/mountdevsubfs.sh and uncomment the following lines:

        #
        # Magic to make /proc/bus/usb work in virtualbox version < 2.0.6
        #
        mkdir -p /dev/bus/usb/.usbfs
        domount usbfs "" /dev/bus/usb/.usbfs usbfs -obusmode=0700,devmode=0600,listmode=0644
        ln -s .usbfs/devices /dev/bus/usb/devices
        mount --rbind /dev/bus/usb /proc/bus/usb

Then run the script that you just edited:

sudo /etc/init.d/mountdevsubfs.sh start

In order to give users in the vboxusers group write permissions to the devices in /proc/bus/usb, you'll need to edit some rules in /etc/udev/rules.d. Under Gutsy, edit /etc/udev/rules.d/40-permissions.rules to say the following:

# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device",                MODE="0664", GROUP="vboxusers"

Under Hardy and Intrepid, edit /etc/udev/rules.d/40-basic-permissions.rules to say the following:

# USB devices (usbfs replacement)
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664", GROUP="vboxusers"
SUBSYSTEM=="usb_device",                MODE="0664", GROUP="vboxusers"

Then, restart the udev service:

sudo /etc/init.d/udev restart

Now, if you haven't done it already, make sure your user is part of the group vboxusers using the following command:

sudo usermod -G vboxusers -a `whoami`