- Documentation
Elastic Compute Service
Elastic Compute Service
Best Practices
Images
Enabling Kdump service in Linux operating system
Images
Enabling Kdump service in Linux operating system
Enabling Kdump service in Linux operating system
You can enable Kdump on an ECS instance running the Linux operating system to quickly identify the cause of a kernel crash within the instance.
In the example provided in this topic, the CentOS 7.9 operating system is used to describe how to install, configure, and enable Kdump.
warning
- Enabling Kdump consumes some operating system memory and disk space, which may affect system performance.
- The methods for enabling Kdump vary across different Linux operating systems. For the specific methods, see the following official documentation:
What is Kdump?
Kdump is a kernel crash dumping technology based on kexec. When the Linux system kernel crashes due to hardware failures, software errors, driver issues, or other reasons that render the system inoperable, Kdump can capture the memory state information of the kernel at the time of the crash and save this information to the disk. Maintenance personnel can analyze and identify the cause of the kernel crash based on the Kdump dump file. Learn more. Procedure
- Execute the following command to install the Kdump tool.
- Specify the size of memory for crash dumps.
- Execute the following command to open the kernel configuration file.
- Press the i key to enter edit mode, and change the value of the crashkernel parameter in GRUB_CMDLINE_LINUX from auto to 128M.
tip
- Replace 128M with the amount of memory you want to reserve for crash dumps (Kdump).
- If the GRUB_CMDLINE_LINUX line does not contain the crashkernel parameter, manually add the parameter.
- Example after modification:
-
- Press the Esc key to exit edit mode, enter :wq, and then press Enter to save the changes and exit the file.
- Execute the following command to update the GRUB configuration file for the configuration to take effect.
- Execute the following command to restart the instance.
- Execute the following command to open the kernel configuration file.
- Press the i key to enter edit mode and modify the following content:
- path /var/crash: Replace /var/crash with the directory where you want to store Kdump files. In the example provided in this topic, the default path is used.
- core_collector makedumpfile -l -message-level 1 -d 31: Add the -c parameter to compress the Kdump file for lower disk usage.
- default reboot: Add this line to specify that the operating system restarts after Kdump is generated.
- Example after modification:
-
- Press the Esc key to exit edit mode, enter :wq, and then press Enter to save the changes and exit the file.
- Execute the following command to run the Kdump tool.
- Execute the following command to specify that the Kdump tool automatically starts upon instance startup.
- Execute the following command to view the Kdump running status.
- Sample output when Kdump runs as expected:
-
- Execute the following commands in sequence to manually trigger a kernel crash, and then verify whether Kdump is available.
- If Kdump is running as expected, the system automatically restarts and generates the content shown in the following figure in the Kdump file storage directory you specified (in this topic, /var/crash).
-
- If Kdump is not running as expected, refer to the previous sections to check whether Kdump is correctly installed and configured.
Subsequent steps
You can use the crash tool to read important contents from Kdump files and analyze the cause of the kernel crash.
- Install the kernel-debug package.
- Execute the following command to view the current kernel version of the operating system.
-
- Go to the official CentOS mirror site and obtain the download links for the two RPM packages, kernel-debuginfo-common and kernel-debuginfo, which match the kernel version of your instance.
-
-
- Download and install the corresponding RPM packages.
- Execute the following command to download the kernel-debuginfo-common package.
tip
Replace the link after the wget command with the actual RPM package download link.
- Execute the following command to install the kernel-debuginfo-common package.
tip
Replace kernel-debuginfo-common-x86_64-3.10.0-1160.102.1.el7.x86_64.rpm with the actual name of the downloaded RPM package.
- Execute the following command to download the kernel-debuginfo package.
tip
Replace the link after the wget command with the actual RPM package download link.
- Execute the following command to install the kernel-debuginfo package.
tip
Replace kernel-debuginfo-3.10.0-1160.102.1.el7.x86_64.rpm with the actual name of the downloaded RPM package.
- Execute the following command to view the crash version and check whether crash is installed.
-
- Use crash to view Kdump information.
- Execute the following command to enter the crash command line page and view Kdump file information.
tip
Replace <timestamp> with the timestamp when the Kdump file is generated.
-
- The crash tool provides various commands to help you quickly extract key information from the Kdump file. Learn more.
-
- To exit crash interactive mode and stop crash, enter exit or q, and then press the Enter key to confirm.
-
Last updated: 2026.06.18 17:49:52