I am using Ubuntu 22.04.
cat /proc/sys/kernel/core_pattern
|/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h
As far as I understand I am using systemd-coredump to generate coredump files when my C++ program crashes. However the coredump files are stored here /var/lib/systemd/coredump
I would like to change the coredump storing location to be at the same place where the executable is.
This thing drives me crazy, I red alot over stackoverflow but all info looks to be for older versions of Ubuntu not for 22.04.
Is there anyway I can achieve that?
P.S.
I have uninstalled apport by running sudo apt-get remove apport
So, this was a rabbit hole...
Try doing things in this checklist:
ulimit -s unlimited
so that you have no memory limit of how large the core dump needs to besudo bash -c "sudo bash -c "echo 'core.%p.%e.%t.%h' > /proc/sys/kernel/core_pattern"
which will set the core dump location to the local directory with the patterncore.%p.%e.%t.%h
sudo sysctl --system
which shows kernel parameters being set by each file. In my case, I had a line which saidApplying /usr/lib/sysctl.d/50-coredump.conf
which was changing my coredump pattern to go through systemd. So I edited this file so that line would then havekernel.core_pattern=core.%e.%p.%h.%t
and this fixed is so that saving the core dump within the same folder now persists after reboot as well.