【问题标题】:Vagrant unable to mount synced folder on linux guest -- :Protocol ErrorVagrant 无法在 linux guest 上挂载同步文件夹——:协议错误
【发布时间】:2017-10-08 11:14:16
【问题描述】:

我在使用 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 和安装的来宾添加都是 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 显示共享文件夹的名称带有小写的“v”,即使在重新启动机器后也是如此。

我真的需要 vagrant 的默认行为才能正常工作而不会出错。是什么导致这种情况发生?

【问题讨论】:

    标签: linux vagrant virtualbox mount


    【解决方案1】:

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

    /home/vagrant/vagrant --> /vagrant
    

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

    【讨论】:

      猜你喜欢
      • 2017-06-23
      • 2014-05-08
      • 2014-12-29
      • 2014-12-14
      • 1970-01-01
      • 2019-11-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多