Tuesday, May 27, 2014

How to generate Crash dump/ Core dump in Linux (CentOS) environment?

How to generate Crash dump/ Core dump in Linux (CentOS) environment?
#Crashdump #Coredump #CentOS

I had the same query in my mind and after spending around 3 to 5 hrs of search in Google end up getting some ideas. All the information i got was in bits and pieces and its not complete. After scrambling my head for quite amount of time all the pieces fitted in the right place.

Here in this article i will give a insight of how to generate Crashdump/Coredump in CentOS Linux.

Generate CrashDump
#generatecoredump


By default CentOS will not generate a crash dump for process other than Kernel process. In order to make CentOS to generate crash dump few settings has to be modified. Follow the below steps to enable crash dump for user generated application/process:

Move to the location /etc/abrt and open the file abrt-action-save-package-data.conf

     /etc/abrt/abrt-action-save-package-data.conf

Default value of the variable “ProcessUnpackaged = no” will be 'no'. This is reason why CentOS will not generate Crash Dump for user created process. Change the value from “no” to “yes” to generate Crash dump.

          “ProcessUnpackaged = yes


Location of the Core Dump
#coredumplocation  #centOScoredumplocation

Default location of core dump In CentOS will be  /var/spool/abrt


Format of the Core Dump
#coredumpformat

Format of the core dump file will be available in the file /proc/sys/kernel/core_pattern
Sample pattern available in the core_pattern file.

Eg: /usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e

Core dump file usually will not have process id in the core dump file name. To include the process id in the core dump, change the value in the file 'core-user-pid' in the location /proc/sys/kernel.
Change the value in the file /proc/sys/kernel/core-user-pid from 0 to 1 to include the process id in the file name.

Eg: ccpp-2014-05-02-17:03:33-12566

Here the file name includes the process ID 12566 because of the value 1 in the file core-user-pid.