0

I am getting errors like

WARN: Failed to read the private key /etc/chef/client.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/client.pem>
ERROR: Your private key could not be loaded from /etc/chef/client.pem
Check your configuration file and ensure that your private key is readable

despite ~/.chef/knife.rb containing

client_key "#{ENV['HOME']}/.chef/chicks.pem"

which should have it looking for a different file. I ran knife through strace and found that it is reading /home/chicks/.chef/knife.rb, but it then looks for /etc/chef/client.pem and never tries to open ~/.chef/chicks.pem. I see the same issue with Mint 17.3 and Ubuntu 16.04LTS. I've tried ChefDK 0.10.0 and 0.14.25 with the same problem. Using explicit paths did not help. What else is there to look for or try?

chicks
  • 3,793
  • 10
  • 27
  • 36

1 Answers1

0

Cutting and pasting a sample config from Confluence led to UTF-8 characters in the knife.rb which knife provides no warning for. (Bah.) Converting the knife.rb to ASCII fixes the problem:

cd ~/.chef
iconv -c -f utf8 -t ascii knife.rb > clean-knife.rb
mv clean-knife.rb knife.rb

And that fixed my problem!

chicks
  • 3,793
  • 10
  • 27
  • 36