Core dumps are very useful for debugging applications which doesn't have their own error log file. It is disabled by default for normal users. You can enable it by adjusting some kernel parameters in /etc/sysctl.conf file.

kernel.core_uses_pid = 1
kernel.core_pattern = core.%%.%e.%p.%.%u.%g.%t.%h.%e.%c

%% a single % character
%p PID of dumped process
%u UID of dumped process
%g GID of dumped process
%s number of the signal causing dump
%t time of dump, expressed as seconds
%h hostname
%e executable filename (without path prefix)
%c core file size soft resource limit of crashing process

Enable the core patterns you need and run the below command to reflect the changes.

sysctl -p

In most Linux distributions, core dump file size defaults to '0' which disables the core dump generation. You can check the same using the below command:

root@whr [~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 57344
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 57344
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

For the SSH session you are in, you can enable core dumps using the below command:

ulimit -c unlimited

Check the results again and you will see that file size is now unlimited. But as mentioned earlier, it will only be unlimited for the current SSH session.

root@whr[~]# ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 57344
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 57344
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

To enable it for all users on all sessions, you need to set that in /etc/security/limits.conf file.

echo "*  soft  core  unlimited" >> /etc/security/limits.conf

If you are on a OpenVz/Virtuozzo node, make sure this is enabled in the main node. Enjoy dumping!!