Test early kdump by passing custom kernel command line parameter early_panic
Environment
- Red Hat Enterprise Linux 8, 9
kexec-tools
- Configured with
early kdump
- Configured with
Issue
- How to test early kdump?
- How to test early kdump without booting into loop?
- How to test early kdump only by passing custom kernel commandline parameter?
Resolution
-
We can test early kdump by passing custom kernel commandline parameter.
-
This can be achieved by creating a custom service which should get started before
kdump service
and executes a shell script. -
The shell script should check if the mentioned custom kernel commandline parameter is present in command line and then
panic
the system usingSysRq
atearly booting stage
.
Steps to test early kdump
-
Create a custom unit file
sysrq.service
which starts beforekdump.service
and executes a shell script:# touch /etc/systemd/system/sysrq.service # chmod 664 /etc/systemd/system/sysrq.service # cat /etc/systemd/system/sysrq.service [Unit] Description=Custom SysRq Service to test early kdump Before=kdump.service [Service] ExecStart=/usr/local/early-kdump-test.sh Type=simple [Install] WantedBy=default.target
-
The shell script to check kernel commandline "early_panic", if found, it will triggers panic using SysRq:
# cat /usr/local/early-kdump-test.sh #!/bin/bash /usr/bin/grep "early_panic" /proc/cmdline> /dev/null output=$(echo $?) if [ $output -eq "0" ] then echo c > /proc/sysrq-trigger fi # chmod +x /usr/local/early-kdump-test.sh # systemctl daemon-reload # systemctl enable sysrq.service
-
Reboot the system.
-
When the GRUB splash screen is seen, interrupt the booting and follow below step:
a. Press the "e" key to edit the kernel boot entry and at the end of the line "linux" add parameter "early_panic" b. press ctrl+x
-
System will then panic and start capturing vmcore , once the vmcore is captured, system will be rebooted.
-
After the system is rebooted, check dump target for vmcore.
-
Post early kdump is tested successfully, disable the custom service
sysrq.service
# systemctl disable sysrq.service
-
Note Disabling the custom
sysrq.service
may require booting to rescue mode. To do so, boot the system with the kernel parametersystemd.unit=rescue.target
which drops the user to the rescue shell before system services are started. From here, login asroot
and disable the service.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments