3.4.4. Creating and accessing a core dump with coredumpctl
To manage and analyze core dumps directly on the affected system, use coredumpctl. This tool simplifies finding, capturing, and inspecting crash data. Identify an unresponsive process, force a core dump, and verify its successful capture to diagnose application failures.
Prerequisites
The system must be configured to use
systemd-coredumpfor core dump handling. To verify this is true:$ sysctl kernel.core_patternThe configuration is correct if the output starts with the following:
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump
Procedure
Find the PID of the hung process, based on a known part of the executable file name:
$ pgrep -a executable-name-fragmentThis command will output a line in the form
PID command-lineUse the command-line value to verify that the PID belongs to the intended process.
For example:
$ pgrep -a bc5459 bcSend an abort signal to the process:
# kill -ABRT PIDVerify that the core has been captured by
coredumpctl:$ coredumpctl list PIDFor example:
$ coredumpctl list 5459TIME PID UID GID SIG COREFILE EXE Thu 2019-11-07 15:14:46 CET 5459 1000 1000 6 present /usr/bin/bcFurther examine or use the core file as needed.
You can specify the core dump by PID and other values. See the coredumpctl(1) manual page for further details.
Next steps
To show details of the core file, run:
$ coredumpctl info PIDTo load the core file in the GDB debugger, run:
$ coredumpctl debug PIDDepending on the availability of debugging information, GDB might suggest commands to run, such as:
Missing separate debuginfos, use: dnf debuginfo-install bc-1.07.1-23.el10.x86_64For more details on this process, see Getting debuginfo packages for an application or library using GDB.
To export the core file for further processing elsewhere, run:
$ coredumpctl dump PID > /path/to/file_for_exportReplace /path/to/file_for_export with the file where you want to put the core dump.
$ coredumpctl dump PID > /path/to/file_for_export