sciurus/vagrant-mutate

Mutated precise32 vbox stack traces on box list

Thingee opened this issue · 8 comments

Vagrant version: 1.5.4
vagrant-mutate version: 0.3.0

After I try the example of mutating a precise 32 virtualbox to libvirt, I get a stack trace when listing the boxes:

$ git clone https://github.com/sciurus/vagrant-mutate.git
Cloning into 'vagrant-mutate'...
remote: Reusing existing pack: 755, done.
remote: Counting objects: 47, done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 802 (delta 20), reused 0 (delta 0)
Receiving objects: 100% (802/802), 119.91 KiB | 0 bytes/s, done.
Resolving deltas: 100% (397/397), done.
Checking connectivity... done.
$ cd vagrant-mutate 
$ git checkout tags/0.3.0
Note: checking out 'tags/0.3.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at e2fbb45... Bump version and update changelog and readme
$ rake build
vagrant-mutate 0.3.0 built to pkg/vagrant-mutate-0.3.0.gem.
$ vagrant plugin install pkg/vagrant-mutate-0.3.0.gem 
Installing the 'pkg/vagrant-mutate-0.3.0.gem' plugin. This can take a few minutes...
Installed the plugin 'vagrant-mutate (0.3.0)'!
$ vagrant mutate http://files.vagrantup.com/precise32.box libvirt
You have qemu 2.0.0 installed. This version cannot read some virtualbox boxes. If conversion fails, see below for recommendations. https://github.com/sciurus/vagrant-mutate/wiki/QEMU-Version-Compatibility
Downloading box precise32 from http://files.vagrantup.com/precise32.box
Extracting box file to a temporary directory.
Converting precise32 from virtualbox to libvirt.
    (100.00/100%)
Cleaning up temporary files.
The box precise32 (libvirt) is now ready to use.
$ vagrant box list
hashicorp/precise64        (virtualbox, 1.1.0)
precise32                  (libvirt, 0)
/opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/version.rb:191:in `initialize': Malformed version number string libvirt (ArgumentError)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:273:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:273:in `block (2 levels) in find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:270:in `map'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:270:in `block in find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:416:in `block in with_collection_lock'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:415:in `with_collection_lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:263:in `find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:54:in `block in list_boxes'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:47:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:47:in `list_boxes'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:30:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/root.rb:61:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/cli.rb:42:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/environment.rb:248:in `cli'
    from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.4/bin/vagrant:164:in `<main>'

This is strange It shows the box you mutated

precise32                  (libvirt, 0)

just like I would expect, then it throws an error.

What is the output of find ~/.vagrant.d/boxes ?

I'm failing to reproduce this. In addition to the find command above, can you send me the output of VAGRANT_LOG=info vagrant box list?

pittsb@tullock:~$ vagrant mutate http://files.vagrantup.com/precise32.box libvirt
Downloading box precise32 from http://files.vagrantup.com/precise32.box
Extracting box file to a temporary directory.
Converting precise32 from virtualbox to libvirt.
    (100.00/100%)
Cleaning up temporary files.
The box precise32 (libvirt) is now ready to use.
pittsb@tullock:~$ vagrant box list
opscode_centos-5.10  (libvirt, 0)
opscode_centos-5.10  (virtualbox, 0)
opscode_centos-6.5   (libvirt, 0)
opscode_centos-6.5   (virtualbox, 0)
opscode_fedora-20    (libvirt, 0)
opscode_fedora-20    (virtualbox, 0)
opscode_ubuntu-12.04 (libvirt, 0)
opscode_ubuntu-12.04 (virtualbox, 0)
precise32            (libvirt, 0)
pittsb@tullock:~$
$ VAGRANT_LOG=info vagrant box list                                                                                                    1 ↵
 INFO global: Vagrant version: 1.5.4
 INFO global: Ruby version: 2.0.0
 INFO global: RubyGems version: 2.0.14
 INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.4/bin/vagrant"
 INFO global: VAGRANT_LOG="info"
 INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/bin/../embedded"
 INFO global: VAGRANT_INSTALLER_VERSION="2"
 INFO global: VAGRANT_DETECTED_OS="Linux"
 INFO global: VAGRANT_INSTALLER_ENV="1"
 INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
 INFO global: VAGRANT_VAGRANTFILE="plugin_command_1399566267"
 INFO global: Plugins:
 INFO global:   - bundler = 1.5.3
 INFO global:   - mime-types = 2.2
 INFO global:   - rest-client = 1.6.7
 INFO global:   - vagrant-login = 1.0.1
 INFO global:   - vagrant-mutate = 0.3.0
 INFO global:   - vagrant-share = 1.0.1
 INFO manager: Registered plugin: kernel
 INFO manager: Registered plugin: list-commands command
 INFO manager: Registered plugin: destroy command
 INFO manager: Registered plugin: ssh-config command
 INFO manager: Registered plugin: help command
 INFO manager: Registered plugin: up command
 INFO manager: Registered plugin: ssh command
 INFO manager: Registered plugin: plugin command
 INFO manager: Registered plugin: suspend command
 INFO manager: Registered plugin: init command
 INFO manager: Registered plugin: reload command
 INFO manager: Registered plugin: box command
 INFO manager: Registered plugin: package command
 INFO manager: Registered plugin: provision command
 INFO manager: Registered plugin: halt command
 INFO manager: Registered plugin: resume command
 INFO manager: Registered plugin: status command
 INFO manager: Registered plugin: Hyper-V provider
 INFO manager: Registered plugin: VirtualBox provider
 INFO manager: Registered plugin: ssh communicator
 INFO manager: Registered plugin: docker
 INFO manager: Registered plugin: ansible
 INFO manager: Registered plugin: chef
 INFO manager: Registered plugin: file
 INFO manager: Registered plugin: salt
 INFO manager: Registered plugin: puppet
 INFO manager: Registered plugin: shell
 INFO manager: Registered plugin: CFEngine Provisioner
 INFO manager: Registered plugin: kernel
 INFO manager: Registered plugin: RSync synced folders
 INFO manager: Registered plugin: NFS synced folders
 INFO manager: Registered plugin: SMB synced folders
 INFO manager: Registered plugin: OpenSUSE host
 INFO manager: Registered plugin: Red Hat host
 INFO manager: Registered plugin: Gentoo host
 INFO manager: Registered plugin: Arch host
 INFO manager: Registered plugin: BSD host
 INFO manager: Registered plugin: FreeBSD host
 INFO manager: Registered plugin: Slackware host
 INFO manager: Registered plugin: Windows host
 INFO manager: Registered plugin: null host
 INFO manager: Registered plugin: Linux host
 INFO manager: Registered plugin: OmniOS guest.
 INFO manager: Registered plugin: Ubuntu guest
 INFO manager: Registered plugin: Fedora guest
 INFO manager: Registered plugin: Solaris 11 guest.
 INFO manager: Registered plugin: SmartOS guest.
 INFO manager: Registered plugin: Debian guest
 INFO manager: Registered plugin: RedHat guest
 INFO manager: Registered plugin: TinyCore Linux guest.
 INFO manager: Registered plugin: Gentoo guest
 INFO manager: Registered plugin: Arch guest
 INFO manager: Registered plugin: PLD Linux guest
 INFO manager: Registered plugin: FreeBSD guest
 INFO manager: Registered plugin: SUSE guest
 INFO manager: Registered plugin: OpenBSD guest
 INFO manager: Registered plugin: Funtoo guest
 INFO manager: Registered plugin: NetBSD guest
 INFO manager: Registered plugin: CoreOS guest
 INFO manager: Registered plugin: Linux guest.
 INFO manager: Registered plugin: Solaris guest.
 INFO manager: Registered plugin: ESXi guest.
 INFO manager: Registered plugin: Darwin guest
 INFO global: Loading plugins!
 INFO manager: Registered plugin: vagrant-login
 INFO manager: Registered plugin: vagrant-share
 INFO manager: Registered plugin: vagrant-mutate
 INFO vagrant: `vagrant` invoked: ["box", "list"]
 INFO environment: Environment initialized (#<Vagrant::Environment:0x00000002bf4300>)
 INFO environment:   - cwd: /home/thingee
 INFO environment: Home path: /home/thingee/.vagrant.d
 WARN environment: No local data path is set. Local data cannot be stored.
 INFO environment: Running hook: environment_plugins_loaded
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x0000000305ecb0>
 INFO environment: Running hook: environment_load
 INFO loader: Loading configuration in order: [:home, :root]
 INFO host: Autodetecting host type for [#<Vagrant::Environment: /home/thingee>]
 INFO host: Detected: linux!
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x000000030e0f80>
 INFO cli: CLI: [] "box" ["list", "--"]
 INFO interface: info: hashicorp/precise64        (virtualbox, 1.1.0)
hashicorp/precise64        (virtualbox, 1.1.0)
 INFO interface: Machine: box-name ["hashicorp/precise64"]
 INFO interface: Machine: box-provider [:virtualbox]
 INFO interface: Machine: box-version ["1.1.0"]
 INFO box_collection: Box found: hashicorp/precise64 (virtualbox)
 INFO environment: Running hook: authenticate_box_url
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 2 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x00000002c19d08>
 INFO warden: Calling IN action: #<VagrantPlugins::Login::ActionAuthenticateBox:0x000000026db210>
 INFO warden: Calling OUT action: #<VagrantPlugins::Login::ActionAuthenticateBox:0x000000026db210>
 INFO interface: info: joscarsson/ubuntu-trusty64 (virtualbox, 0.1.0)
joscarsson/ubuntu-trusty64 (virtualbox, 0.1.0)
 INFO interface: Machine: box-name ["joscarsson/ubuntu-trusty64"]
 INFO interface: Machine: box-provider [:virtualbox]
 INFO interface: Machine: box-version ["0.1.0"]
 INFO box_collection: Box found: joscarsson/ubuntu-trusty64 (virtualbox)
 INFO environment: Running hook: authenticate_box_url
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 2 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x00000002bd8df8>
 INFO warden: Calling IN action: #<VagrantPlugins::Login::ActionAuthenticateBox:0x00000002be0e40>
 INFO warden: Calling OUT action: #<VagrantPlugins::Login::ActionAuthenticateBox:0x00000002be0e40>
 INFO interface: info: precise32                  (libvirt, 0)
precise32                  (libvirt, 0)
 INFO interface: Machine: box-name ["precise32"]
 INFO interface: Machine: box-provider [:libvirt]
 INFO interface: Machine: box-version ["0"]
 INFO environment: Running hook: environment_unload
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x00000003046278>
/opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/version.rb:191:in `initialize': Malformed version number string libvirt (ArgumentError)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:273:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:273:in `block (2 levels) in find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:270:in `map'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:270:in `block in find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:416:in `block in with_collection_lock'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:415:in `with_collection_lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:263:in `find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:54:in `block in list_boxes'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:47:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:47:in `list_boxes'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:30:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/root.rb:61:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/cli.rb:42:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/environment.rb:248:in `cli'

Can you send me the output of find ~/.vagrant.d/boxes ? I think it has an incorrect directory structure. Here is how I can trigger the error you had.

pittsb@tullock:~$ cd .vagrant.d/boxes/precise32/
pittsb@tullock:~/.vagrant.d/boxes/precise32$ ls
0
pittsb@tullock:~/.vagrant.d/boxes/precise32$ mkdir foobar
pittsb@tullock:~/.vagrant.d/boxes/precise32$ vagrant box list
opscode_centos-5.10  (libvirt, 0)
opscode_centos-5.10  (virtualbox, 0)
opscode_centos-6.5   (libvirt, 0)
opscode_centos-6.5   (virtualbox, 0)
opscode_fedora-20    (libvirt, 0)
opscode_fedora-20    (virtualbox, 0)
opscode_ubuntu-12.04 (libvirt, 0)
opscode_ubuntu-12.04 (virtualbox, 0)
precise32            (libvirt, 0)
/opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/version.rb:191:in `initialize': Malformed version number string foobar (ArgumentError)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:273:in `new'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:273:in `block (2 levels) in find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:270:in `map'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:270:in `block in find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:416:in `block in with_collection_lock'
    from /opt/vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:415:in `with_collection_lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/box_collection.rb:263:in `find'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:54:in `block in list_boxes'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:47:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:47:in `list_boxes'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/list.rb:30:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/plugins/commands/box/command/root.rb:61:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/cli.rb:42:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.5.4/lib/vagrant/environment.rb:248:in `cli'
    from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.4/bin/vagrant:164:in `<main>'
find ~/.vagrant.d/boxes
/home/thingee/.vagrant.d/boxes
/home/thingee/.vagrant.d/boxes/precise32
/home/thingee/.vagrant.d/boxes/precise32/0
/home/thingee/.vagrant.d/boxes/precise32/0/libvirt
/home/thingee/.vagrant.d/boxes/precise32/0/libvirt/box.img
/home/thingee/.vagrant.d/boxes/precise32/0/libvirt/Vagrantfile
/home/thingee/.vagrant.d/boxes/precise32/0/libvirt/metadata.json
/home/thingee/.vagrant.d/boxes/precise32/libvirt
/home/thingee/.vagrant.d/boxes/precise32/libvirt/box.img
/home/thingee/.vagrant.d/boxes/precise32/libvirt/Vagrantfile
/home/thingee/.vagrant.d/boxes/precise32/libvirt/metadata.json
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/box-disk1.vmdk
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/Vagrantfile
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/.vagrant
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/metadata.json
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/box.ovf
/home/thingee/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/metadata_url

I'm not sure how /home/thingee/.vagrant.d/boxes/precise32/libvirt was created. Maybe you ran vagrant-mutate < 0.3 after upgrading to vagrant >= 1.5?

Please wipe everything related to that box, mutate again, then list the boxes.

rm -r ~/.vagrant.d/boxes/precise32
VAGRANT_LOG=info vagrant mutate http://files.vagrantup.com/precise32.box libvirt
vagrant box list

I think there won't be any error, but if there is post the output here.

Thanks Brian, I wasn't able to reproduce the problem after starting over.

👍