fgrehm / vagrant-cachier

Caffeine reducer
http://fgrehm.viewdocs.io/vagrant-cachier
MIT License
1.07k stars 111 forks source link

Unable to up with vagrant-cachier installed on OSX #86

Closed colindean closed 10 years ago

colindean commented 10 years ago
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
/Users/cdean/.vagrant.d/gems/gems/vagrant-cachier-0.5.1/lib/vagrant-cachier/provision_ext.rb:63:in `cache_root': undefined method `name' for nil:NilClass (NoMethodError)
    from /Users/cdean/.vagrant.d/gems/gems/vagrant-cachier-0.5.1/lib/vagrant-cachier/provision_ext.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:13:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/providers/virtualbox/action/set_name.rb:48:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/providers/virtualbox/action/clean_machine_folder.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/cdean/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/configure_chef.rb:23:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/cdean/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/load_shelf.rb:28:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/cdean/.vagrant.d/gems/gems/vagrant-berkshelf-1.3.7/lib/berkshelf/vagrant/action/set_ui.rb:12:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/env_set.rb:19:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/machine.rb:147:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'
    from /Users/cdean/.vagrant.d/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call'
    from /Users/cdean/.vagrant.d/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'

Unfortunately, I'm working on a confidential project, so I can't post the full Vagrantfile. Here are the relevant sections:

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-cachier")
    config.cache.auto_detect = true
  end
  config.berkshelf.enabled = true
  config.omnibus.chef_version = :latest
end
$ vagrant --version
Vagrant 1.4.3
$ vagrant plugin list
vagrant-berkshelf (1.3.7)
vagrant-cachier (0.5.1)
vagrant-exec (0.3.1)
vagrant-omnibus (1.2.1)
vagrant-pristine (0.3.0)
vagrant-vbguest (0.10.0)

OSX 10.8.5. Virtualbox 4.2.18 (I guess I should update that, haha, but I don't think it's related because this config is working on a Linux machine with a version older than that).

Just installed Vagrant 1.4.3 and the plugins today. I had previously installed Vagrant 1.3.5.

colindean commented 10 years ago

This occurs even when setting config.cache.auto_detect = false.

colindean commented 10 years ago

I seemed to have worked around it temporarily by setting config.cache.scope = :machine.

fgrehm commented 10 years ago

@colindean this is weird....

I don't know why but somehow it seems that the box object is not set for the VM as the stacktrace points us to this line

Just to double check, did you download the box before using the plugin?

colindean commented 10 years ago

Yes, I downloaded the box before installing the plugin.

Fabio Rehm notifications@github.com wrote:

@colindean this is weird....

I don't know why but somehow it seems that the box object is not set for the VM as the stacktrace points us to this line

Just to double check, did you download the box before using the plugin?


Reply to this email directly or view it on GitHub: https://github.com/fgrehm/vagrant-cachier/issues/86#issuecomment-35580053

miah commented 10 years ago

It seems to me like the bug is caused by box.name being nil. See here

My guess is, L36 should be: @env[:home_path].join('cache', @env[:machine].name)

I hit a similar issue using dvm:

==> dvm: Verifying vmnet devices are healthy...
/Users/miah/.vagrant.d/gems/gems/vagrant-cachier-0.7.0/lib/vagrant-cachier/action/configure_bucket_root.rb:36:in `cache_root': undefined method `name' for nil:NilClass (NoMethodError)
    from /Users/miah/.vagrant.d/gems/gems/vagrant-cachier-0.7.0/lib/vagrant-cachier/action/configure_bucket_root.rb:24:in `setup_buckets_folder'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-cachier-0.7.0/lib/vagrant-cachier/action/configure_bucket_root.rb:16:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/lock.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:80:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:1018:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/box_check_outdated.rb:28:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:1232:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:282:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:152:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/runner.rb:69:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/runner.rb:69:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/call.rb:51:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:1232:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/lock.rb:42:in `block in call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/lock.rb:27:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/lock.rb:27:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:108:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-vmware-fusion-2.3.6/lib/vagrant-vmware-fusion/action_farm.rb:282:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/miah/.vagrant.d/gems/gems/vagrant-berkshelf-2.0.0.rc2/lib/berkshelf/vagrant/action/configure_chef.rb:14:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.5.2/lib/vagrant/action/warden.rb:34:in `call'
miah commented 10 years ago

I'm probably wrong in my assessment of the cause above. Further looking,

boot2docker-0.5.4-1  (vmware_desktop, 0)
  - url: https://github.com/mitchellh/boot2docker-vagrant-box/releases/download/v0.5.4-1/boot2docker_vmware.box
  - downloaded_at: 2014-02-13T18:57:22Z

I think in this case, the 'machine.box.name' would be 'boot2docker-0.5.4.1' and that L36 as referenced above is really trying to pull that out to segregate all the caches by machine type. This makes sense, I'd want all centos-6 systems to share the same cache.

We might want to .fetch the box.name though and if nil, set it to some 'default'

[:machine].box.fetch(:name) { 'default' }

fgrehm commented 10 years ago

@miah thanks for all the info but I'm still trying to understand why the box.name is nil by the time we try to configure the buckets root since vagrant shouldn't allow a VM to be "upped" without a box.

are you or @colindean able to share a full Vagrantfile that reproduces the issue and also gist the output of a vagrant up --debug from scratch? I'm using the plugin from an Ubuntu host with both virtualbox and the lxc provider and I haven't been able to reproduce it from my side =/

colindean commented 10 years ago

I just set everything up today on a new machine (latest Vagrant, VirtualBox, all the plugins, etc.) and didn't have a problem with the same Vagrantfile. I am, however, still using config.cache.scope = :machine in my config.

colindean commented 10 years ago

I'll see if I can reproduce it with that option off. I'm afraid I can't post the Vagrantfile without going through more clearances than it's worth. I might try to reproduce it with less-customized config if I get a chance, though.

fgrehm commented 10 years ago

I don't have a OSX machine around to try to reproduce this and trying to track it down without a Vagrantfile and a debug log is pretty hard.

For now I'm going to close the issue and we can always get back to it when we have more information :-)

lox commented 10 years ago

I believe this is caused by the box that your Vagrant file previously referenced has been deleted.

lox commented 10 years ago

Is it worth re-opening this @fgrehm? We see this error pretty regularly. Try deleting your vagrant box and then vagrant reload a machine that used that box.

lox commented 10 years ago

FWIW, a vagrant destroy / vagrant up solves the problem

fgrehm commented 10 years ago

I'll give it a try when I have a chance, lemme reopen

benesch commented 10 years ago

Confirmed that I'm seeing the same issue on OS X after deleting a box and vagrant reloading.

fgrehm commented 10 years ago

This was fixed in git, a new release will come out with it as soon as I'm done with the stuff tagged with the v1.0.0 milestone

Thanks everyone for the information provided :smile: