Fixing a messed up Vagrant installation

I’m currently struggling with what seems like a bug in Virtualbox that affects the new Core i7 MacBooks. While trying to fix it by building Virtualbox from source, uninstalling and reinstalling, I managed to mess up a box managed with Vagrant, rendering it inaccessible.

If you find yourself in a similar situation, you can try to fix it with the VBoxManage command.

$ VBoxManage list vms
"" {b68ed7a7-6e72-4f16-a438-8775cd80d9b3}
$ VBoxManage unregistervm {b68ed7a7-6e72-4f16-a438-8775cd80d9b3} --delete
VBoxManage: error: The object is not ready
VBoxManage: error: Details: code E_ACCESSDENIED (0x80070005), component Machine, interface IMachine, callee nsISupports
Context: "Delete(ComSafeArrayAsInParam(aMedia), pProgress.asOutParam())" at line 175 of file VBoxManageMisc.cpp
Segmentation fault

As you can see, it died with a segmentation fault, but the broken box was now gone and I could restart it with vagrant up.

For reference, this is the lovely stack trace vagrant up greeted me with:

$ vagrant up
/Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/com/implementer/ffi.rb:95:in `call_and_check': Error in API call to get_name: 2147942405 (VirtualBox::Exceptions::FFIException)
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/com/implementer/ffi.rb:69:in `call_vtbl_function'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/com/implementer/ffi.rb:36:in `read_property'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/com/abstract_interface.rb:122:in `read_property'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/com/abstract_interface.rb:64:in `block in property'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/interface_attributes.rb:93:in `block in spec_to_proc'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/interface_attributes.rb:32:in `call'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/interface_attributes.rb:32:in `load_interface_attribute'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/interface_attributes.rb:13:in `block in load_interface_attributes'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/interface_attributes.rb:12:in `each'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/interface_attributes.rb:12:in `load_interface_attributes'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:251:in `initialize_attributes'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:246:in `initialize'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:229:in `new'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:229:in `block in populate_array_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:228:in `each'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:228:in `populate_array_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:218:in `populate_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/relatable.rb:242:in `populate_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model.rb:215:in `block in populate_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/dirty.rb:129:in `ignore_dirty'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model.rb:215:in `populate_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/global.rb:93:in `load_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/relatable.rb:192:in `read_relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/abstract_model/relatable.rb:146:in `block in relationship'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:185:in `all'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/virtualbox-0.8.3/lib/virtualbox/vm.rb:193:in `find'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/vm.rb:13:in `find'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/environment.rb:378:in `block in load_vms!'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/environment.rb:377:in `each'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/environment.rb:377:in `load_vms!'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/environment.rb:144:in `vms'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/environment.rb:180:in `multivm?'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/command/helpers.rb:19:in `target_vms'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/command/up.rb:8:in `execute'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/lib/vagrant/cli.rb:45:in `block in register'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/gems/vagrant-0.7.2/bin/vagrant:15:in `'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/bin/vagrant:19:in `load'
from /Users/danielhepper/.rvm/gems/ruby-1.9.2-p180/bin/vagrant:19:in `

'

One thought on “Fixing a messed up Vagrant installation

  1. Thanks for posting this message. I had to move my VMs from local storage to attached storage, and this article saved my butt from starting over. Keep up the good work my fellow vagrant!