1

As part of diagnosing problems with my Vagrant VM, I issued

vagrant@lucid32:~$ sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` v-csc-1 /tmp/vagrant-chef-1/chef-solo-2/cookbooks

And I get:

/sbin/mount.vboxsf: mounting failed with the error: No such file or directory

Various blogs around the web indicate that this is a path problem, likely to do with where the cookbooks are setup on the VM itself and also where the Vagrantfile (on the host) is instructing Chef to find them. So questions:

  • How would I find where the cookbooks are located so that I can correct this?
  • How do I know if I've got Chef set up at all - command to run?
  • How would I set up Chef?

Background My problems are stemming from trying to find a definitive, complete end-to-end guide to set up a common all-garden vanilla LAMP stack on a VM on Windows 7 64bit host. I have done much research and used http://iostudio.github.com/LunchAndLearn/2012/03/21/vagrant.html and added the following code from that in my Vagrantfile

 config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ["cookbooks","site-cookbooks"]
    chef.add_recipe "apt"
    chef.add_recipe "openssl"
    chef.add_recipe "apache2"
    chef.add_recipe "mysql"
    chef.add_recipe "mysql::server"
    chef.add_recipe "php"
    chef.add_recipe "php::module_apc"
    chef.add_recipe "php::module_curl"
    chef.add_recipe "php::module_mysql"
    chef.add_recipe "apache2::mod_php5"
    chef.add_recipe "apache2::mod_rewrite"
    chef.json = {
        :mysql => {
            :server_root_password => 'root',
            :bind_address => '127.0.0.1'
        }
    }
  end

The problem I am seeing is that there is plenty of advice on the web but: - there are varying solutions to the problem - they don't precisely specify their starting point/pre-requisite i.e. the state of their setup before their solution is to be applied so you can't know if your problem is the same as theirs

3
  • 1
    chef.cookbooks_path = ["cookbooks","site-cookbooks"] This line in Vagrant file means that you have cookbooks and site-cookbooks folders next to your Vagrantfile in the same folder. Either they are not there or somehow not accessible. May be your user (which runs vagrant up) does not have enough rights?
    – Draco Ater
    Jan 31, 2013 at 13:11
  • +1 for your input @DracoAter I am issuing vagrant up from the cmd Windows DOS shell of my Windows 7 64 bit machine that is hosting the VM. Do I need elevated permissions? I don't think I do as I have been able to SSH into the VM with PuTTY so it does at least do some setting up. By the way on this Windows host machine, my Vagrantfile resides at a folder like: C:\Users\<user>\<folder to hold vagrant setup> and in this folder there is just a .vagrant file, package.box filre and the Vagrantfile - Do I need anything else? Jan 31, 2013 at 13:51
  • (p.s. cosmetic edit cleaned up the formatting of the question - bullet pointed the questions to make easier reading, content remains the same) Jan 31, 2013 at 13:53

1 Answer 1

1

So as I said in the comment:

chef.cookbooks_path = ["cookbooks","site-cookbooks"]

This line shows the relative path from the Vagrantfile to cookbooks directory in the host system. If full path to your Vagrantfile is C:\Users\<user>\<folder to hold vagrant setup>\Vagrantfile, then there should be 2 directories:

  1. C:\Users\<user>\<folder to hold vagrant setup>\cookbooks

    This should hold your cookbooks.

  2. C:\Users\<user>\<folder to hold vagrant setup>\site-cookbooks

    This should hold site cookbooks (cookbooks that are downloaded from chef-community in case you hold them separately).

In current setup these are the 2 directories, that vagrant will mount in guest OS and search for cookbooks. You get the error, because there are no such directories in your setup.

You must provide the cookbooks' path, because otherwise vagrant does not know where to take them from. Chek out Setting the Cookbooks Path help page of Vagrant.

4
  • I don't have a 1. C:\Users\<user>\<folder to hold vagrant setup>\cookbooks nor a 2. C:\Users\<user>\<folder to hold vagrant setup>\site-cookbooks so can I just create them? I looked at the docs.vagrantup.com/v1/docs/provisioners/chef_solo.html link you provided but this is about setting up Vagrant to point to an existing cookbook path, not about how the cookbook paths are created in the first place on the host system -so can I just mkdir them on the host system? (thanks again for your input) Jan 31, 2013 at 14:39
  • 1
    Yes, if you don't have the directories you have to create them and put your cookbooks there. You have a lot of recipes to run (as set in the Vagrantfile by chef.add_recipe) and you must provide all of them in those directories.
    – Draco Ater
    Jan 31, 2013 at 14:44
  • OK thanks @Draco Ater, I had thought that the cookbooks were downloaded onto the Vagrant VM itself and run from there. Solutions/blogs/tutorials that I have searched extensively don't make that clear where they are running the cookbook setup commands from (Vagrant VM or host). What you are saying should unblock my progress (+1 vote up your comment), now, I hope that the cookbook setup procedure for the host OS part is compatible with Windows - e.g. just a simple zipped/tarred file to unpack... Jan 31, 2013 at 14:59
  • +1 on Answer and Accepted (with your last comment, @Draco Ater) - I think this should get me going again to do some more digging. Thanks. Jan 31, 2013 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.