14
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

updated at

Organization

vagrant upでBoxのダウンロードエラーとなる場合の対処方法

この記事の対象

  • [試して理解]Linuxのしくみという本を読みはじめて、「いやいや物理サーバの用意は無理ですっ!」ってなり、おとなしくVagrantでubuntu-16.04環境を用意しようと、久しぶりにvagrant upしたもののエラーが出てBoxのDL出来なかった人(自分)向け
  • 歴史的背景によりVagrantのバージョンを最新にできない人

tl;dr

DL URL変わってるようなのでVagrantfileの先頭に下記の設定追加してvagrant upすれば:ok_hand:

Vagrantfile
# 先頭に追加
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
...

参考: https://github.com/hashicorp/vagrant/issues/9442#issuecomment-363080565

確認環境など

マシン: Mac
OS: macOS Sierra(10.12.16)

// Vagrantのバージョン
$ vagrant -v
Vagrant 1.8.6

// VirtualBoxのバージョン
$ VBoxManage -v
5.1.8r111374

以下詳細

Vagrantfileの記述例

こんな感じで行けるだろうと思って書いた例

Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.provider :virtualbox do |vbox|
    vbox.memory = "256"
    vbox.cpus = 2
  end
end

だがしかし…

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/ubuntu-16.04' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
The box 'bento/ubuntu-16.04' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/bento/ubuntu-16.04"]
Error: The requested URL returned error: 404 Not Found

そこで

Vagrantfile
# 先頭に追加
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/ubuntu-16.04' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'bento/ubuntu-16.04'
    default: URL: https://vagrantcloud.com/bento/ubuntu-16.04
==> default: Adding box 'bento/ubuntu-16.04' (v201803.24.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/bento/boxes/ubuntu-16.04/versions/201803.24.0/providers/virtualbox.box
    default: Progress: 12% (Rate: 135k/s, Estimated time remaining: 0:49:09)
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
14
Help us understand the problem. What are the problem?