HOWTO enable core-dumps

From LinuxReviews
Jump to navigationJump to search

This is how you enable core-dumps on RHEL, CentOS and Fedora. These steps should work on other Linux systems as well.

What's a core-dump?

When a program crashes then it may leave a core which can be used to figure out exactly why the program crashed - which is specially useful if you are a programmer.

Core dumps are disabled by default on many Linux distributions as core-dumping on production machines is generally considered a bad idea.

HOWTO enable core-dumps

To enable core dumps for all daemon, please follow these steps:

Enable core-dumping globally by creating or editing the /etc/sysconfig/init file and adding the line:

DAEMON_COREFILE_LIMIT='unlimited'

/etc/sysconfig/init exists on CentOS but has to be created on Fedora.

Enable core-dumps for specific daemons by adding this line in the /etc/sysconfig/$daemon:

DAEMON_COREFILE_LIMIT='unlimited'

Optionally, enable core dump for SUID programs:

echo 1 > /proc/sys/fs/suid_dumpable

Edit the /etc/sysctl.conf and add the following:

fs.suid_dumpable = 1
kernel.core_uses_pid = 1

Then reload the settings in /etc/sysctl.conf:

sysctl -p

If you want to core dump on setuid programs you launch (for example, X), make sure the current directory is world writable.

Questions?


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.