When an unhandled exception, illegal memory access, segmentation fault (SIGSEGV), or abort signal (SIGABRT) strikes a running daemon or software binary in Linux, the operating system terminates the process immediately. Historically, retrieving diagnostic memory images (core dumps) required configuring custom ulimit -c boundaries, tweaking /proc/sys/kernel/core_pattern strings, and searching unpredictable filesystem locations. On modern Linux distributions running systemd, core dump capture is handled automatically through systemd-coredump. Integrated seamlessly into the system journal, the companion utility coredumpctl allows administrators and software engineers to locate, inspect, extract, and load application crashes directly into the GNU Debugger (GDB). Mastering coredumpctl turns cryptic crash terminations into actionable post-mortem root-cause analyses.
Understanding systemd-coredump Architecture and Ingestion Pipelines
When a process terminates abnormally due to a fatal signal, the Linux kernel checks the core_pattern sysctl interface. On systemd-managed systems, the kernel passes the crash payload via a pipe directly to the systemd-coredump collector binary.
The systemd-coredump daemon performs several automated tasks:
- Journal Metadata Logging: Captures critical execution context, including the process ID (PID), user ID (UID), group ID (GID), terminating signal, executable path, command-line arguments, and timestamps.
- Stack Trace Synthesisation: Automatically generates a truncated user-space backtrace directly within the system journal, allowing administrators to inspect the crashing function call without launching GDB.
- Storage Compression: Compresses the raw memory dump using Zstandard (zstd) or LZ4 compression and saves it to
/var/lib/systemd/coredump/, enforcing disk quota retention limits defined in/etc/systemd/coredump.conf.
Listing and Filtering Crash Events Using coredumpctl
Invoking coredumpctl without arguments outputs a chronological table of all recorded crash events stored within the journal.
coredumpctl list
The resulting table displays columns detailing the incident timestamp, PID, UID, GID, terminating signal number (e.g. SIGSEGV or SIGABRT), core dump storage status (present, truncated, or missing), and the executable path.
Filtering by Binary Name or Process ID
In high-throughput server environments, listing all system crashes can generate overwhelming output. Filter results by targeting specific executable binaries or PIDs:
- Filter by Executable:
coredumpctl list /usr/sbin/nginx - Filter by Specific PID:
coredumpctl list 14820 - Filter by Recent Time Windows:
coredumpctl list --since="yesterday"
Inspecting Detailed Crash Telemetry via coredumpctl info
Before launching a full-scale debugger session, use the info command to inspect the automated journal metadata and built-in stack trace.
coredumpctl info /usr/bin/my_app
The command outputs a comprehensive diagnostic dossier including:
- Signal and Memory Offset: Displays the exact instruction pointer register (
$ripor$pc) where the illegal memory dereference occurred. - Module Map: Lists all shared dynamic libraries (
.sofiles) loaded in memory at the time of the crash along with their cryptographic build IDs. - Initial Stack Backtrace: Renders a formatted call trace illustrating the sequence of internal function invocations leading up to the fatal instruction.
Loading Crash Dumps Directly into GDB for Interactive Debugging
To inspect CPU register states, local variable memory values, and deep thread stacks, coredumpctl can decompress the core file and invoke GDB in a single operation.
- Ensure the GNU Debugger is installed on your Linux distribution:
sudo apt install -y gdb # Debian/Ubuntu sudo dnf install -y gdb # RHEL/Fedora/Rocky - Invoke the GDB debugging session for the most recent crash of a designated binary:
coredumpctl debug /usr/bin/my_app - The utility automatically matches the correct binary version against the compressed core archive in
/var/lib/systemd/coredump/and launches the interactive(gdb)shell prompt. - Within GDB, execute standard post-mortem diagnostic commands:
bt:Prints the full call backtrace across the active thread.bt full:Displays the backtrace along with the values of all local variables within each stack frame.info registers:Outputs the state of all CPU registers at the exact millisecond of process termination.thread apply all bt:Prints backtraces across all concurrently executing threads in multi-threaded daemons.
- Type
quitto exit GDB and return to your terminal.
Extracting and Exporting Core Dumps for Remote Analysis
When server crashes must be escalated to an external software engineering team or analysed on a separate developer workstation equipped with debug symbols (dbgsym), extract the uncompressed binary memory dump:
coredumpctl dump /usr/bin/my_app --output=/tmp/app_crash.core
This command extracts the raw ELF core file, which can then be transferred via SSH or SCP alongside the matching compiled application binary.
Configuring Storage Quotas and Retention in coredump.conf
To prevent repeated crash loops from exhausting server disk space, configure the storage thresholds in /etc/systemd/coredump.conf.
- Open the configuration file in a text editor:
sudo nano /etc/systemd/coredump.conf - Customise the key storage directives:
[Coredump] Storage=external Compress=yes ProcessSizeMax=2G MaxUse=5G KeepFree=10G - Storage=external: Stores core files in
/var/lib/systemd/coredump/. Setting this tononelogs journal metadata only, omitting the raw memory dump. - MaxUse: Caps the maximum aggregate disk space consumed by stored core files. Once exceeded, systemd automatically purges the oldest dumps.
- Save and exit (Ctrl + O, Enter, Ctrl + X), then reload the daemon configuration:
sudo systemctl daemon-reload
Leveraging coredumpctl provides system administrators and software engineers with a unified, high-performance toolkit to audit fatal application terminations across modern Linux server environments.