Debugging Chef client runs
Sometimes you get obscure error messages when running the Chef client and you have a hard time finding any clue about where to look for the error. Is your cookbook broken? Do you have a networking issue? Is your Chef server down? Only by looking at the most verbose log output do you have a chance to find out.
Getting ready
You need a Chef client hooked up to the hosted Chef or your own Chef server.
How to do it…
To see how we can ask the Chef client to print debug messages, run the Chef client with debug
output:
user@server:~$ sudo chef-client -l debug ...TRUNCATED OUTPUT... [2016-11-14T07:57:36+00:00] DEBUG: Sleeping for 0 seconds [2016-11-14T07:57:36+00:00] DEBUG: Running Ohai with the following configuration: {:log_location=>#<IO:<STDOUT>>, :log_level=>:debug, ...TRUNCATED OUTPUT... [2016-11-14T07:57:37+00:00] DEBUG: Plugin C: ran 'cc -V -flags' and returned 1 [2016-11-14T07:57:37+00:00] DEBUG: Plugin C 'cc -V -flags' failed. Skipping data. [2016...