Configuring kdump (Kernel Dump Mechanism) in Ubuntu 24.04 (or other similar versions) involves a few key steps.
Kdump is essential for diagnosing kernel crashes by capturing crash dumps for later analysis. Here's how to set it up:
Step 1: Install Necessary Packages
Ensure the kdump tools and other required packages are installed:
sudo apt update
sudo apt install kexec-tools kdump-tools linux-crashdump
Step 2: Enable kdump
Edit the configuration file to enable kdump:
sudo vi /etc/default/kdump-tools
Look for the line USE_KDUMP=0 and change it to: USE_KDUMP=1
Save and exit the file.
Step 3: Configure Memory for kdump
Kdump uses a reserved portion of memory to capture crash dumps. Configure the amount of memory reserved for kdump by adding a kernel boot parameter.
Edit the GRUB configuration:
sudo vi /etc/default/grub
Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and append crashkernel=256M (or another appropriate value depending on your system's RAM):
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash crashkernel=256M"
If your system has more memory, you might use crashkernel=512M or more.Adjust the value based on your server’s usage and resources.
Update GRUB to apply changes:
sudo update-grub
Step 4: Start and Enable kdump Service
Restart the kdump service to apply changes:
sudo systemctl enable kdump-tools
sudo systemctl start kdump-tools
Check its status to confirm it's running:
sudo systemctl status kdump-tools
Step 5: Verify KDUMP Configuration
Check the KDUMP status:
sudo kdump-config show
You should see output indicating that KDUMP is enabled and ready to capture crash dumps.
Step 6: Reboot the System
Reboot your system to apply the changes if above config-show output is not showing dump status
Step 7: Verify KDUMP Configuration after reboot
Check the KDUMP status:
sudo kdump-config show
You should see output indicating that KDUMP is enabled and ready to capture crash dumps.
Step 8: Test the kdump Configuration
To ensure that kdump works properly, trigger a manual kernel crash. (Be cautious with this on a production system.)
Enable sysrq if not already enabled:
echo 1 | sudo tee /proc/sys/kernel/sysrq
Trigger a crash:
echo c | sudo tee /proc/sysrq-trigger
The system should reboot, and the crash dump will be stored.
Step 9: Verify Crash Dumps
By default, crash dumps are stored in /var/crash. Check the directory for crash dump files:
ls -l /var/crash
Post a Comment