vagrant list not listing boxes after scripted add

239 views
Skip to first unread message

James Scollard

unread,
Oct 12, 2015, 4:51:26 PM10/12/15
to Vagrant
I am using the following script to create images with vagrant and libvirt:


My setup:

root@hostname:/opt/trunk/mythos/images# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l

root@hostname:/opt/trunk/mythos/images# uname -a
Linux hostname 3.13.0-65-generic #106-Ubuntu SMP Fri Oct 2 22:08:27 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@hostname:/opt/trunk/mythos/images# vagrant --version
Vagrant 1.4.3

Problem:

vagrant box list does not show boxes I have already added with this script even though I am able to see them in ~/.vagrant.d/boxes: 

vagrant-kvm (0.1.9)
vagrant-kvm plugin is installed.  Moving on...
vagrant-mutate (1.0.2)
vagrant-mutate plugin is installed.  Moving on...
Extracting box...te: 23.7M/s, Estimated time remaining: 0:00:01)
The box you're attempting to add already exists:

Name: ubuntu/vivid64
Provider: virtualbox
Box ubuntu/vivid64 added.
./create-images.sh: line 81: box: command not found
Box ubuntu/vivid64 added.
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- vagrant/box_metadata (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/box_loader.rb:7:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/mutate.rb:1:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate.rb:14:in `block in <class:Plugin>'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `get'
        from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:28:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:484:in `cli'
        from /usr/bin/vagrant:127:in `<main>'
Box ubuntu/vivid64 mutated to libvirt format
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- vagrant/box_metadata (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/box_loader.rb:7:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/mutate.rb:1:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate.rb:14:in `block in <class:Plugin>'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `get'
        from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:28:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:484:in `cli'
        from /usr/bin/vagrant:127:in `<main>'
Box ubuntu/vivid64 mutated to libvirt format.
Vagrant boxes ready to go:
There are no installed boxes! Use `vagrant box add` to add some.

When I create them myself in the terminal they also do not show up:  

root@csx-a-qatools-002:/opt/trunk/mythos/images# vagrant box add vivid/test64 https://cloud-images.ubuntu.com/vagrant/vivid/current/vivid-server-cloudimg-amd64-vagrant-disk1.box
Extracting box...te: 35.8M/s, Estimated time remaining: 0:00:02)
Successfully added box 'vivid/test64' with provider 'virtualbox'!
root@csx-a-qatools-002:/opt/trunk/mythos/images# vagrant box list
There are no installed boxes! Use `vagrant box add` to add some.

But you can see them in the proper paths with the proper ownerships:

ubuntu/           ubuntu-vividtest/ vivid/            
root@csx-a-qatools-002:/opt/trunk/mythos/images# ls -al ~/.vagrant.d/boxes/
total 20
drwxr-xr-x 5 root root 4096 Oct 12 20:37 .
drwxr-xr-x 7 root root 4096 Oct 12 17:42 ..
drwxr-xr-x 3 root root 4096 Oct 12 19:01 ubuntu
drwxr-xr-x 2 root root 4096 Oct 12 18:41 ubuntu-vividtest
drwxr-xr-x 3 root root 4096 Oct 12 20:37 vivid

The logic I am applying in my scripting relies on vagrant box list to determine if an image is there and not download/modify it again if it exists in the expected state.  I need vagrant to see the boxes I add, or I assume not only will the list logic not work, but there is little value in a workaround because if it cannot list them, it also cannot start them.

Any thoughts?  I tried to ask in the IRC chat, but even with over 400 people in the room nobody responded.

Thanks.

Alvaro Miranda Aguilera

unread,
Oct 12, 2015, 5:01:02 PM10/12/15
to vagra...@googlegroups.com
On Tue, Oct 13, 2015 at 9:51 AM, James Scollard <spyde...@gmail.com> wrote:
> ./create-images.sh: line 81: box: command not found

Hello

Seems you got an error

script run show:
./create-images.sh: line 81: box: command not found

you need to replace:

box add $SLAVE_IMAGE $SLAVE_IMAGE_URI

with

vagrant box add --name $SLAVE_IMAGE $SLAVE_IMAGE_URI

I will recommend pass provider too

vagrant box add --name $SLAVE_IMAGE --provider <someprovider> $SLAVE_IMAGE_URI


When you don't have provider, this is what the command give you in the console:
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'vivid/test64' (v0) for provider: [nothing-here]


With provider you get
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'vivid/test64' (v0) for provider: virtualbox

---

full log:

z2-3:vagrant_z2-3 kikitux$ vagrant box add --provider virtualbox
--name vivid/test64
https://cloud-images.ubuntu.com/vagrant/vivid/current/vivid-se
rver-cloudimg-amd64-vagrant-disk1.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'vivid/test64' (v0) for provider: virtualbox
box: Downloading:
https://cloud-images.ubuntu.com/vagrant/vivid/current/vivid-server-cloudimg-amd64-vagrant-disk1.box
==> box: Box download is resuming from prior download progress
==> box: Successfully added box 'vivid/test64' (v0) for 'virtualbox'!
z2-3:vagrant_z2-3 kikitux$ vagrant box list | grep test64
vivid/test64 (virtualbox, 0)


alvaro.

James Scollard

unread,
Oct 13, 2015, 10:55:10 AM10/13/15
to Vagrant
Apparently --name is not acceptable:

Creating Medusa Gorgon (server) Image
An invalid option was specified. The help for this command
is available below.

Usage: vagrant box add <name> <url> [--provider provider] [-h]

        --checksum VALUE             Checksum
        --checksum-type VALUE        Checksum type
    -c, --clean                      Remove old temporary download if it exists.
    -f, --force                      Overwrite an existing box if it exists.
        --insecure                   If set, SSL certs will not be validated.
        --cacert certfile            CA certificate
        --cert certfile              The client SSL cert
        --provider provider          The provider that backs the box.
    -h, --help                       Print this help
Box ubuntu/vivid64 server image added.
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- vagrant/box_metadata (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/box_loader.rb:7:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/mutate.rb:1:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate.rb:14:in `block in <class:Plugin>'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `get'
        from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:28:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:484:in `cli'
        from /usr/bin/vagrant:127:in `<main>'
Box ubuntu/vivid64 mutated to libvirt format
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.

Creating Medusa Serpent (slave) Image

I updated the script to remove the undefined --name option and did some refactoring so things make sense again.  Here is the updated version:


And here is a new failure output.  Vagrant still cannot list boxes it downloads.  VAGRANT APPEARS TO BE BROKEN!!!

Creating Medusa Gorgon (server) Image
Download failed. Will try another box URL if there is one.-)
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

The requested URL returned error: 404 Not Found
Box ubuntu/vivid64 server image added.
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- vagrant/box_metadata (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/box_loader.rb:7:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/mutate.rb:1:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate.rb:14:in `block in <class:Plugin>'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `get'
        from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:28:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:484:in `cli'
        from /usr/bin/vagrant:127:in `<main>'
Box ubuntu/vivid64 mutated to libvirt format
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.
Creating Medusa Serpent (slave) Image
Extracting box...te: 13.3M/s, Estimated time remaining: --:--:--)
Successfully added box 'ubuntu/vivid64' with provider 'virtualbox'!
Box ubuntu/vivid64 slave image added.
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- vagrant/box_metadata (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/box_loader.rb:7:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate/mutate.rb:1:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /root/.vagrant.d/gems/gems/vagrant-mutate-1.0.2/lib/vagrant-mutate.rb:14:in `block in <class:Plugin>'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `call'
        from /usr/lib/ruby/vendor_ruby/vagrant/registry.rb:27:in `get'
        from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:28:in `execute'
        from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:484:in `cli'
        from /usr/bin/vagrant:127:in `<main>'
Box ubuntu/vivid64 mutated to libvirt format.
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.
Vagrant boxes started and ready to go:
There are no installed boxes! Use `vagrant box add` to add some.
Medusa Image Creation Completed...
root@csx-a-qatools-002:/opt/trunk/mythos/images# vagrant box list
There are no installed boxes! Use `vagrant box add` to add some.

Here you can see that Vagrant successfully added a box, but doesnt recognize it:

root@csx-a-qatools-002:/opt/trunk/mythos/images# ls ~/.vagrant.d/boxes/
ubuntu

Thanks.

James Scollard

unread,
Oct 13, 2015, 12:44:40 PM10/13/15
to Vagrant
I pulled out of the internally provided cloud image I was working with and began working on an image I created from scratch for Openstack following the official guide here:


No longer having this issue.  This is not the first time I have had issues with the images our enterprise is creaitng internally for control plane and tenant clouds.  I think we can consider this resolved.

Thanks.

On Monday, October 12, 2015 at 4:51:26 PM UTC-4, James Scollard wrote:
Reply all
Reply to author
Forward
0 new messages