14

当我执行以下操作时出现此错误vagrant up

anr@anr-Lenovo-G505s ~ $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /home/anr/base

这是我拥有的 Vagrantfile:

 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 Vagrant.configure('2') do |config|
   config.vm.box      = 'precise32'
   config.vm.box_url  = 'http://files.vagrantup.com/precise32.box'
   config.vm.hostname = 'bootcamp'
   config.ssh.forward_agent = true

config.vm.provider 'vmware_fusion' do |v, override|
  override.vm.box     = 'precise64'
  override.vm.box_url = 'http://files.vagrantup.com/precise64_vmware.box'
end

config.vm.provider 'parallels' do |v, override|
  override.vm.box = 'parallels/ubuntu-12.04'
  override.vm.box_url = 'https://vagrantcloud.com/parallels/ubuntu-12.04'

# Can be running at background, see https://github.com/Parallels/vagrant-parallels/issues/39
v.customize ['set', :id, '--on-window-close', 'keep-running']
end

config.vm.network :forwarded_port, guest: 3000, host: 3000

 config.vm.provision :puppet do |puppet|
   puppet.manifests_path = 'puppet/manifests'
   puppet.module_path    = 'puppet/modules'
 end

结尾

这是我的机器设置:

 vagrant -v     Vagrant 1.6.2
 VirtualBox     4.3.2
 Linux Mint 15 Olivia Cinammon
4

7 回答 7

43

I was having this problem. I was creating the folder, and using the following commands:

vagrant init
vagrant box add hashicorp/precise64
vagrant up

and getting the error about downloading the remote file.

Try this:

create a folder,
cd folder
vagrant init hashicorp/precise64 (or whatever vm you want to run)
vagrant up

Hopefully this resolves your issue

于 2014-08-18T22:00:26.773 回答
4

根本问题是您的 VM 机器被贴错标签。我也意识到您的目标是“precise32”,但我在这里使用“base”作为示例。

如果您要导航到:

~/.vagrant.d/boxes

你会看到这样的东西:

$ ls -la

drwxr-xr-x 4 some_user 员工 136 Oct 22 09:43 ./ drwxr-xr-x 10 some_user 员工 340 Oct 22 09:41 ../ drwxr-xr-x 4 some_user 员工 136 Jun 29 13:23 hashicorp-VAGRANTSLASH -精确32/

最后一行告诉你你只有一个盒子,它是精确的 32 盒子。

但是,假设您设置了默认的 Vagrant 设置,如下所示:

$ cd ~/src/vagrant/myvm
$ vagrant init

如果您查看为您创建的 Vagrant 文件:

$ vim Vagrant

您将看到以下输出:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.box = "base" 
end

请注意,它正在寻找名为“base”的框!所以我所做的是:

$ cd ~/.vagrant.d/boxes
$ cp -R hashicorp-VAGRANTSLASH-precise32 base
$ cd ~/src/vagrant/myvm
$ vagrant up

然后您可以返回并删除“hashicorp-VAGRANTSLASH-precise32”框,因为它现在是重复的。

当然,你可以用另一种方式这样做并重命名

config.vm.box = "base"

不管你的盒子叫什么,但我发现前一种方式更好,因为如果你想基于默认盒子创建第二个虚拟机,那么你将面临同样的问题。所以最好重命名这个盒子,而不是每次你“vagrant init”时都重命名。

于 2014-10-22T13:53:42.623 回答
1

如果您将默认名称重命名为“base”

试试看:

vagrant init“你的盒子名称”

这对我有用。

也见

于 2017-03-15T09:22:09.323 回答
0

您只需安装 vagrant hostupdater 即可解决此问题

$ vagrant plugin install vagrant-hostsupdater
于 2016-08-20T08:49:28.573 回答
0

将您的 vagrant 版本降级为 1.9.2。从此链接下载到适用于 Windows 的 MSI 文件。 并重新启动您的 PC。在 BIOS 设置中启用虚拟化。然后再次尝试使用 vagrant up 命令。这肯定会奏效。

于 2018-03-03T05:08:34.157 回答
0

在 git bash 上运行此命令:

  1. $ vagrant box 列出
    以下结果:
    --$ vagrant box list
    --2017/07/03 00:30:19 启动器:检测到 32 位 Windows 安装
    --ubuntu/trusty64 (virtualbox, 20170619.0.0)
    复制 boxname : ubuntu/trusty64
  2. $ vagrant init ubuntu/trusty64
  3. $ vagrant up
于 2017-07-02T17:41:48.980 回答
-1

在 git bash 上运行此命令:

cp /mingw64/bin/curl.exe /c/HashiCorp/Vagrant/embedded/bin/curl.exe

跟我一起工作

于 2016-07-29T13:46:08.843 回答