7

I'm trying to bootstrap a new chef node by running:
knife bootstrap <server ip> -x lewis -N gitlab --sudo
But I get the following output:
[Mon, 03 Sep 2012 14:45:17 +0000] INFO: *** Chef 10.12.0 ***
[Mon, 03 Sep 2012 14:45:17 +0000] INFO: Client key /etc/chef/client.pem is not present - registering
[Mon, 03 Sep 2012 14:45:17 +0000] INFO: HTTP Request Returned 401 Unauthorized: Failed to authenticate. Ensure that your client key is valid.
[Mon, 03 Sep 2012 14:45:17 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[Mon, 03 Sep 2012 14:45:17 +0000] FATAL: Net::HTTPServerException: 401 "Unauthorized"

My chef server is running Ubuntu 12.04 x32 and the machine I'm trying to bootstrap is running CentOS 6.3 x64

Any idea what's going wrong?

1
  • check date and time on ypur chef server and client
    – user293905
    Jun 12, 2015 at 13:04

3 Answers 3

7

I just had the same problem and fixed it from this thread http://comments.gmane.org/gmane.comp.sysutils.chef.user/2718

either ssh into your potential client machine and remove the /etc/chef/client.pem or run this quicky

ssh -t [email protected] "sudo rm /etc/chef/client.pem"

Run knife bootstrap again and it should work. You may have registered this machine already with another chef server.

2
  • I have the same error as the op, and there is no client.pem on the node.
    – OlegYch
    Nov 2, 2012 at 22:33
  • Yeah, it actually says there is no client.pem in the error message. My answer was to another question... oops. Nov 5, 2012 at 11:45
2

This worked for me http://wiki.opscode.com/display/chef/Common+Errors#CommonErrors-401Unauthorized(usingvalidatorAPIclient)

You need to delete validation.pem and restart chef-server, since it's broken by default in current ubuntu chef-server package.

1
  • Hi @OlgeYch , while we appreciate links to tutorials or outside sources we do ask that you include the summary of the page or process in your answer.
    – Jacob
    Nov 2, 2012 at 23:24
0

To get knife-bootstrap working add entries to your ~/.chef/knife.rb like this:

validation_client_name  "chef-validator"
validation_key          "#{ENV["HOME"]}/.chef/validation.pem"

and put a copy of the /etc/chef/validation.pem file from the Chef server copied in to $HOME/.chef/validation.pem.

If you don't like knife-bootstrap there are a number of other ways of setting this up automatically

  • create an OS image e.g a custom AMI with the validation file already in place
  • use the cloud-init package that is part of Ubuntu to seed the image with the validation file

I've used cloud-init moderately successfully in the past, but it has its quirks.

4
  • Hmm, i removed everything the the /etc/chef directory and tried running the command again and still got the same error
    – loddy1234
    Sep 3, 2012 at 22:55
  • Hi - sorry I misread your question slightly so I've rewritten the answer. Give it a try now.
    – Tim Potter
    Sep 3, 2012 at 23:15
  • Nope, still not having any luck, same error again. Just to clarify, the error above is coming from the node I'm trying to bootstrap. Am I supposed to be doing this in the node or the chef server? (I've tried both)
    – loddy1234
    Sep 4, 2012 at 9:04
  • @loddy1234 The node. You had it right. Nov 5, 2012 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .