Question

I'm trying to start instance using Vagrant from this box and then start my Chef recipes. Vagrant file:

Vagrant::Config.run do |config|
  config.vm.box = "sausy64"
  config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/20131113/saucy-server-cloudimg-amd64-vagrant-disk1.box"

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "."
    chef.add_recipe "test"
  end
end

After running vagrant up I get:

[default] Importing base box 'sausy64'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
[2013-11-16T18:15:15+00:00] INFO: *** Chef 10.12.0 ***
[2013-11-16T18:15:16+00:00] INFO: Setting the run_list to ["recipe[test]"] from JSON
[2013-11-16T18:15:16+00:00] INFO: Run List is [recipe[test]]
[2013-11-16T18:15:16+00:00] INFO: Run List expands to [test]
[2013-11-16T18:15:16+00:00] INFO: Starting Chef Run for vagrant-ubuntu-saucy-64
[2013-11-16T18:15:16+00:00] INFO: Running start handlers
[2013-11-16T18:15:16+00:00] INFO: Start handlers complete.
bash: line 2:  1494 Killed                  chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

I did vagrant ssh to check what's happening and it seems like a shared folder cookbooks is not accessible.

vagrant@vagrant-ubuntu-saucy-64:~$ cd /tmp/vagrant-chef-1/chef-solo-1/cookbooks/
vagrant@vagrant-ubuntu-saucy-64:/tmp/vagrant-chef-1/chef-solo-1/cookbooks$ ls
... CPU goes to 100% and anything shows ...

What should I do to make it working?

Was it helpful?

Solution

Had the same issue.

After some investigation I realized that the problem was in VirtualBox guest additions which are preinstalled with these Ubuntu 13.10 Vagrant boxes. The bundled version (4.2.16) contains a bug when working with shared folders on a Kernel 3.11, this bug is fixed in 4.2.20 according to VirtualBox Changelog.

So, I just updated VirtualBox guest additions to actual version and my shared folder with cookbooks works again. This can be done with fancy vagrant plugin

vagrant plugin install vagrant-vbguest

which automatically upgrades guest additions during VM start.

OTHER TIPS

I suspect the problem is the following line:

chef.cookbooks_path = "."

Try a real sub-directory.

Better still consider using the omnibus and berkshelf plugins to leverage cookbook management and the latest revision of chef. The following question gives and example:

How do I configure Chef Solo to install Nginx on a new Vagrant box?

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