VirtualBox文件挂载:/sbin/mount.vboxsf: mounting failed with the error: No such device
1、问题原因
虚拟机挂载宿主机共享文件夹失败
mount -t vboxsf gopath /usr/local/gopath
cd /opt/VBoxGuestAdditions-6.1.24/init/
./vboxadd setup
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules. This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Kernel headers not found for target kernel
3.10.0-1160.88.1.el7.x86_64. Please install them and execute
/sbin/rcvboxadd setup
modprobe vboxguest failed
The log file /var/log/vboxadd-setup.log may contain further information.
2、解决方案
1) 方案一:
如果你是用的vagrant来管理virtualBox的话,可以通过vagrant安装插件来解决:
vagrant plugin install vagrant-vbguest
出现以上说明安装插件成功
2)方案二:
安装gcc等依赖
yum install gcc kernel-devel make
安装完成之后执行
./vboxadd setup
之后出现如下截图信息,则说明启动成功!
mount -t vboxsf gopath /usr/local/gopath
执行挂载,没有报错说明挂载成功!