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

この記事は最終更新日から1年以上が経過しています。

この記事の対象

  • [試して理解]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)
pepabo
「いるだけで成長できる環境」を標榜し、エンジニアが楽しく開発できるWebサービス企業を目指しています。
https://pepabo.com
ユーザー登録して、Qiitaをもっと便利に使ってみませんか。
  1. あなたにマッチした記事をお届けします
    ユーザーやタグをフォローすることで、あなたが興味を持つ技術分野の情報をまとめてキャッチアップできます
  2. 便利な情報をあとで効率的に読み返せます
    気に入った記事を「ストック」することで、あとからすぐに検索できます
コメント
この記事にコメントはありません。
あなたもコメントしてみませんか :)
すでにアカウントを持っている方は
ユーザーは見つかりませんでした