How To Enable Core Dumps In RHEL6

How To Enable Core Dumps In RHEL6

Recently an application forced the need to create and collect core dumps on RHEL6 systems. The below process will also work on any RHEL variants (CentOS, Scientific Linux).

Edit /etc/security/limits.conf, notice this is set to all processes but if you have a process running as a service account replace the * with the service account. You will have to restart the process for this change to go into effect.

# vi /etc/security/limits.conf
#* soft core 0
* soft core unlimited

Edit /etc/sysctl.conf and add where to put the core file and any naming standard.

# vi /etc/sysctl.conf
kernel.core_pattern = /tmp/core-%e-%s-%u-%g-%p-%t
fs.suid_dumpable = 2

Filename variables:

%e is the filename
%g is the gid the process was running under
%p is the pid of the process
%s is the signal that caused the dump
%t is the time the dump occurred
%u is the uid the process was running under

Edit the /etc/sysconfig/init and set a core file limit.

# vi /etc/sysconfig/init

Now let’s put the changes into play.

# sysctl -p

Next time there is a crash you will have a core file!