【发布时间】:2017-06-23 18:37:42
【问题描述】:
问题
我在 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 和内核模块提供。 请验证这些来宾添加已正确安装在 客人。这不是 Vagrant 中的错误,通常是由错误引起的 流浪盒子。对于上下文,尝试的命令是:
mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
命令的错误输出是:
: 没有这样的文件或目录
这是我的 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)
我已经尝试过的
This post 似乎是我研究中最有前途的。
很遗憾,所提供的解决方案和所提供的任何链接均未解决该问题。我已经尝试了很多东西,但我不是系统管理员(我猜这是您解决此问题所需的技能)。尤其令人不安的是,2013/2014 年的许多“解决方案”最近都被表明不再有效。这些解决方案讨论了与符号链接不起作用、安装 vagrant-vbguest 之类的插件以及与 vbox 添加不匹配的东西有关的事情。我不是很了解所有这些,但我已尽力而为。这是我已经尝试过但尚未解决的问题:
vagrant plugin install vagrant-vbguest。 Vagrant 显示插件已安装,但我在vagrant up上遇到同样的错误。-
我在研究此问题时阅读的链接列表,但没有提供有效的解决方案。
- Vagrant unable to mount in Linux guest with VirtualBox Guest Additions on Windows 7
- Vagrant - How can I mount the virtualbox shared folder? ("vboxsf" not available)
- 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 的问题?
再次重申,我不是系统管理员,但我精通技术,可以遵循技术指导。
【问题讨论】:
-
嘿埃里克,你找到任何解决方案了吗?我的朋友也遇到了这个问题,我正在帮助他找到解决方案,但我发现的方法对他没有任何帮助。
-
@softtama 最好和最简单的解决方案是将 virtualbox 降级到 5.1.14。与问题github.com/mitchellh/vagrant/issues/8352 相关
标签: windows vagrant virtualbox shared-directory vagrant-windows