To enable system wide core dumps:
To analyse segfaults in processes it might be of need to allow them to dump their state into a core file.
To enable system wide core dumps you may use the following commands:
ulimit -c unlimited
grep -Flq 'ulimit -c unlimited' /etc/default/rcS || echo "ulimit -c unlimited" >>/etc/default/rcS
ucr set security/limits/user/*/soft/core=unlimited security/limits/user/*/hard/core=unlimited
install -d -m2733 /var/tmp/core
cat >/etc/sysctl.d/core.conf <<__CONF__
kernel.core_pattern = /var/tmp/core/core-%e-%p-%t
kernel.core_uses_pid = 1
fs.suid_dumpable = 2
sysctl -q -p /etc/sysctl.d/core.conf
A reboot is needed to apply the new ulimit to all processes.
Please not that core dumps may take up alot of disk space! You should monitor /var/tmp/core especially if it is held on the root filesystem.
To disable system wide core dumps:
To disable the system wide core dumps, use the following commands:
ulimit -c 0
grep -Flq 'ulimit -c unlimited' /etc/default/rcS && sed -i "/^ulimit -c unlimited$/d" /etc/default/rcS
ucr unset security/limits/user/*/soft/core security/limits/user/*/hard/core
rm -f /etc/sysctl.d/core.conf
sysctl -q -w kernel.core_uses_pid=0 fs.suid_dumpable=1
A reboot it needed to apply the default ulimit to all processes.
You may also delete already created dumps:
rm -f /var/tmp/core/*