How to enable core and change core path

On my system:

# sysctl kernel.core_pattern=/var/tmp/core.%p
kernel.core_pattern = /var/tmp/core.%p

# grep DefaultLimitCORE /etc/systemd/system.conf
DefaultLimitCORE=infinity

# ulimit -c
unlimited

# sleep 60 &
[1] 2449

# kill -3 2449
# 
[1]+  Quit                    (core dumped) sleep 60

# ls -l /var/tmp/core.*
-rw-------. 1 root root 385024 Jun 27 21:25 /var/tmp/core.2449

But it’s true that DefaultLimitCORE does not work in a minimal installation. A solution is to add such a line in: /etc/security/limits.conf:

*               -       core            unlimited