本日、普段使っているpublic Vagrant boxに対してvagrant box add
を実行したところ、404 not foundになってしまいました。
$ vagrant --version
Vagrant 1.8.1
$ vagrant box add --provider libvirt elastic/ubuntu-16.04-x86_64
The box 'elastic/ubuntu-16.04-x86_64' 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/elastic/ubuntu-16.04-x86_64"]
Error: The requested URL returned error: 404 Not Found
$
比較的マイナーなboxだったので、作者が提供を辞めてしまったのかなと思ったものの、ちゃんとサイトはありました。
Vagrant box elastic/ubuntu-16.04-x86_64 - Vagrant Cloud
もっとメジャーなUbuntu公式イメージをaddしようとしても同じ問題が発生しました。
$ vagrant box add --provider libvirt ubuntu/trusty64
The box 'ubuntu/trusty64' 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/ubuntu/trusty64"]
Error: The requested URL returned error: 404 Not Found
$
先月同じコマンドを実行したときには動いていたはずなので、なんかおかしいなあと思って色々調べていたら、Vagrantのgithubに、つい二日前に登録された怪しいissueを見つけました。
vagrant box update - Fails with 404 Not Found error · Issue #9442 · hashicorp/vagrant · GitHub
issueはvagrant box update
に関するものでしたが、わたしのケースとすごく似ています。斜め読みしたところ、問題はpublic Vagrant BoxのURLとしてatlas.hashicorp.com
を受け付けなくなって、vagrantcloud.com
を指定しなくてはならなくなった、ということのようです。どうやら、すくなくともUbuntu16.04は全部影響を受けるらしい。
issueの中に、次のようなworkarundを見つけたので、試してみることにしました。
vagrant box update - Fails with 404 Not Found error · Issue #9442 · hashicorp/vagrant · GitHub
とりあえず、自分の環境でこれと同じ問題が出るか、および、workaroundを使って問題が解決するかを確かめました。Vagrantfileの変更が必要なので、とりあえずは当該ファイルを使わないvagrant box add
ではなく、`vagrant initを使いました。
$ vagrant init elastic/ubuntu-16.04-x86_64
$ vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'elastic/ubuntu-16.04-x86_64' could not be found. Attempting to find and install...
default: Box Provider: libvirt
default: Box Version: >= 0
The box 'elastic/ubuntu-16.04-x86_64' 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/elastic/ubuntu-16.04-x86_64"]
Error: The requested URL returned error: 404 Not Found
$
期待通り(?)失敗しました。
- workaround適用後(initの後にVagrantfileを編集)
$ vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'elastic/ubuntu-16.04-x86_64' could not be found. Attempting to find and install...
default: Box Provider: libvirt
default: Box Version: >= 0
==> default: Loading metadata for box 'elastic/ubuntu-16.04-x86_64'
default: URL: https://vagrantcloud.com/elastic/ubuntu-16.04-x86_64
==> default: Adding box 'elastic/ubuntu-16.04-x86_64' (v20171130.0.0) for provider: libvirt
default: Downloading: https://vagrantcloud.com/elastic/boxes/ubuntu-16.04-x86_64/versions/20171130.0.0/providers/libvirt.box
...
$
成功しました。続いて、上記コマンドの実行結果から得たboxファイルをもとにvagrant box add
が成功するかを試しました。
$ vagrant box add elastic/ubuntu-16.04-x86_64 https://vagrantcloud.com/elastic/boxes/ubuntu-16.04-x86_64/versions/201711
30.0.0/providers/libvirt.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'elastic/ubuntu-16.04-x86_64' (v0) for provider:
box: Downloading: https://vagrantcloud.com/elastic/boxes/ubuntu-16.04-x86_64/versions/20171130.0.0/providers/libvirt.box
...
$
こちらも成功しました。私が遭遇した問題は上記issueと同根と見てよさそうです。
ここから最終的にはvagrant box add --provider libvirt elastic/ubuntu-16.04-x86_64
を正しく動くようにしたいのですが、上記の方法が今のわたしにとってはworkaroundとして十分なので、とりあえずはこれで放置。後はUbuntuで修正されるのを待ちます。