Chef Solo - Chef::Exceptions::PrivateKeyMissing

2,028 views
Skip to first unread message

OmenKing

unread,
May 25, 2011, 10:10:22 PM5/25/11
to Vagrant
So I'm using Chef for provisioning, I can ssh into my box no problem,
the chef gem is install yadda yadda, just doesn't this Private Key
stuff.
I registered at Opscode and got my private key, I don't know if I have
to put this in my base box, or I can specific it in the config, or I
shouldn't have to have a key and I'm doing something wrong all
together. My understanding of the key is that so you can download
cookbooks via the web while chef is running, but I don't know tons
about chef and I get headaches reading though all this stuff. Hoping
someone can point me in the right direction here.

full backtrace:
http://pastie.org/1974245

but probably what you want to see:
FATAL: Chef::Exceptions::PrivateKeyMissing: I cannot read /etc/chef/
client.pem, which you told me to use to sign requests!

VagrantFile

Vagrant::Config.run do |c|
c.vm.forward_port 'web', 80, 4567
c.vm.box = 'deb'
c.ssh.username = 'deploy'
c.ssh.private_key_path = '~/.ssh/id_rsa.pro'
c.vm.provision :chef_solo do |chef|
chef.cookbooks_path = 'cookbooks'
chef.add_recipe 'vagrant_main'
end
end


vagrant_main default.rb

include_recipe 'apache2'
include_recipe 'mysql'
include_recipe 'passenger_apache2'
include_recipe 'munin'
include_recipe 'monit'
include_recipe 'nagios'

Jake Vanderdray

unread,
May 27, 2011, 9:32:11 AM5/27/11
to vagra...@googlegroups.com
The registration with Opscode allows you to use their chef server to host your cookbooks.  If you want to do that then you'll want to follow the instructions here: http://vagrantup.com/docs/provisioners/chef_server.html.  You'll also need to upload your cookbooks to the opscode chef server, setup knife, etc.

Since you're getting this error while running vagrant with chef solo (which uses cookbooks just on the local file system instead of connecting to a server), I suspect one of the cookbooks is attempting to do something that is only supported when using a server.  I've hit this when one of my cookbooks tries to do a search.

You can try commenting out the recipes that you're currently including, then adding them back in one at a time to identify which one is introducing the problem.  You can also vagrant ssh into your vagrant instance and look in /tmp/vagrant-chef/chef-stacktrace.out to try to get a better idea where the error is happening.

Good luck,
Jake.

OmenKing

unread,
May 27, 2011, 2:54:42 PM5/27/11
to Vagrant
Thanks Jake,

That was the case, one of my cookbooks wanted to call home so
I just had to comment it out. FYI if you signup on to get a keep
on opscode, they might surprise you with a phone call.

Joshua Timberman

unread,
May 31, 2011, 3:29:52 AM5/31/11
to vagra...@googlegroups.com
On May 27, 2011, at 12:54 PM, OmenKing wrote:

> That was the case, one of my cookbooks wanted to call home so
> I just had to comment it out.

>>> include_recipe 'nagios'

Based on your list of cookbooks I imagine this is the one that was performing search. To be fair, the README in this cookbook does indicate that it will use search and because of this, does not work with Chef Solo.

Also, to be clear, the search doesn't "call home" [to Opscode], it performs a request to the Chef Server's search API. The only time Chef will contact the Opscode Platform is if it is your configured Chef Server.

--
Opscode, Inc
Joshua Timberman, Director of Training and Services
IRC, Skype, Twitter, Github: jtimberman

Reply all
Reply to author
Forward
0 new messages