I am on CentOS 6, trying to enable core dumps for an application I am developing. I have put:
ulimit -H -c unlimited >/dev/null
ulimit -S -c unlimited >/dev/null
in to my bash profile, but a core dump still did not generate (in a new terminal).
I have also changed my /etc/security/limits.conf so that the soft limits is zero for all users.
How do I set the location of the core files to be output? I wanted to specify the location and append the time the dump was generated, as part of the file name?
Best Answer
To set location of core dumps in CentOS 6 you can edit
/etc/sysctl.conf
. For example if you want core dumps in/var/crash
:Where variables are:
Also you have to add
/etc/sysconfig/init
Now apply new changes:
But there is a caveat whit this way. If the kernel parameter kernel.core_pattern is always reset and overwritten at reboot to the following configuration even when a value is manually specified in
/etc/sysctl.conf
:In short when
abrtd.service
startskernel.core_pattern
is overwritten automatically by the system installedabrt-addon-ccpp
. There are two ways to resolve this:Setting
DumpLocation
option in the/etc/abrt/abrt.conf
configuration file. The destination directory can be specified by setting DumpLocation =/var/crash
in the/etc/abrt/abrt.conf
configuration file, andsysctl kernel.core_pattern
's displayed value is a same but actually core file will be created to the directory under/var/crash
.Also if you have SELinux enabled you have to run:
And finally restart
abrtd.service
:Stop abrtd service.
kernel.core_pattern
will not be overwritten. - (I've never tested).