It can be difficult to get core dumps for Heartbeat - because the code is security conscious and switches user ids back and forth to make it difficult to exploit the code to get root permissions. We have made progress on this, and so have the OS vendors, so these descriptions have several parts depending on what version and OS you're running.
General Core Dump Enabling
Enabling unique core files
If your kernel has the /proc file /proc/sys/kernel/core_uses_pid, then you should execute this command: echo 1 > /proc/sys/kernel/core_uses_pid. If your kernel doesn't support this, then it's probably not a problem, but enable it if you can.
Enabling core dumps for setuid processes
Release 2 should not need this step (if seems to need this, please let us know).
If you're running a kernel which has the file /proc/sys/kernel/suid_dumpable, then you should execute this command: echo 2 > /proc/sys/kernel/suid_dumpable.
If you're not running release 2, and your kernel does not support the suid_dumpable capability and the process which is dying and should produce a core dump isn't, then you will likely have to make a source change to Heartbeat and recompile.
The source file you want to change is lib/clplumbing/uids.c. This file ought to start with a section of code that looks about like this:
int /* Become nobody - and remember our original privileges */ drop_privs(uid_t uid, gid_t gid) { int rc; gid_t curgid = getgid(); if (!anysaveduid) { poweruid=getuid(); powergid=curgid; }
We need to make this code into a no-op, so inserting a return after the declarations ought to do it.
int /* Become nobody - and remember our original privileges */ drop_privs(uid_t uid, gid_t gid) { int rc; gid_t curgid = getgid(); return; /* Disable security precautions DON'T LEAVE THIS IN HERE FOREVER! */ if (!anysaveduid) { poweruid=getuid(); powergid=curgid; }
Now, recompile and reinstall Heartbeat.
Core dump locations. Heartbeat core dumps should show up in one of these two locations - depending on the release of Heartbeat you're using:
/etc/ha.d
/var/lib/heartbeat/cores/*
Now, you should get core dumps when a Heartbeat process ought to core dump.