Question

I've only just started using Vagrant and Chef, but Im getting what I think are quite strange errors.

Everythings fine with a simple VM and and no chef, but when I stick a few recipies in it fails.

Here's my current default.rb for the main recipe called from the Vagrantfile. Its mostly from this blog / tutorial

r = execute "apt-get update" do
  user "root"
  command "apt-get update"
  action :nothing
end
r.run_action(:run)

include_recipe "php"
include_recipe "apache2"
include_recipe "mysql"

The php apache2 and mysql recipes are straight from the opscode community site.

If I just put one of those recipes in, then it loads fine. Sometimes two is fine, but if I put all three in then whichever is the last one seems to cause an error. I've changed the order round and it always is the last one that causes the error. Here is the error - same every time, but in this case php was the last of the three and you can see it failing to install:

[default] [Fri, 06 Jan 2012 10:01:33 -0800] INFO: Processing package[php5] action install (php::package line 32)
: stdout
[default] [Fri, 06 Jan 2012 10:04:52 -0800] ERROR: package[php5] (php::package line 32) has had an error
: stdout
[default] [Fri, 06 Jan 2012 10:04:52 -0800] ERROR: Running exception handlers
: stdout
[default] [Fri, 06 Jan 2012 10:04:52 -0800] ERROR: Exception handlers complete
: stdout
[default] /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/file_cache.rb:54:in `initialize': stderr
[default] : : stderr
[default] Read-only file system - /tmp/vagrant-chef-1/chef-stacktrace.out: stderr
[default]  (: stderr
[default] Errno::EROFS: stderr
[default] )
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/file_cache.rb:54:in `open'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/file_cache.rb:54:in `store'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:133:in `debug_stacktrace'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:210:in `run_application'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `loop'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application/solo.rb:183:in `run_application'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/application.rb:66:in `run'
: stderr
[default]   from /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/chef-solo:25
    from /opt/ruby/bin/chef-solo:19:in `load'
    from /opt/ruby/bin/chef-solo:19
: stderr
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json

The output of the command prior to failing is outputted below:

[no output]

Typically I am destroying the VM and doing vagrant up for each new attempt, but a couple of times I have tried vagrant reload and vagrant provision with the same results.

Also, I don't know if this is normal, but my Mac pretty much completely locks up while its doing the provisioning. I can normally run 2 or 3 vmware vms at the same time without feeling like it's struggling too much, so for it to completely lock up is.... odd.

Was it helpful?

Solution 2

Cheers for the response.

It turned out to be that I had old versions of some dependant gems. Once Id done gem update, the problem went away.

OTHER TIPS

I had a very similar error but seem to have found a resolution.

After trying a number of things (different base boxes, different VirtualBox versions, trying again and again) I finally made progress by building my own Vagrant base box. I followed the instructions on the Vagrant (base box build) and Chef (chef-solo install) web sites. Whilst this took a while and was tricky I do now have better confidence in the state of the base box and am happier.

I still don't know what caused the issue we had. Perhaps it was a mismatch in VirtualBox guest additions version or a corruption / incompatibility in the lucid32 or lucid64 base boxes.

For reference, I installed Ubuntu server 11.10 and installed Chef from packages. If there is demand I'd be happy to upload my (700mb) oneiric64 base image somewhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top