Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RHEL 8 how to leave core files in working directory

Tags:

linux

coredump

I have a product with many executables, and in its older versions (RHEL 5 and previous) the default behavior when a crash occurred was to deposit the core file in the executable's current working directory, with the name core.pid. In RHEL 7 and 8, the new behavior is that all core files go to /var/lib/systemd/coredump/. In order to avoid modifying about a dozen watchdog programs that expect the old behavior, I'd prefer to just revert to the old core locations (in process's cwd). How do I change that behavior?

like image 912
Mark Warren Avatar asked Oct 20 '25 11:10

Mark Warren


1 Answers

Looks like I found my own answer. I added this line to /etc/sysctl.d/99-sysctl.conf:

kernel.core_pattern = core.%p

and that's all that was necessary. This takes effect after reboot, but you can also make it immediate by running

echo "core.%p" > /proc/sys/kernel/core_pattern

Note that my servers are NOT running abrtd, and this likely has an effect on whether this solution works.

like image 76
Mark Warren Avatar answered Oct 23 '25 01:10

Mark Warren