mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-03-23 14:31:57 +01:00
makedumpfile is used to take crash dumps with kexec on panic The actual "load a backup kernel and take the dump" logic isn't that complicated, but unfortunately each distro seems to roll their own: https://github.com/rhkdump/kdump-utils https://tracker.debian.org/pkg/kdump-tools So I just whipped up a minimal example for people to customize instead of doing something proper and checked it dumps in a VM and on a real board after setting up /etc/conf.d/kdump + crashkernel boot param: ``` # vi /etc/conf.d/kdump (set kernel etc) # vi /etc/update-extlinux.conf (add crashkernel= param, set custom kernel as default) # update-extlinux # reboot ... * Loading crash kernel ... [ ok ] ... # echo c > /proc/sysrq-trigger [ 17.876403] sysrq: Trigger a crash ... * Dumping kernel /var/crash/2024-07-17-17:24:15 ... Copying data : [100.0 %] - eta: 0s The dumpfile is saved to /var/crash/2024-07-17-17:24:15/dump. makedumpfile Completed. The dmesg log is saved to /var/crash/2024-07-17-17:24:15/dmesg. makedumpfile Completed. * Dump done, rebooting ... # ls -lh /var/crash/2024-07-17-17:24:15/ total 35M -rw------- 1 root root 32.1K Jul 17 17:24 dmesg -rw------- 1 root root 34.6M Jul 17 17:24 dump ```
27 lines
1.1 KiB
Bash
27 lines
1.1 KiB
Bash
# Configuration for /etc/init.d/kdump
|
|
|
|
# Mandatory configuration to load a kernel that will boot when panic occurs.
|
|
# There are two prerequisites:
|
|
# - The kernel must have been configured with CONFIG_CRASH_DUMP and
|
|
# CONFIG_PROC_KCORE
|
|
# - The current kernel commandline must include something like 'crashkernel=192M'.
|
|
# The size can be made dynamic based on the system memory, such as:
|
|
# crashkernel=512M-2G:192M,2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G
|
|
# and checked with dmesg:
|
|
# [ 0.000498] crashkernel reserved: 0x0000000033000000 - 0x000000003f000000 (192 MB)
|
|
# Then something like this should work:
|
|
#kexec_args="--initrd=/boot/initramfs-cust /boot/vmlinuz-cust"
|
|
|
|
# Extra arguments to increase reboot stability
|
|
#cmdline_append="reset_devices nr_cpus=1 irqpoll nousb"
|
|
|
|
# Arguments to makedumpfile when dumping kernel
|
|
# default settings below compress with zstd and exclude most unused pages,
|
|
# refer to makedumpfile --help for tuning
|
|
#makedumpfile_args="-z -d 31"
|
|
|
|
# Directory where crash dumps are saved.
|
|
# If not a local directory, service dependencies might need to
|
|
# be updated.
|
|
#kdump_dir=/var/crash
|