Vagrant无法在linux guest虚拟机上挂载同步文件夹 - :协议错误

时间:2017-05-10 00:18:48

标签: linux vagrant virtualbox mount

我在使用Vagrant与Windows主机和在VirtualBox中运行的Linux来宾的同步文件夹时遇到一个奇怪的问题。

在第一次启动时(或在vagrant destroy之后),项目文件夹安装到/ vagrant没有任何问题,但在暂停和启动VM后,该文件夹将无法安装。

这是在Vagrant输出结尾处出现的错误消息:

...
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

: Protocol error

Vagrantfile中没有与同步文件夹相关的配置选项,我只是尝试使用默认的同步文件夹行为。

一些类似的问题表明,运行安装Vagrant插件vagrant-vbguest可能会解决一些类似的问题,但我有这个插件。此外,Virtual Box和已安装的guest虚拟机都是5.1.10版本。

一旦机器重新启动,运行sudo mount -t vboxsf vagrant /vagrant只会出现此错误:

/sbin/mount.vboxsf: mounting failed with the error: Protocol error

出于某种原因,sudo mount -t vboxsf Vagrant /vagrant(大写V)将挂载同步文件夹。在第一次启动时mount | grep vagrant显示同步文件夹名为vagrant,小写' v',VirtualBox显示共享文件夹的名称,小写&#39 ; v',甚至在重启盒子之后。

我确实需要流浪汉的默认行为才能正常工作而不会出错。造成这种情况的原因是什么?

1 个答案:

答案 0 :(得分:0)

我设法通过删除作为配置过程的一部分创建的符号链接来解决此问题:

/home/vagrant/vagrant --> /vagrant

我不太明白这个符号链接怎么会导致我遇到的问题,但删除它绝对是解决方案。