Enable coredump centos 7 with systemd

I went through couple of articles after some googling but nothing seems to work.

I am using Centos 7.

Let me explain what have I done so far.

I followed step by step

http://www.kibinlabs.com/re-enabling-core-dumps-redhat-7/

After that, I can get the coredump generated but only if I start the process manually, however, whenvever I start the process like

systemctl start <myprocess>

it does not generate coredump after killing with SEGV

kill -11 <pid>

var/log/messages shows that it got the signal SEGV but I cant see the coredump.

The kernel core pattern is also set.

cat /proc/sys/kernel/core_pattern
/var/lib/coredumps/core-%e-sig%s-user%u-group%g-pid%p-time%t


coredump.conf 

cat /etc/sysctl.d/50-coredump.conf
Storage=both

cat  /etc/sysctl.d/99-sysctl.conf
fs.suid_dumpable = 1
kernel.core_uses_pid = 1

    Storage=both
    [root@server01 coredumps]# ls -l /etc/sysctl.d/50-coredump.conf
    lrwxrwxrwx 1 root root 26 Aug  6 13:51 /etc/sysctl.d/50-coredump.conf -> /etc/systemd/coredump.conf

Solution 1:

I believe you might be trying to kill a daemon with the SUID bit set.

In that case you will need to use fs.suid_dumpable = 2

The other thing to make sure is that the permission on the whole path where you save the core dump has proper permission.

In your case it means that users need to be able to execute on /var on /var/lib and be able to write in /var/lib/coredumps.

The users here are actually the users that own the process being killed, not the user killing the process.