How can I enable kernel crash dumps in Debian?
14,478
Solution 1
You may also want to look at Debian's kdump-tools
package to automate some of the necessary boot-time steps.
The steps are roughly,
sudo apt-get install kdump-tools
- Set
USE_KDUMP=1
in/etc/default/kdump-tools
- Add
crashkernel=128M
to the kernel command-line given in bootloader configuration (e.g./etc/default/grub
). It also doesn't hurt to passnmi_watchdog=1
as well to ensure that hard hangs are caught.- Note that 128MB is merely a ballpark figure. It needs to be large enough to accomodate the kernel image and the associated init ramdisk.
- If your initram disk is large, you might be able to shrink it by tweaking
/etc/initramfs-tools/initramfs.conf
- Ensure that your boot loader configuration is updated (e.g.
sudo update-grub
) - Ensure your kernel is built with,
CONFIG_RELOCATABLE=y
CONFIG_KEXEC=y
CONFIG_CRASH_DUMP=y
CONFIG_DEBUG_INFO=y
- Reboot
- Verify that the crash kernel is loaded,
cat /sys/kernel/kexec_crash_loaded
-
Optional: Test that all of this worked,
sudo sync; echo c | sudo tee /proc/sysrq-trigger
- Use the
crash
tool to look at the resulting crash dump
- Find a handle of good whiskey to ease the pain of your future in kernel debugging.
Solution 2
A short answer, but...
Go to your kernel source (E.g. cd /usr/src/linux/
) and configure the options for the next kernel (make menuconfig
). Go to "Processor type and features". Enable "kernel crash dumps". (CONFIG_CRASH_DUMP=y
)
Build new kernel, install.
Then read these for more background information: Linux-Crash-HOWTO.pdf and lkcd utils
Related videos on Youtube
Author by
Anandan
Updated on September 18, 2022Comments
-
Anandan over 1 year
I want to enable kernel crash dumps for my Debian 5.0.7 machine. The kernel version is 2.2.26 amd64.
How can I configure this?
-
Matthew Flaschen about 10 yearsAnd to check if it's already enabled:
grep CONFIG_CRASH /boot/config-$(uname -r)
-
clearlight over 6 yearsUpvote for the whisky reference. (And everything else).
-
Michael Firth over 3 yearsIt looks like manually adding "crashkernel" to the Grub configuration is no longer needed (at least in Debian 10). On doing so, I got a resulting commandline ending "crashkernel=256M quiet crashkernel=384M-:128M" - the second crashkernel parameter was added by something automatically