现在的位置: 首页 > 综合 > 正文

VirtualBox共享文件夹失败

2012年09月04日 ⁄ 综合 ⁄ 共 3074字 ⁄ 字号 评论关闭
VirtualBox是个不错的虚拟机,今天打算从VMWare迁移到VirtualBox。安装VirtualBox和虚拟机的方法请参照本博客的其他文章,这里重点说下,在安装共享文件夹时的一个失败原因。
1 -- 安装共享文件夹失败现象以及查错

STEP01 在VirtualBox上设置共享文件夹名称:MyShareE,该共享文件夹指向主机的“E:/Share”目录。
STEP02 在虚拟机上进行挂接:mount -t vboxsf MyShareE /mnt/Share。执行该语句之后出现如下错误:

/sbin/mount.vboxsf: mounting failed with the error: No such device

STEP03 在网上搜索之后,发现出现该问题的原因是没有正确安装增强功能包。我们可用命令“lsmod | grep vboxsf”来检测是否成功安装该增强包。

如果已经正确安装到虚拟机上,执行该命令后,将出现如下显示:

linux-rwdx:~ # lsmod | grep vboxsf
vboxsf                 37328  1 
vboxguest             195176  2 vboxsf

STEP04 该虚拟机上没有如上显示,所以打算重新安装增强功能包(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         done

STEP05 按照错误提示,到日志文件“/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= and run Make again.  Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

根据此错误提示,推断应该是没有安装内核源代码,所以决定为该虚拟机重新安装Kernel。

2 -- 安装Linux内核源代码

STEP01 将虚拟机的光驱指向安装光盘,让系统从光盘启动。

cc

STEP02 从光盘启动后,在如下界面选择“Installation”。

bb

STEP03 一路Next,到“Installation Mode”界面,选择安装类型。

因为我们是在已安装操作系统上补装LinuxKernel,所以选择“Update”安装模式。

2

STEP04 点击“Next”,进入“Installation Setting”界面。

3

STEP05 在上述界面中,点击“Packages”,进入安装包选择界面。选择过滤“Installation Sources”,然后右面的选择框中,选择“kernel-source”。

4

STEP06 点击“Accept”到如下确认界面,选择“Start Update”开始安装。

5

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

抱歉!评论已关闭.