Ubuntu – Chef bootstrap giving 401 unauthorized

centoschefknifeUbuntu

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?

Best Answer

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 name@new.client.net "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.

Related Topic