Where are my core dump files?
One day, on a Ubuntu 22.04 machine, I had to debug my application which segfaults with messages like: corrupted double-linked list
or free(): corrupted unsorted chunks
.
I could see an error message:
but could not find the corresponding core dump file anywhere.
Where is it?
Ubuntu and core dumps
After some googling, I could find some articles saying that core dumps are handled by Apport in Ubuntu, but they are not enabled in stable releases.
There were a few solutions for this, and I chose to install systemd-coredump
:
Generating core dumps
After installing systemd-coredump, and running my faulty application, it finally generated a core dump file.
I could find it in /var/lib/systemd/coredump/
:
Using the core dump file
List the dumped files,
dump desired one into the current directory,
and debug it with:
or debug directly with coredumpctl
:
Clean up unused core dump files
Unused core dump files can be deleted at once with:
then they will be displayed as ‘missing’ on coredumpctl list
.
Wrap-Up
Some linux distributions don’t enable core dumps due to security or storage issues.
When needed, they can be enabled and help debugging things.