How to Set Up Kdump to Generate a vmcore on Server Hang or Crash

June 10, 2025 / Command Line

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:

  1. Install kexec-tools
    1. Install the required package:
      yum install kexec-tools
    2. 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.

  2. Configure GRUB Boot Parameters
    1. For CloudLinux 6:
      Edit /etc/grub.conf, and add the following to the kernel line:

      crashkernel=160M
      Alternatively, use:
      crashkernel=auto
    2. 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
  3. Enable Kdump on Boot:
    1. For CloudLinux 6, run the following commands:
      chkconfig --add kdump
      chkconfig kdump on
  4. 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
  5. Reboot and verify Kdump
    1. Reboot your server:
      reboot
    2. After reboot, check if kdump is running:
      service kdump status

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

Spread the love