vagrant up错误
2019-11-15 本文已影响0人
imjcw
前言
近期重置了win10系统,啥软件都没有了,开发环境也准备重新安装。但是在删除文件的时候,没注意将所有的box都删了,只能从新下载box。
vagrant up出错
啥也不说,先上错误信息。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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: Adapter 2: hostonly
==> 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: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => D:/dev/nginx
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 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:
mount: unknown filesystem type 'vboxsf'
找了一大堆解决方案之后,都说安装啥插件就OK了,下面是该命令。
然而又出错了...
$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is:
An error occurred while installing vagrant-share (1.1.6), and Bundler cannot continue.
Make sure that `gem install vagrant-share -v '1.1.6'` succeeds before bundling.
Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.Bundler::GemspecError: Could not read gem at C:/Users/j1232/.vagrant.d/gems/cache/vagrant-share-1.1.6.gem. It may be corrupted.
于是又找别的解决方案,终于让我发现一个。
解决方案
其实vagrant up出错的时候,就可以登陆服务器了,只是目录共享失败了而已。
执行vagrant ssh登陆服务器,并执行命令。
//我用的ubuntu,所以是apt-get
sudo apt-get update
sudo apt-get install virtualbox-guest-utils
这个时候一切OK,再执行
exit
vagrant reload
成功!!!
总结
其实是因为box本身的问题,安装好相关软件就OK了。折腾许久,不知是该开心还是难过。
-- EOF --
本文转载自IMJCW
原文链接:vagrant up错误