crash tool.kexec-tools preinstalled and automatically reserve crashkernel based on memory size (for example, the crashkernel=3G-16G:256M,16G-64G:384M,... tiered policy), and the kdump service starts automatically at boot. You can quickly verify this by running cat /sys/kernel/kexec_crash_loaded (an output of 1 indicates readiness). Self-managed data centers or custom image environments may not have kdump configured. Machines without proper kdump configuration will only reboot after a panic without preserving any on-site information, in which case you need to complete the installation and configuration as described in this document. It is recommended that all production environments verify that kdump is enabled during the initialization phase.uname -m to confirm your current architecture.crashkernel=256M is recommended (for memory less than or equal to 16GB) or 256M,high (for memory greater than 16GB). Tencent Cloud CVM public images automatically reserve crashkernel by memory tier by default, so no manual configuration is required.crashkernel=512M,high is recommended because ARM capture kernel initialization requires more memory, and insufficient reservation causes kdump loading to fail.sudo -i.kexec-tools and crash requires access to the system default dnf repositories. Installing kernel-debuginfo requires an additional debuginfo repository because the default repositories do not contain this package. For configuration instructions, see Step 1.crashkernel memory reservation parameter, you must reboot the system for the change to take effect. Plan the reboot window in advance.# Confirm the system architectureuname -m # Expected output: x86_64 or aarch64# Confirm that the current user is rootwhoami # Expected output: root# Confirm the disk space (the partition where the dump directory resides, /var/crash by default)df -h /var/crash # Expected output: available space is no less than 20% of physical memory# Confirm the kernel versionuname -r # Expected output: <kernel-version>, for example, 6.6.79-25.8.tl4.x86_64# Confirm that the dnf source is availablednf repolist # Expected output: lists the configured software repositories
Parameter | Position | Value | Description |
crashkernel | kernel boot parameter | 256M / 256M,high / 128M@64M | Reserve memory for the capture kernel. |
KDUMP_KERNEL | /etc/sysconfig/kdump | Kernel Image Path | Path to the capture kernel vmlinuz |
KDUMP_INITRD | /etc/sysconfig/kdump | initramfs Path | Path to the capture kernel initramfs |
KDUMP_COMMANDLINE_APPEND | /etc/sysconfig/kdump | Kernel Parameter String | Append to the capture kernel boot parameters. |
path | /etc/kdump.conf | Directory Path | Directory for saving dump files |
core_collector | /etc/kdump.conf | makedumpfile Parameters | Policy for filtering and compressing dump files |
Parameter | Description | Dump Size |
-d 0 | No filtering, full dump | 100% |
-d 1 | Exclude zero pages | ~70-80% |
-d 31 | Exclude zero pages + cache pages + user data pages (recommended) | ~10-20% |
-d 31 -c | Exclude zero pages + cache pages + user data pages + compress output | Minimum |
Parameter | Description |
-l | Compress dump files (LZO compression) |
--message-level <n> | Controls the verbosity level of output logs. 1 means only progress information is printed. |
-d <bitmask> | Filter mask that filters unnecessary pages bit by bit: bit0 = zero page, bit1 = cache page, bit2 = user data page, bit3 = free page; 31 = 0b11111 means excluding all the above. |
-c | Compress the filtered data. |
# Install kexec-tools (kdump core) and crash (analysis tool)dnf install kexec-tools crash# Install kernel-debuginfo (required for the crash tool to analyze vmcore and provides vmlinux debug symbols)# Note: kernel-debuginfo is not in the default repository, so add the debuginfo repository first:cat > /etc/yum.repos.d/tl4-debuginfo.repo << 'EOF'[tl4-debuginfo]name=TencentOS Server 4 - Debuginfobaseurl=https://mirrors.tencent.com/tlinux/4.0/BaseOS/x86_64/debug/tree/enabled=1gpgcheck=0EOF# The debuginfo package version must exactly match the running kernel (check with uname -r). If the corresponding version is not yet available in the repository, wait for the repository to be updated.dnf install kernel-debuginfo-$(uname -r)# Verify the kernel-debuginfo installation result: the vmlinux debug symbol file should existls /usr/lib/debug/lib/modules/$(uname -r)/vmlinux# Expected output: /usr/lib/debug/lib/modules/<kernel-version>/vmlinux
# View the current crashkernel configurationcat /proc/cmdline | grep crashkernel# Use grubby to configure crashkernel# x86_64 architecture: 256M is recommended (for memory less than or equal to 16GB) or 256M,high (for memory greater than 16GB)grubby --update-kernel=ALL --args="crashkernel=256M"# aarch64 (ARM) architecture: 512M,high is recommended because the ARM capture kernel requires more memory# grubby --update-kernel=ALL --args="crashkernel=512M,high"# Restart to make the configuration take effectreboot
# Check whether kdump is loadedcat /sys/kernel/kexec_crash_loaded# Expected output: 1 (1 indicates that kdump is loaded, and 0 indicates that it is not loaded)# View the crashkernel reserved information in the kernel logdmesg | grep -i crash# Expected output: contains lines such as "Reserving XXXMB of memory for crashkernel"
vim /etc/sysconfig/kdump to edit the main configuration file. In the following example, <kernel-version> is a placeholder. Replace it with the output of uname -r (for example, 6.6.79-25.8.tl4.x86_64):# Capture kernel image pathKDUMP_KERNEL="/boot/vmlinuz-<kernel-version>"# Capture the kernel initramfs pathKDUMP_INITRD="/boot/initramfs-<kernel-version>kdump.img"# KDUMP_COMMANDLINE_APPEND is used to append custom parameters (avoiding duplication with default parameters)KDUMP_COMMANDLINE_APPEND="panic=1 swiotlb=noforce novmcoredd"
vim /etc/kdump.conf to edit the dump target configuration file:# Local file system dumppath /var/crash# core_collector uses makedumpfile to filter and compress# -l: LZO compression; --message-level 1: print progress only; -d 31: exclude zero pages + cache pages + user data pagescore_collector makedumpfile -l --message-level 1 -d 31# NFS dump (optional)# nfs my.server.com:/export/crash# path /var/crash# core_collector makedumpfile -l --message-level 1 -d 31
# Enable autostart on boot.systemctl enable kdump# Start the kdump service.systemctl start kdump# Check the service status.systemctl status kdump# Expected output: Active: active (exited) with no errors.
# Rebuild the kdump initramfs (run after modifying the configuration or upgrading the kernel).kdumpctl rebuild# Expected output: A message indicating that the rebuild was successful with no errors.# Verify the kdump service status.kdumpctl status# Expected output: kdump is operational.
# Enable sysrq.echo 1 > /proc/sys/kernel/sysrq# Trigger a kernel crash (test environments only).echo c > /proc/sysrq-trigger
/var/crash/ directory.# View the dump file.ls -la /var/crash/# Expected output: A directory named with the IP address and date-time is listed, for example, 127.0.0.1-2026-08-09-14:30.ls /var/crash/127.0.0.1-$(date +%Y-%m-%d-%H:%M)/# Expected output: Contains the vmcore file.# Analyze with the crash tool (requires installing kernel-debuginfo in advance to provide vmlinux)# Replace <dump-dir> with the actual dump directory name and <kernel-version> with the output of uname -r.crash /usr/lib/debug/lib/modules/$(uname -r)/vmlinux /var/crash/<dump-dir>/vmcore
crash> bt # View the crash backtrace.crash> ps # View the process list at the time of the crash.crash> log # View the kernel log (dmesg).crash> sys # View system information.crash> quit # Exit crash.
Operation Steps | Expected Output | Verification Method |
Installing a Software Package | dnf install succeeds without errors. | rpm -q kexec-tools crash kernel-debuginfo lists the installed packages. |
Configuring crashkernel and Restarting. | cat /sys/kernel/kexec_crash_loaded outputs 1. | dmesg | grep crash displays the reserved memory. |
Starting the kdump Service. | Active: active (exited) | systemctl status kdump |
kdumpctl rebuild | rebuild success message | kdumpctl status outputs operational. |
Triggering a panic (Test). | After the system restarts, a vmcore file is generated under /var/crash/. | ls /var/crash/ shows that a dump directory exists. |
Analyzing crash | Enter the crash interactive interface. | After entering the crash interactive interface, you can run commands such as bt, ps, and log normally. |
# 1. Manually rebuild the kdump initramfs.kdumpctl rebuild# 2. Check whether the KDUMP_INITRD path in /etc/sysconfig/kdump is correct.# Replace <kernel-version> with the output of uname -r.grep KDUMP_INITRD /etc/sysconfig/kdump# Expected output: KDUMP_INITRD="/boot/initramfs-<kernel-version>kdump.img"# 3. Verify that the initramfs file exists.ls -la /boot/initramfs-$(uname -r)kdump.img# 4. Restart the service.systemctl restart kdump
crashkernel memory reservation failed or is insufficient, causing the capture kernel to fail to start.# 1. Verify that crashkernel is reserved.cat /proc/cmdline | grep crashkernel# Expected output: contains crashkernel=256M or a similar parameter.# 2. Verify that kdump is loaded.cat /sys/kernel/kexec_crash_loaded# Expected output: 1# 3. Check dmesg to verify whether the reservation is successful.dmesg | grep -i "crashkernel"# Expected output: Reserving XXXMB of memory for crashkernel# 4. If the reservation fails, increase the crashkernel value and then reboot.# x86_64:grubby --update-kernel=ALL --args="crashkernel=256M,high"# aarch64:grubby --update-kernel=ALL --args="crashkernel=512M,high"
/var/crash is located is insufficient to accommodate the vmcore.# 1. Check the current available space.df -h /var/crash# 2. Clean up old dump files. Before doing so, confirm that the old dumps have been analyzed or archived, because vmcore is a non-reproducible fault scene and cannot be recovered after deletion.rm -rf /var/crash/127.0.0.1-*# 3. Increase the makedumpfile filter level to reduce the dump file size.# Edit /etc/kdump.conf and change core_collector to:# core_collector makedumpfile -l --message-level 1 -d 31 -c# 4. Alternatively, change the dump target to a partition with more space or an NFS mount point.
# 1. Update the KDUMP_KERNEL and KDUMP_INITRD paths in /etc/sysconfig/kdump.# Replace <kernel-version> with the new kernel version (the output of uname -r).# KDUMP_KERNEL="/boot/vmlinuz-<kernel-version>"# KDUMP_INITRD="/boot/initramfs-<kernel-version>kdump.img"# 2. Install the kernel-debuginfo package for the new kernel.dnf install kernel-debuginfo-$(uname -r)# 3. Rebuild the kdump initramfs.kdumpctl rebuild# 4. Restart the kdump service.systemctl restart kdump# 5. Verificationkdumpctl status
kernel-debuginfo is not installed or the version does not match.# 1. Install the kernel-debuginfo package that matches the current kernel version.dnf install kernel-debuginfo# 2. Verify that the vmlinux file exists.ls /usr/lib/debug/lib/modules/$(uname -r)/vmlinux# 3. If the versions do not match, install the corresponding version.dnf install kernel-debuginfo-$(uname -r)
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários