7

Hy I'm trying to run a MongoDB recipe with Chef Solo on an Amazon EC2 Linux AMI. I've installed Omnibus, set the cookbook path in the .rb file, and the runlist in the .json file. I've copied the content of the mongodb recipe zip from github to to cookbook folder, and ran the chef-solo command. The result is below:

FATAL: Chef::Exceptions::CookbookNotFound: Cookbook apt not found. If you're loading apt from another cookbook, make sure you configure the dependency in your metadata

I'm pretty new to Linux too, what am I doing wrong here?

Csapi007
  • 133
  • 1
  • 2
  • 6

4 Answers4

9

If you are using chef-solo, make sure your solo.rb points to the correct cookbook location. I had set it as :

cookbook_path "/root/chef-repo/cookbooks"

instead of:

cookbook_path "/home/ubuntu/chef-repo/cookbooks"
Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Karishma Malkan
  • 2,069
  • 1
  • 16
  • 14
7

The error is pretty descriptive. You likely have a cookbook in your runlist that has depends apt in its metadata.rb file.

Luckily, this easy to resolve - just include the apt cookbook (https://github.com/opscode-cookbooks/apt) in your cookbooks folder and call it in your runlist (or role, when you get to that level).

  • It worked perfectly on my local Ubuntu, but it still doesn't work on Amazon EC2. I'm guessing because it doesn't have apt. One of the errors is this: ERROR: execute[apt-get-update] (apt::default line 22) had an error: No such file or directory - apt-get update; ignore_failure is set, continuing Guessing it's no big deal, because it continues. The secound one is: * package[update-notifier-common] action install * No version specified, and no candidate version available for update-notifier-common I've red the readme for the apt cookbook but it doesn't say that something needs specifing. – Csapi007 Mar 20 '13 at 16:08
  • Looks like there is no apt on EC2, there you should not put it in your runlist (only have the cookbook present if mongodb requires it on EC2 too) – cmur2 Mar 20 '13 at 17:16
  • Yeah, I've tried to install the MongoDB recipe that way, the error message that I get: - * package[mongo-10gen-server] action install * No version specified, and no candidate version available for mongo-10gen-server - Which is strange, because in the run the default recipe from the runlist not the 10gen one. Does this have something to do with my previous problem or is it something totally different? :S – Csapi007 Mar 20 '13 at 18:07
2

Karishma is correct in her answer, though I would like to expand on it and make it more dynamic by skipping the absolute paths. Here is my implementation:

root = File.absolute_path(File.dirname(__FILE__))
file_cache_path root
cookbook_path root + '/cookbooks'

It sets the paths to be wherever you place the solo.rb file.

Community
  • 1
  • 1
Tobias Sjösten
  • 1,084
  • 9
  • 16
2

This happened to me because I forgot to run librarian-chef install first!

Kabir Sarin
  • 18,092
  • 10
  • 50
  • 41