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.
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.