Feature: _kdump
Description
A feature that installs kdump-tools and makedumpfile to capture a kernel crash dump whenever the kernel panics. The crash dump is stored on disk for post-mortem analysis.
What it does
Installs kdump-tools, makedumpfile, binutils, and jq. Adds crashkernel=512M to the kernel command line so the running kernel reserves 512 MiB of memory for the crash kernel.
The Debian-provided kdump-tools defaults are used without modification. No custom crash kernel or crash initrd are shipped — the running kernel and its initrd are reused as the crash kernel and crash initrd.
_usi / in-place-update images: because the rootfs is an EROFS image embedded in the UKI, the size of the initrd varies with the feature set, making a universal crashkernel= value impractical. Before kdump-tools.service starts, the kdump-tools.service drop-in runs prepare-initrd-kdump to extract the initrd from the UKI and place it where kdump-tools expects it.
Enabling kdump on a running system is not officially supported; see ### How it works for experimental steps.
How it works
Standard crash flow
- The kernel boots with
crashkernel=512Mreserved in physical memory. - On kernel panic,
kexecloads the crash kernel (the same kernel and initrd used for normal boot) into the reserved memory region. - The crash kernel boots into a minimal environment and saves the vmcore dump to
/var/crash/. makedumpfileprocesses the dump to filter out zero pages and reduce its size.
_usi initrd preparation
On _usi images, the standard initrd at /boot/initrd.img-$(uname -r) does not exist because the initrd is embedded in the Unified Kernel Image (UKI). prepare-initrd-kdump handles this before kdump-tools.service activates:
- Reads
GARDENLINUX_FEATURES_FLAGSfrom/etc/os-releaseto detect the_usiflag. - Queries
bootctl list --json=shortfor the path of the currently selected UKI. - Extracts the embedded initrd section using
objcopy --dump-section .initrdand saves it as/var/lib/kdump/initrd.img-$(uname -r).
On non-_usi images, prepare-initrd-kdump creates a symlink from /var/lib/kdump/initrd.img-$(uname -r) to the standard /boot/initrd.img-$(uname -r).
Enabling kdump on a running system (experimental)
- Install
kdump-toolsandmakedumpfile. - Copy the initrd to
/var/lib/kdump/using the nameinitrd.img-$(uname -r). - Add
crashkernel=XXXMto/etc/kernel/cmdlineor a drop-in file in/etc/kernel/cmdline.d/. - Regenerate the bootloader entries.
- Reboot.
Files
Files present in this feature and their purpose. See the feature file reference for the semantics of each file type.
| File | Purpose |
|---|---|
file.include.markers.yaml (ref) | Maps files to test-coverage marker IDs. |
info.yaml (ref) | Declares type: flag; no include/exclude relationships. |
pkg.include (ref) | Installs kdump-tools, makedumpfile, binutils, and jq. |
file.include/etc/kernel/cmdline.d/90-crashkernel.cfg (file.include) | Adds crashkernel=512M to the kernel command line to reserve memory for the crash kernel. |
file.include/etc/systemd/system/kdump-tools.service.d/override.conf (file.include) | Systemd drop-in that runs prepare-initrd-kdump as ExecStartPre before kdump-tools.service activates, ensuring the correct initrd is in place for the crash kernel. |
file.include/usr/local/sbin/prepare-initrd-kdump (file.include) | Prepares the crash initrd: on _usi images, extracts the embedded initrd from the selected UKI via objcopy; on standard images, creates a symlink in /var/lib/kdump/ pointing to /boot/initrd.img-$(uname -r). |
Related features
_kdump has no include or exclude relationships.
Closely pairs with:
_usi— when_usiis active, the crash initrd must be extracted from the UKI before kdump can operate;prepare-initrd-kdumphandles this automatically.