问题
我在Windows 10上安装了Vagrant,以便在虚拟机中创建个人本地开发环境。我读到的有关Vagrant的所有信息都说我甚至可以启动多个系统,并使用NAT端口转发测试它们之间的通信。但是首先,我只想创建一个开发环境的虚拟机,在进行其余操作之前。
按照SitePoint教程:https://www.sitepoint.com/getting-started-vagrant-windows/,我安装了VirtualBox、Vagrant、PuTTy和PuTTYGen。接下来,我在C:驱动器上创建了一个vagrant项目文件夹,执行了vagrant init
,删除了Vagrantfile
,最后执行了vagrant init ubuntu/trusty64
。然后我执行了vagrant up
,但是该过程失败并显示以下错误:
Vagrant无法挂载VirtualBox共享文件夹。这通常是因为文件系统“vboxsf”不可用。此文件系统通过VirtualBox Guest Additions和内核模块提供。请验证这些Guest Additions是否已正确安装在guest中。这不是Vagrant中的错误,通常是由于有缺陷的Vagrant box引起的。针对此命令的上下文是:
mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
命令的错误输出为:
: No such file or directory
这是我的Windows命令行的屏幕截图:
以下是文本版本:
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)
我已经尝试过的方法
这篇文章在我的研究中似乎是最有希望的。
不幸的是,提供的解决方案以及提供的链接都没有解决问题。我已经尝试了很多东西,但我不是系统管理员(我猜想这是需要解决问题的技能集)。特别令人不安的是,许多2013/2014年的“解决方案”最近被指示为不再起作用。这些解决方案涉及到符号链接无法工作、安装像vagrant-vbguest这样的插件,以及关于vbox添加不能匹配某些内容的问题。我并不完全理解这一切,但我尽力了。以下是我已经尝试过但仍未解决问题的内容:
vagrant plugin install vagrant-vbguest
。Vagrant显示插件已安装,但我在vagrant up
时仍然遇到同样的错误。我阅读的与此问题相关的链接列表,没有提供有效的解决方案。
- Vagrant无法在Windows 7上的Linux guest中安装VirtualBox Guest Additions
- 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 SHARED FOLDERS DO NOT MOUNT - Windows 7 - Vagrant 1.7.4 - Ubuntu 12.04 precise64 - VirtualBox 5.0.10 with Guest Additions
我的问题
我怀疑问题出在VirtualBox上,而不是Vagrant。这是真的吗?
我该如何解决此问题以便能够继续进行教程?
自2014年左右以来,在Stack Overflow上回答有关Vagrant的问题数量似乎已经大幅减少。这是什么原因呢?Vagrant/VirtualBox不再被认为是“最佳实践”了吗?是否有更好的解决方案,以至于用户正在忽略Vagrant问题?
再次声明,我不是系统管理员,但我在技术方面很有经验,并且可以遵循技术指导。