1
votes

I have a question for help that I could not find on any of these topics already.

I am trying to implement vagrant against my pre-existing virtual box. Most of the topics online right now are referring to using a box from vagrant cloud, or building one from scratch etc. My issue is I have an already built virtual box using Virtualbox as the provider specifically 1.4.3 as the version. The box is 124GB so remaking it is not exactly ideal. I have the vagrant config file set to locate the virtual box at path /users/desktop/foldername/filename.vbox. Every time it tries to add the box I get the error

"The box failed to unpackage properly. Please verify that the box file you're trying to add is not corrupted and try again. The output from attemtping to unpackage (if any): 

Bsdtar: Error opening archive: Unrecognized archive format."

My knowledge is that this is because Vagrant is looking to add a .tar file and the file is not a tar extension.

Your supposed to be able to configure vagrant file to recognize the provider which I have done as well. Mine is set to

config.vm.provider "virtualbox" do |vb|
  vb.gui = true
end

But no matter what I try I'm always getting the error above. One thing to note is I'm not sure how to go about providing the metadata.json file, or how I can find that to edit it. Perhaps that is my problem? I have the latest version of vagrant so that is not the issue.

Any assistance would be greatly appreciated.

I have tried the vagrant package and below is my error I'm getting Please see if you may be able to provide further assistance.

I tried what you have suggested and here is the error message that I'm getting. I greatly appreciate your help.

nokeys$  vagrant package --base Dev_Clonea --output /users/nokeys/desktop/Dev_Clone/Dev_Clone.vbox

/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:306:in `id=': undefined method `children' for nil:NilClass (NoMethodError)

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:438:in `state'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/created.rb:11:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/call.rb:43:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:196:in `action_raw'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:173:in `block in action'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:434:in `lock'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `call'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `action'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:83:in `package_vm'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:66:in `package_base'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:42:in `execute'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/cli.rb:42:in `execute'

from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:252:in `cli'

from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:166:in `<main>'
1

1 Answers

2
votes
vagrant package --base <name of vm> --output <path>.box

Lets say you virtual machine is named 'my_vm' and you want to drop it into the home directory

vagrant package --base my_vm --output ~/my_vm.box

Vagrant will package your virtual machine into a base box. Whatever you name the box with the output flag, will be the name you use in your vagrantfile.