Vagrant错误:无法安装VirtualBox共享文件夹(客户添加,vboxsf)

问题

我在Windows 10上安装了stream浪汉,这样我就可以在虚拟机中创build个人本地开发环境。 我读过的关于Vagrant的一切都表示,我甚至可以启动多个系统,并通过NAT端口转发testing它们之间的通信。 但是首先,我只想在创build一个开发环境虚拟机之前,先创build一个虚拟机。

我通过这个SitePoint教程安装了VirutalBox,Vagrant,PuTTy和PuTTYGen: https ://www.sitepoint.com/getting-started-vagrant-windows/。 接下来,我在C:盘上创build了一个vagrant项目文件夹,做了vagrant init ,删除了Vagrantfile ,最后, vagrant init ubuntu/trusty64 。 然后,我做了vagrant up ,但过程失败,错误:

Vagrant无法安装VirtualBox共享文件夹。 这通常是因为文件系统“vboxsf”不可用。 该文件系统通过VirtualBox Guest Additions和内核模块提供。 请validation这些客人添加已正确安装在客人。 这不是一个stream浪者的错误,通常是由一个错误的stream浪者箱子造成的。 对于上下文,尝试的命令是:

mount -t vboxsf -o uid = 1000,gid = 1000stream浪/stream浪

该命令的错误输出是:

: 无此文件或目录

以下是我的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 

我的设置

 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 

插件和扩展安装

 Vagrant: - vagrant-share (1.1.6, system) - vagrant-vbguest (0.13.0) 

我试过了什么

这个SOpost在我的研究中似乎是最有希望的:
Vagrant错误:无法在Linux guest虚拟机中装入文件夹 。

不幸的是,没有提供的解决scheme,也没有提供的任何链接解决了这个问题。 我已经尝试了一堆东西,但我不是一个系统pipe理员(我猜测是你需要解决这个问题的技能)。 尤其令人担忧的是,2013/2014年的许多“解决scheme”最近被指出不再适用。 这些解决scheme讨论了一些关于符号链接无法正常工作的问题,安装像vagrant-vbguest这样的插件,以及有关vbox addtions不匹配的东西。 我不是很了解这一切,但我尽了最大的努力。 这是我已经尝试过,但尚未解决的问题:

  1. vagrant plugin install vagrant-vbguest 。 Vagrant将安装的插件显示出来,但我在vagrant up遇到同样的错误。

  2. 我在研究这个没有提供工作解决scheme的问题时阅读的链接列表。

    • Vagrant无法在Windows 7上使用VirtualBox Guest Additions在Linux guest虚拟机上安装
    • Vagrant – 我如何安装virtualbox共享文件夹? (“vboxsf”不可用)
    • https://github.com/mitchellh/vagrant/issues/3341#issuecomment-144271026
    • https://www.virtualbox.org/ticket/12879 (这个VirtualBox门票在其他一些列出的链接的海报引用。不幸的是,这张门票没有解决这个问题,它不是固定的,仍然是坏的…或者…也许这个票是相关的,但是与我和其他人仍然遇到的问题稍有不同)。
    • https://gist.github.com/fernandoaleman/5083680
    • VAGRANT共享文件夹不要装载 – Windows 7 – stream浪汉1.7.4 – Ubuntu 12.04精确64 – VirtualBox 5.0.10与客户添加

我的问题

  1. 我怀疑这个问题是与VirtualBox,而不是Vagrant。 这是真的?

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

  3. 从2014年左右开始,栈溢出回答的stream浪问题似乎大幅度下降。这是什么原因? Vagrant / VirtualBox不再被认为是“最佳实践”? 有没有更好的解决scheme,让用户无视stream浪汉问题?

再说一次,我不是系统pipe理员,但是我在技术上是精明的,如果一步一步地给出,可以按照技术指导。

任何帮助表示赞赏。

这个问题在VirtualBox 5.1.18中解决。

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

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

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

在我的主机上。

我这样做,它在Windows 10上工作得很好! 我想补充我在第206行做的事情:

编辑之前:“\\?\”+ path.gsub(“/”,“\”)

编辑之后:path.gsub(“/”,“\”)

 vagrant plugin install vagrant-vbguest 

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

Guest Additions与VirtualBox的版本不兼容。 自动添加VirtualBox Guest Additions将解决可能相关的问题:

vagrant插件安装vagrant-vbguest

我用这些堆栈显示了这个问题:

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

可能有多种原因:

  1. 客户添加的版本与VirtualBox的版本不匹配,为此,您可以通过运行vagrant plugin install vagrant-vbguest来更新客户版本。 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的默认安装

我有同样的问题,这只是客人补充不是最新的…

从5.1.16降级到Virtual Box 5.1.14可以正常工作。

我使用的是Vagrant 1.9.4和VirtualBox 5.1.20。 这里没有解决方案帮助我。

我终于通过禁用客户添加的自动更新来解决问题:

 Vagrant.configure("2") do |config| config.vbguest.auto_update = false [...] end 

这比解决方案更像是一种拙劣的解决方法。 我仍然不知道真正的问题是什么,但是我认为它与此有关: https : //www.virtualbox.org/ticket/16670

Virtualbox 5.1.20也有一个回归

流浪问题: https : //github.com/mitchellh/vagrant/issues/8502

Virtualbox问题: https ://www.virtualbox.org/ticket/16670#comment:4

目前的修复方法是将其作用回Virtualbox 5.1.18。

我有类似的问题,检查标题,如果不匹配,然后运行下面的命令

CentOS:sudo yum update && sudo yum -y安装kernel-headers kernel-devel

流浪汉重新加载

这个对我有用。

这是Vbox中的错误。 有一个解决方案来解决。

登录到Vbox客户端:默认密码是(流浪/流浪)

 su ln -sf /opt/VBoxGuestAdditions-5.1.20/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant 

关掉

从本地机器cmd提示符运行cmd:

 vagrant up 

它会工作。