【问题标题】:Error when doing vagrant up做流浪汉时出错
【发布时间】:2014-07-18 13:49:59
【问题描述】:

当我执行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

【问题讨论】:

    标签: virtualbox vagrant base vagrantfile


    【解决方案1】:

    我遇到了这个问题。我正在创建文件夹,并使用以下命令:

    vagrant init
    vagrant box add hashicorp/precise64
    vagrant up
    

    并收到有关下载远程文件的错误。

    试试这个:

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

    希望这能解决您的问题

    【讨论】:

    • 谢谢!我花了无数个小时试图解决这个问题。
    • 对我不起作用.. 而不是寻找 /my/path/to/foo 它现在正在寻找 /my/path/to/foo/foo
    • 从一年前开始,由于连续的错误,我已经失去了安装宅基地的希望,但有了你的伎俩,现在我的宅基地工作了。非常感谢@Martin
    • 嗯,很有趣,因为如果你只是浏览 vagrant 网站上的教程,你最终会遇到这个问题,因为它会引导你完成这些确切的步骤:创建文件夹,转到文件夹, vagrant init,vagrant box 添加 hashcorp/precise64,vagrant up -> 错误。 init 的附加参数创建了一个 .vagrant 子文件夹,其中包含完成这项工作所需的附加部分。第一个入门页面让你运行 vagrant init hashcorp/precise64,但它没有告诉你在哪里运行它,接下来的页面会引导你进入这个洞,没有解释。
    【解决方案2】:

    根本问题是您的 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 hashcorp-VAGRANTSLASH-precise32/

    最后一行告诉你你只有一个盒子,它是精确的 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”时都重命名。

    【讨论】:

    • 转到 .vagrant.d/boxes/ 并将文件夹“laravel-VAGRANTSLASH-homestead”名称更改为“base”。为我工作。
    【解决方案3】:

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

    试试看:

    vagrant init "你的盒子名"

    这对我有用。

    also see

    【讨论】:

      【解决方案4】:

      你可以通过简单地安装 vagrant hostupdater 来解决这个问题

      $ vagrant plugin install vagrant-hostsupdater
      

      【讨论】:

        【解决方案5】:

        在 git bash 上运行这个命令:

        1. $ vagrant box list
          以下结果:
          --$ vagrant box 列表
          --2017/07/03 00:30:19 启动器:检测到 32 位 Windows 安装
          --ubuntu/trusty64(虚拟机,20170619.0.0)
          复制框名:ubuntu/trusty64
        2. $ vagrant init ubuntu/trusty64
        3. $ vagrant up

        【讨论】:

          【解决方案6】:

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

          【讨论】:

            【解决方案7】:

            在 git bash 上运行这个命令:

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

            和我一起工作

            【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2018-03-07
            • 1970-01-01
            • 1970-01-01
            • 2023-04-01
            • 2017-11-08
            • 1970-01-01
            • 2015-07-18
            相关资源
            最近更新 更多