1
votes

While running chef-client using knife, there is an error message that the recipe cannot be found. The command I use is

knife ssh myserver 'sudo chef-client' --manual-list -ssh-user myuser

Synchronize and compile of cookbooks is successful but then it fails with message

myserver [2015-01-08T13:54:06+01:00] ERROR: could not find recipe file /home/myuser/myuser

So it seems that the chef client is looking for the recipe in location /home/myuser/myuser but that is not where the recipes are stored.

I think that chef should look for these in /var/chef/cache. I'm not sure. Why is Chef unable to find my cookbooks? Why is Chef looking in the wrong location?

1
The full log of chef-client run may help (even better in debug mode sudo chef-client -l debug).The runlist of the node can help too (knife node show myserver). I can't see how this message could be after compilation ... I suspect it fails in the compilation phase, so a debug is near necessary to understand why - Tensibai

1 Answers

1
votes

You are missing a hyphen in your command on the ssh user

knife ssh myserver 'sudo chef-client' --manual-list --ssh-user myuser

Did you provide any configuration to the server that changes it's cookbook repo? go on the server itself and check it's client.rb

It's also possible the cookbook is not on your chef server. Make sure it's uploaded there before you continue. If you are running chef solo make sure you've defined the correct cookbook repo in your knife.rb so chef knows where to find your cookbooks.