How to interpret Chef logs and errors

The most important logs in Scalarium are the Chef logs. This is the output of the Chef run that is used for setting up the instance and for deploying.

If you have an error in your Chef recipes or a deployment failed for any reason, the log files will tell you what went wrong. Chef logs are keps for all instance lifecycle events.

If the log contains an error or failed in some way, it should already be scrolled to the first line of the first error. The errors are highlighted and you should find the cause for your troubles soon.

In most cases the lines above the error will give you a hint were to start searching.

Here are some examples for common Chef run failures and their causes:

Missing recipe or cookbook

DEBUG: Loading Recipe world::domination via include_recipe  
ERROR: Caught exception during execution of custom recipe: world::domination: Cannot find a cookbook named world; did you forget to add metadata to a cookbook? **

An error message like this means that Chef is not able to find the cookbook names world. This could be because you forgot to add or commit the cookbook or recipe. Also once committed, a cookbook is not immediately available on all instances.

Newly booted instances will checkout the latest version but already running servers will happily use their old versions. You have to explicitly tell the servers to update their custom cookbooks.

To update your cookbooks on all servers you have to trigger the "update cookbooks" task first. You can find that in the "actions" menu of your cloud.

Local Command Failure

DEBUG: ---- End output of ./configure --with-config-file-path=/ returned 2 
ERROR: execute[PHP: ./configure] (/root/scalarium-agent/site-cookbooks/php-fpm/recipes/install.rb line 48) had an error:
./configure --with-config-file-path=/

An error like this mean that a command that you executed using the Chef execute resource failed. Failing means returning a non-zero exit code (2 in this case). If you scroll a little to the top you will see the actual STDOUT and STDERR of the command which will help you with figuring out why it failed.

Package Failure

ERROR: package[zend-server-ce-php-5.3] (/root/scalarium-agent/site-cookbooks/zend_server/recipes/install.rb line 20) had an error: apt-get -q -y --force-yes install zend-server-ce-php-5.3=5.0.4+b17 returned 100, expected 0

Wow that sounds tough. But actually its not. Scroll up to the part with STDOUT and STDERR to get more information.

DEBUG: Executing apt-get -q -y --force-yes install zend-server-ce-php-5.3=5.0.4+b17
DEBUG: ---- Begin output of apt-get -q -y --force-yes install zend-server-ce-php-5.3=5.0.4+b17 ----
DEBUG: STDOUT: Reading package lists...
...
DEBUG: STDERR: Failed to fetch http://repos.zend.com/zend-server/deb/pool/non-free/libf/libframework1/libframework1-zend-server_1.10.4+b8_all.deb  503  Service Unavailable [IP: 123.0.0.321 80]

Looks like the package you specified is not available. Check if the package name is correct or if you have to add a different repository.