dmesg, another tool in my toolbox

Today, thanks to @SzarekKrzysztof, one of the most experienced DevOps I know, I got familiar with another Unix operating system command called dmesg (diagnostic message).

The command, according to Wikipedia, prints the message buffer of the kernel. Simply speaking, it displays the kernel-related messages on Unix systems. The output may be very helpful for diagnosing device failures. The device in our case was a brand new Amazon EC2 instance. Its booting process failed, but I didn’t know why. Using bash piping, a simple combination of dmesg and grep commands allowed us to find the reason:

kernel: [ 2314.580333] Out of memory: Kill process 4499 (chef-client) score 89 or sacrifice child

As we use Chef for provision which consumes quite a lot of memory, it occurred that the new instance had not enough RAM to handle all operations that should be performed during boot time. nano instance types have only 0.5 GB of memory. Fortunately, we managed to make the instance alive manually 🛠️. Everything happened in a pre-production environment, so there was no damage 😌.

Thanks to Krzysztof, I have another tool in my toolbox 🙇.

You can find the logs produced by the kernel inside var/log/kern.log file.

Igor Springer

I build web apps. From time to time I put my thoughts on paper. I hope that some of them will be valuable for you. To teach is to learn twice.


Leave a Reply

Your email address will not be published. Required fields are marked *