13
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-05-16

この記事の対象

  • [試して理解]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)
13
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?