Kabb5
Kabb5

Reputation: 3870

Enabling core files on CentOS 6

I am trying to enable core files on a machine running CentOS; however, nothing I have tried has produced core files…here is what I have done:

Added the following two lines to /etc/security/limits.conf:

*     hard    core    unlimited
*     soft    core    unlimited

Added the following line to /etc/sysconfig/init:

DAEMON_COREFILE_LIMIT='unlimited

Added the following line to /etc/profile:

ulimit -c unlimited > /dev/null 2>&1

Added the following lines to /etc/sysctl.conf:

kernel.core_pattern = '/srv/core/%p_%t.core'
fs.suid_dumpable = 1

I made sure that /srv/core exists and has 777 permissions. The I executed init 6 to reboot the OS. Upon the system coming back up, I executed the following C script in an attempt to produce a core file:

#include <sys/types.h>
#include <unistd.h>
#include <signal.h>

int main(int argc, char **argv) {
  kill(getpid(), SIGQUIT);
}

The output is simply Quit, while I was hoping to see Quit (core dumped); and it obviously does not produce a core file :(

What am I missing or doing wrong? Thanks in advance for your help!

Upvotes: 0

Views: 3313

Answers (2)

Rafael
Rafael

Reputation: 11

Just change: 
kernel.core_pattern = '/srv/core/%p_%t.core' to kernel.core_pattern = /srv/core/%p_%t.core without "'" and it will work...

Upvotes: 1

jrl
jrl

Reputation: 21

It looks as if core files are generated by default on CentOS 6, but handled by the "ABRT" service, which may write them into the /var/spool/abrt directory by default. This is how a VM install works for me, at any rate. To illustrate this, I did the following:

  1. "sleep 50 &"
  2. "kill -SIGSEGV "
  3. "abrt-cli list"
  4. identify the "Directory:" line matching my segfaulted sleep process and cd to it
  5. found the coredump file stored there

SIGQUIT seems to generate a core, as well.

Given these, I'd verify that the abrt services are running, I'd see whether I had previous entries in /var/spool/abrt that are masking out new core files (I think abrt tries to avoid duplicate entries, which you may want). I'm not sure whether any additional configuration will help or hurt, though.

Upvotes: 2

Related Questions