VirtualBox共享文件夹失败

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

(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

转载于:https://www.cnblogs.com/motadou/archive/2013/01/11/2857076.html

VirtualBox共享文件夹是一种在虚拟机和主机之间共享文件的功能。根据引用\[1\],如果你在虚拟机下查看共享文件夹的属性发现没有权限,你可以通过在终端中输入指令"sudo usermod -aG vboxsf $(whoami)"来解决这个问题。这个指令将把当前用户添加到vboxsf组中,从而获得对共享文件夹的访问权限。 另外,根据引用\[2\],你也可以通过以下步骤来设置共享文件夹: 1. 点击设备,然后选择共享文件夹。 2. 在固定分配旁边有一个添加共享文件夹的标识,点击该标识。 3. 选择共享文件夹的路径,并勾选自动加载和固定分配选项。请确保文件夹的名称不包含中文,并可以放在任何盘符下,比如E:\shared。 4. 点击设备,选择安装增强功能。在弹出的选择框中点击运行。 5. 等待增强功能的安装完成,可能需要一些时间。安装完成后,重新启动虚拟机。 通过以上步骤,你应该能够成功设置和访问VirtualBox共享文件夹。 #### 引用[.reference_title] - *1* *2* [virtualbox:如何设置共享文件夹以及可能会遇到的问题](https://blog.csdn.net/LUCAS004/article/details/108181989)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值