Chapter 19. Analyzing a core dump
To identify the cause of the system crash, you can use the crash
utility, which provides an interactive prompt similar to the GNU Debugger (GDB). By using crash
, you can analyze a core dump created by kdump
, netdump
, diskdump
, or xendump
and a running Linux system. Alternatively, you can use the Kernel Oops Analyzer or the Kdump Helper tool.
19.1. Installing the crash utility Copy linkLink copied to clipboard!
With the provided information, understand the required packages and the procedure to install the crash utility. The crash
utility might not be installed by default on your RHEL 9 systems. crash
is a tool to interactively analyze a system’s state while it is running or after a kernel crash occurs and a core dump file is created. The core dump file is also known as the vmcore
file.
Procedure
Enable the relevant repositories:
subscription-manager repos --enable baseos repository
# subscription-manager repos --enable baseos repository
Copy to Clipboard Copied! Toggle word wrap Toggle overflow subscription-manager repos --enable appstream repository
# subscription-manager repos --enable appstream repository
Copy to Clipboard Copied! Toggle word wrap Toggle overflow subscription-manager repos --enable rhel-9-for-x86_64-baseos-debug-rpms
# subscription-manager repos --enable rhel-9-for-x86_64-baseos-debug-rpms
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
crash
package:dnf install crash
# dnf install crash
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
kernel-debuginfo
package:dnf install kernel-debuginfo
# dnf install kernel-debuginfo
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The package
kernel-debuginfo
will correspond to the running kernel and provides the data necessary for the dump analysis.
19.2. Running and exiting the crash utility Copy linkLink copied to clipboard!
The crash
utility is a powerful tool for analyzing kdump
. By running crash
on a crash dump file, you can gain insights into the system’s state at the time of the crash, identify the root cause of the issue, and troubleshoot kernel-related problems.
Prerequisites
-
Identify the currently running kernel (for example
5.14.0-1.el9.x86_64
).
Procedure
To start the
crash
utility, two necessary parameters need to be passed to the command:-
The debug-info (a decompressed vmlinuz image), for example
/usr/lib/debug/lib/modules/5.14.0-1.el9.x86_64/vmlinux
provided through a specifickernel-debuginfo
package. The actual vmcore file, for example
/var/crash/127.0.0.1-2021-09-13-14:05:33/vmcore
The resulting
crash
command then looks:crash /usr/lib/debug/lib/modules/5.14.0-1.el9.x86_64/vmlinux /var/crash/127.0.0.1-2021-09-13-14:05:33/vmcore
# crash /usr/lib/debug/lib/modules/5.14.0-1.el9.x86_64/vmlinux /var/crash/127.0.0.1-2021-09-13-14:05:33/vmcore
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the same <kernel> version that was captured by
kdump
.
-
The debug-info (a decompressed vmlinuz image), for example
Running the crash utility.
The following example shows analyzing a core dump created on September 13 2021 at 14:05 PM, using the 5.14.0-1.el9.x86_64 kernel.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To exit the interactive prompt and stop
crash
, typeexit
orq
.crash> exit ~]#
crash> exit ~]#
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The crash
command is also utilized as a powerful tool for debugging a live system. However, you must use it with caution to avoid system-level issues.
19.3. Displaying various indicators in the crash utility Copy linkLink copied to clipboard!
Use the crash
utility to display various indicators, such as a kernel message buffer, a backtrace, a process status, virtual memory information and open files.
Displaying the message buffer
To display the kernel message buffer, type the
log
command at the interactive prompt:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type
help log
for more information about the command usage.NoteThe kernel message buffer includes the most essential information about the system crash. It is always dumped first in to the
vmcore-dmesg.txt
file. If you fail to obtain the fullvmcore
file, for example, due to insufficient space on the target location, you can obtain the required information from the kernel message buffer. By default,vmcore-dmesg.txt
is placed in the/var/crash/
directory.
Displaying a backtrace
To display the kernel stack trace, use the
bt
command.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type
bt <pid>
to display the backtrace of a specific process or typehelp bt
for more information aboutbt
usage.
Displaying a process status
To display the status of processes in the system, use the
ps
command.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use
ps <pid>
to display the status of a single specific process. Use help ps for more information aboutps
usage.
Displaying virtual memory information
To display basic virtual memory information, type the
vm
command at the interactive prompt.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use
vm <pid>
to display information about a single specific process, or usehelp vm
for more information aboutvm
usage.
Displaying open files
To display information about open files, use the
files
command.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use
files <pid>
to display files opened by only one selected process, or usehelp files
for more information aboutfiles
usage.
19.4. Using Kernel Oops Analyzer Copy linkLink copied to clipboard!
The Kernel Oops Analyzer tool analyzes the crash dump by comparing the oops
messages with known issues in the knowledge base.
Prerequisites
-
An
oops
message is secured to feed the Kernel Oops Analyzer.
Procedure
- Access the Kernel Oops Analyzer tool.
To diagnose a kernel crash issue, upload a kernel oops log generated in
vmcore
.-
Alternatively, you can diagnose a kernel crash issue by providing a text message or a
vmcore-dmesg.txt
as an input.
-
Alternatively, you can diagnose a kernel crash issue by providing a text message or a
-
Click
DETECT
to compare theoops
message based on information from themakedumpfile
against known solutions.
19.5. The Kdump Helper tool Copy linkLink copied to clipboard!
The Kdump Helper tool helps to set up the kdump
using the provided information. Kdump Helper generates a configuration script based on your preferences. Initiating and running the script on your server sets up the kdump
service.