In this article, you will learn how to set up Kdump to generate a vmcore on a Server Hang or Crash.
Kdump is a Linux utility that automatically generates a vmcore (memory dump) file when the server crashes or becomes unresponsive, allowing you to analyse the cause of the issue.
Note: Kdump may not work on XEN PV environments, but we recommend trying it anyway, as it functions reliably on most standard servers.
Follow the steps:
- Install kexec-tools
- Install the required package:
yum install kexec-tools
- Then, edit the kdump configuration file:
vi /etc/kdump.conf
Set the path parameter to a directory with sufficient space to store the crash dump file (default is /var/crash/). The dump size is typically equal to the server’s RAM + 1GB.
- Install the required package:
- Configure GRUB Boot Parameters
- For CloudLinux 6:
Edit /etc/grub.conf, and add the following to the kernel line:crashkernel=160M Alternatively, use: crashkernel=auto
- For CloudLinux 7/8/9:
Edit the GRUB configuration file:vi /etc/default/grub
Modify the GRUB_CMDLINE_LINUX line to include crashkernel=auto. For example:
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"
Then regenerate the GRUB configuration:
grub2-mkconfig -o /boot/grub2/grub.cfg
- For CloudLinux 6:
- Enable Kdump on Boot:
- For CloudLinux 6, run the following commands:
chkconfig --add kdump chkconfig kdump on
- For CloudLinux 6, run the following commands:
- Update sysctl Settings for Panic Handling
Edit /etc/sysctl.conf and add the following to ensure the system captures dumps for various crash scenarios:# Enable reboot and dump collection on panic kernel.sysrq = 1 kernel.hung_task_panic = 1 kernel.panic = 1 kernel.panic_on_io_nmi = 1 kernel.panic_on_oops = 1 kernel.panic_on_stackoverflow = 1 kernel.panic_on_unrecovered_nmi = 1 kernel.softlockup_panic = 1 kernel.unknown_nmi_panic = 1 kernel.hardlockup_panic = 1 Apply the settings: sysctl -p
- Reboot and verify Kdump
- Reboot your server:
reboot
- After reboot, check if kdump is running:
service kdump status
- Reboot your server:
Next Steps:
Once kdump is active, it will generate a vmcore file in the configured path (e.g., /var/crash/) if the server encounters a crash. This file can be analysed using tools like crash to diagnose the issue.
We hope you found this article helpful. If you encounter any issues or need assistance, please don’t hesitate to reach out to our support team at your convenience.
Want to go deeper? Learn How to generate core dump files on Linux