How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

February 17, 2015

How to enable Core Dumps in CentOS

Filed under: Linux — Tags: , , , — admin @ 12:17 pm

To enable core dumps for all daemon, please follow these steps:
Edit the /etc/profile. At line 26 of the file, replace this line:
ulimit -S -c 0 > /dev/null 2>&1

with this line:
ulimit -c unlimited >/dev/null 2>&1

Replace this line (around line 138 ) in /etc/init.d/functions
ulimit -S -c 0 >/dev/null 2>&1

with this:
ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1

Enable core-dumping globally by editing the /etc/sysconfig/init file and adding the line:
DAEMON_COREFILE_LIMIT=’unlimited’

Enable it for specific daemons by adding this line in the /etc/sysconfig/$daemon:
DAEMON_COREFILE_LIMIT=’unlimited’

Optionally, enable core dump for SUID programs:
echo 2 > /proc/sys/fs/suid_dumpable

mkdir /tmp/core
chmod 777 /tmp/core

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

fs.suid_dumpable = 2
kernel.core_uses_pid = 1
kernel.core_pattern = /tmp/core
Then reload the settings in /etc/sysctl.conf:
sysctl -p

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress