1 -- 安裝共享文件夾失敗現象以及查錯
STEP01 在VirtualBox上設置共享文件夾名稱:MyShareE,該共享文件夾指向主機的“E:/Share”目錄。
STEP02 在虛擬機上進行掛接:mount -t vboxsf MyShareE /mnt/Share。執行該語句之后出現如下錯誤:
/sbin/mount.vboxsf: mounting failed with the error: No such deviceSTEP03 在網上搜索之后,發現出現該問題的原因是沒有正確安裝增強功能包。我們可用命令“lsmod | grep vboxsf”來檢測是否成功安裝該增強包。
如果已經正確安裝到虛擬機上,執行該命令后,將出現如下顯示:
linux-rwdx:~ # lsmod | grep vboxsf vboxsf 37328 1 vboxguest 195176 2 vboxsfSTEP04 該虛擬機上沒有如上顯示,所以打算重新安裝增強功能包(Guest Additions)。
掛接增強功能包光盤后,到/mnt/cdrom目錄下執行:./VBoxLinuxAdditions.run。發現有如下的錯誤(紅色強調部分):
linux-rwdx:/mnt/cdrom # ./VBoxLinuxAdditions.run install Verifying archive integrity... All good. Uncompressing VirtualBox 4.2.0 Guest Additions for Linux.......... VirtualBox Guest Additions installer Removing installed version 4.2.0 of VirtualBox Guest Additions... Removing existing VirtualBox DKMS kernel modules done Removing existing VirtualBox non-DKMS kernel modules done Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module failed (Look at /var/log/vboxadd-install.log to find out what went wrong) Doing non-kernel setup of the Guest Additions done Installing the Window System drivers Installing X.Org 6.9/7.0 modules done Setting up the Window System to use the Guest Additions done You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components doneSTEP05 按照錯誤提示,到日志文件“/var/log/vboxadd-install.log”中查找原因。該日志中有如下錯誤提示:
linux-rwdx:/mnt/cdrom # cat /var/log/vboxadd-install.log /tmp/vbox.0/Makefile.include.header:115: *** Error: unable to find the include directory for your current Linux kernel. Specify KERN_INCL=根據此錯誤提示,推斷應該是沒有安裝內核源代碼,所以決定為該虛擬機重新安裝Kernel。and run Make again. Stop. Creating user for the Guest Additions. Creating udev rule for the Guest Additions kernel module.
2 -- 安裝Linux內核源代碼
STEP01 將虛擬機的光驅指向安裝光盤,讓系統從光盤啟動。

STEP02 從光盤啟動后,在如下界面選擇“Installation”。

STEP03 一路Next,到“Installation Mode”界面,選擇安裝類型。
因為我們是在已安裝操作系統上補裝LinuxKernel,所以選擇“Update”安裝模式。

STEP04 點擊“Next”,進入“Installation Setting”界面。

STEP05 在上述界面中,點擊“Packages”,進入安裝包選擇界面。選擇過濾“Installation Sources”,然后右面的選擇框中,選擇“kernel-source”。

STEP06 點擊“Accept”到如下確認界面,選擇“Start Update”開始安裝。

STEP07 成功安裝后,我們再安裝增強包,如下提示表明成功安裝。
linux-rwdx:/mnt/cdrom # ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.2.0 Guest Additions for Linux.......... VirtualBox Guest Additions installer Removing installed version 4.2.0 of VirtualBox Guest Additions... Removing existing VirtualBox DKMS kernel modules done Removing existing VirtualBox non-DKMS kernel modules done Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module done Building the shared folder support module done Not building the VirtualBox advanced graphics driver as this Linux version is too old to use it. Doing non-kernel setup of the Guest Additions done You should restart your guest to make sure the new modules are actually used Installing the Window System drivers Installing X.Org 6.9/7.0 modules done Setting up the Window System to use the Guest Additions done You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components done