Knowledgebase

How To Install and Configure Kdump to Obtain Vmcore

Kdump is a reliable tool used in Linux to capture kernel crash dumps (vmcores) when the system encounters a kernel panic. Here's a step-by-step guide to install and configure Kdump on a CentOS-based system:

Step 1: Install Kdump

  1. Update the package repository:

    bash

 

  • sudo yum update
  • Install the Kdump package:

    bash

 

  1. sudo yum install kexec-tools crash

Step 2: Configure Kdump

  1. Open the Kdump configuration file in a text editor:

    bash

 

  • sudo nano /etc/kdump.conf
  • Configure the destination for the vmcore. By default, Kdump saves the dump in /var/crash. You can adjust this location if needed.

    Example:

    bash

 

  1. path /var/crash
  2. Save and close the file.

Step 3: Configure Grub

  1. Open the Grub configuration file:

    bash

 

  • sudo nano /etc/default/grub
  • Add or modify the crashkernel option. This determines how much memory to reserve for Kdump. Set an appropriate value based on your system's requirements.

    Example:

    makefile

 

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet crashkernel=256M"

Make sure to regenerate the Grub configuration file:

bash
  1. sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Step 4: Enable and Start Kdump Service

  1. Enable the Kdump service:

    bash

 

  • sudo systemctl enable kdump
  • Start the Kdump service:

    bash
  • sudo systemctl start kdump
  • Verify that the Kdump service is running:

    bash

 

  1. sudo systemctl status kdump

Step 5: Test Kdump

  1. Trigger a Kernel Panic:

    You can do this by running:

    bash
  1. sudo echo c > /proc/sysrq-trigger

    This simulates a kernel panic.

  2. Check for Vmcore:

    After the system reboots, check if a vmcore file has been generated in the specified path (e.g., /var/crash).

Additional Tips:

  • Monitor Disk Space: Make sure you have enough free space in the directory where Kdump saves the vmcores.

  • Adjust Memory Allocation: Depending on your system, you may need to adjust the crashkernel value in the Grub configuration.

  • Debugging with Crash Tool: You can use the crash tool to analyze the vmcore. Install it  sudo yum install crash and then run crash /usr/lib/debug/usr/lib/modules/$(uname -r)/vmlinux /var/crash/... it to analyze a specific vmcore.

Remember to back up your data and configuration files before making significant changes to your system. If you encounter any issues, consult your system's documentation or seek help from a professional or community forum.

 
  • 0 Users Found This Useful
Was this answer helpful?