Re: Create and inspect core dumps of service programs
Reply #1 –
Any useful hints on here?
https://discuss.aerospike.com/t/enabling-coredumps-on-redhat-centos/713
I think I got coredumps working from those instructions when I needed them, although adapted a bit. Remember things like /etc/profile get read at boot so I guess you have to run the ulimit command before whatever service you are debugging has started somehow. I don't know exactly how that plays out regarding the crashing service, perhaps even make a little service of your own that runs before? The dumping cores in a specific location might help too?
Edit: checking what I actually did:
Created /etc/sysctl.conf:
kernel.core_pattern = coredumpfile
#kernel.core_pipe_limit = 0
kernel.core_uses_pid = 1
Modified /etc/security/limits.conf:
#* soft core 0
* soft core unlimited
Tested, in one terminal run "top", then another:
$ sudo kill -11 `pidof top`
This makes e.g. coredumpfile.2945 which is quite uniquely named to search for, and you can do sudo updatedb and then locate coredumpfile, beware while you have them enabled everything that crashes anywhere will make a coredump so you might get them in unexpected places which will waste drive space. This was using openrc and you might be able to improve things a bit for your purposes.
Looking around some more, in openrc the "sysctl" service runs the config in /etc/sysctl.conf so anything running before then wouldn't work as expected. Also security/limits.conf might not work for init shells as it relates to pam so, possibly see the first link to run a ulimits cmd instead before or during the service?