Vagrant错误:无法挂载VirtualBox共享文件夹(访客添加,vboxsf)

Eri*_*010 33 windows virtualbox shared-directory vagrant vagrant-windows

问题

我在Windows 10上安装了Vagrant,因此我可以在虚拟机中创建个人本地开发环境.我读到的关于Vagrant的一切都说我甚至可以通过NAT端口转发来启动多个系统并测试它们之间的通信.但首先,我只是希望在我与其余部分进行过多讨论之前创建一个开发环境虚拟机.

我按照SitePoint教程安装了VirtualBox,Vagrant,PuTTy和PuTTYGen:https://www.sitepoint.com/getting-started-vagrant-windows/ .接下来,我在C:驱动器上创建了一个vagrant项目文件夹vagrant init,删除了Vagrantfile,最后删除了vagrant init ubuntu/trusty64.然后我做了vagrant up,但过程失败并出现错误:

Vagrant无法挂载VirtualBox共享文件夹.这通常是因为文件系统"vboxsf"不可用.该文件系统通过VirtualBox Guest Additions和内核模块提供.请验证这些客人添加内容是否已在guest虚拟机中正确安装.这不是Vagrant中的错误,通常是由错误的Vagrant框引起的.对于上下文,尝试的命令是:

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

该命令的错误输出是:

: 没有相应的文件和目录

这是我的Windows命令行的屏幕截图:

Vagrant/VirtualBox错误的屏幕截图

这是一个文本版本:

C:\vagrant\sitepoint-test-2017-02-05>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently
==> default: have version '20160602.0.0'. The latest is version '20170202.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: sitepoint-test-2017-02-05_default_1486399403587_55255
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => C:/vagrant/sitepoint-test-2017-02-05
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:

: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我的设置

OS: Microsoft Windows [Version 10.0.14393]
VirtualBox Version: 4.3.10 r93012
GuestAdditions Version: ???
Vagrant Version: 1.9.1 (Latest)
PuTTy Version: 0.67
PuTTYGen Version: 0.67
Run Code Online (Sandbox Code Playgroud)

已安装插件和扩展程序

Vagrant:
- vagrant-share (1.1.6, system)
- vagrant-vbguest (0.13.0)
Run Code Online (Sandbox Code Playgroud)

我已经尝试过了什么

这篇文章似乎是我研究中最有希望的.

不幸的是,提供的解决方案和提供的任何链接都没有解决问题.我已经尝试了很多东西,但我不是系统管理员(我猜这是你需要对此进行故障排除的技能组合).特别令人不安的是,2013/2014年的许多"解决方案"最近被证明不再有效.这些解决方案涉及与无法正常工作的符号链接有关,安装像vagrant-vbguest这样的插件,以及关于vbox添加不匹配的东西.我并不是真的了解所有这些,但我尽我所能.这是我已经尝试过的尚未解决的问题:

  1. vagrant plugin install vagrant-vbguest.Vagrant将插件显示为已安装,但我收到相同的错误vagrant up.

  2. 我在研究这个没有提供有效解决方案的问题时读过的链接列表.

我的问题

  1. 我怀疑问题出在VirtualBox上,而不是Vagrant.这是真的?

  2. 我该如何解决这个问题,以便继续学习本教程?

  3. 自2014年左右以来,Stack Overflow上回答的Vagrant问题似乎有了大幅下降.这是什么原因?Vagrant/VirtualBox不再被视为"最佳实践"吗?是否有更好的解决方案,因此用户忽略了流浪者的问题?

同样,我不是系统管理员,但我技术精湛,可以遵循技术指导.

小智 28

您可以降级VirtualBox或编辑文件中的行:

在我的设置上,这是第206行:

C:\ HashiCorp \流浪\嵌入\宝石\宝石\流浪-1.9.2\lib中\流浪\ UTIL\platform.rb

在我的主机上.

我这样做了,它在Windows 10上运行良好!我想添加我对第206行所做的事情:

编辑前:"\\?\"+ path.gsub("/","\")

编辑后:path.gsub("/","\")

  • 降级到5.1.14对我有用. (2认同)

小智 27

vagrant plugin install vagrant-vbguest
Run Code Online (Sandbox Code Playgroud)

这对我来说不起作用,它似乎与vagrant 1.9.2不兼容,我卸载了最新版本的虚拟盒子(5.1.16)并安装了最新版本的vagrant 1.9.2和宅基地版本5.1.12.这个对我有用.

  • 这对我有用!我有Vagrant 1.9.2和Virtual Box 5.1.16r113841 (2认同)

YUS*_*DIZ 13

Guest Additions与VirtualBox的版本不兼容.自动更新VirtualBox Guest Additions将解决可能相关的问题:

vagrant plugin安装vagrant-vbguest

我用这些堆栈解决了这个问题:

  • Windows 10
  • Oracle VirtualBox 5.1.16
  • 流浪汉1.9.2
  • config.vm.box ="hashicorp/precise64"

  • 你试过哪个流浪盒?使用与您相同的设置,对我来说,当使用ubuntu/xenial64作为vagrant box时,自动更新virtualbox guest添加内容并不能解决问题.似乎vbox guest添加件在共享文件夹的UNC编码路径流浪者用途中存在一些问题.vbox版本5.1.14工作正常.提前致谢! (3认同)
  • 谢谢,使用5.1.14是解决这个问题的唯一方法. (2认同)

loi*_*ieu 8

可能有多种原因:

  1. guest虚拟机添加的版本与VirtualBox的版本不匹配,为此您可以通过运行更新guest虚拟机添加的版本 vagrant plugin install vagrant-vbguest
  2. 你在Windows上遇到了一个带有NFS的流浪者错误:应该修复所以也许尝试更新到最新版本的Vagrant和VirtualBox
  3. 在这个github问题https://github.com/fideloper/Vaprobash/issues/92中,您可以测试两件事:使用winnfsd插件(https://github.com/winnfsd/vagrant-winnfsd)或尝试配置没有NFS的默认挂载

我有同样的问题,这只是客户添加不是最新的...

UDPATE:Vagrant with Windows on Windows(第2点)的错误已在5.1.18版中修复,重新出现在版本5.1.20中,并在5.2版中再次修复.


小智 8

VirtualBox 5.1.18解决了这个问题.

  • 不幸的是,当我从5.1.18升级到5.1.20时,这个问题**刚刚重新出现** (16认同)