Oracle Linux 8: How to Configure Early-kdump Support Feature (文档 ID 2579195.1)

注:本文有一定的危险性(指:OS立即crash掉),请谨慎操作

Oracle Linux 8: How to Configure Early-kdump Support Feature (文档 ID 2579195.1)

APPLIES TO:

Linux OS - Version Oracle Linux 8.0 and later
Linux x86-64

GOAL

 This document will guide to configure the early-kdump feature in oracle linux 8

SOLUTION

Configure kdump service

Refer to the Kdump document 2049919.1 configure kdump and ensure that kdump service in running status.

# systemctl enable --now kdump.service

 

# systemctl status kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2019-08-19 23:42:11 IST; 16h ago
Main PID: 1255 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 26213)
Memory: 0B
CGroup: /system.slice/kdump.service

Aug 19 23:42:09 <HOSTNAME> systemd[1]: Starting Crash recovery kernel arming...
Aug 19 23:42:11 <HOSTNAME> kdumpctl[1255]: Kdump already running: [WARNING]
Aug 19 23:42:11 <HOSTNAME> systemd[1]: Started Crash recovery kernel arming.

List the early-dump modules are available in system

 

# dracut --list-modules | grep earlykdump
earlykdump 

Append the parameter rd.earlykdump to kernelopts line in /boot/grub2/grubenv file

# cat /boot/grub2/grubenv
# GRUB Environment Block
saved_entry=4eb68bf18e86437d9c957ff4863a3288-4.18.0-80.el8.x86_64
kernelopts=root=/dev/mapper/ol-root ro crashkernel=auto resume=/dev/mapper/ol-swap rd.lvm.lv=ol/root rd.lvm.lv=ol/swap rd.earlykdump
boot_success=0
###################################################################################################
###################################################################################################
###################################################################################################

Re-create initramfs to add early-kdump modules

# lsinitrd |grep -i early

 

# dracut -f --add earlykdump

 

# lsinitrd |grep -i early
Arguments: -f --add 'earlykdump'
earlykdump
-rwxr-xr-x 1 root root 1940 Jun 17 10:29 usr/lib/dracut/hooks/cmdline/00-early-kdump.sh 

Reboot the box to load the changes

# Reboot

Once the server back online, check the status of early-kdump

# journalctl -x |grep -i early-kdump
Aug 20 16:08:09 <HOSTNAME> dracut-cmdline[196]: early-kdump is enabled.
Aug 20 16:08:10 <HOSTNAME> dracut-cmdline[196]: kexec: loaded early-kdump kernel

Test the early-kdump using custom systemd unit files and make the panic using SysRq crash

Create a unit file name /etc/systemd/system/test_early_kdump.service

# touch /etc/systemd/system/test_early_kdump.service

 Provide appropriate permissions

# chmod 664 /etc/systemd/system/test_early_kdump.service

 The unit file should look as below:

# cat /etc/systemd/system/test_early_kdump.service
[Unit]
Description=test_early_kdump Service
Before=kdump.service

[Service]
ExecStart=/usr/local/test_early_kdump.sh
Type=simple

[Install]
WantedBy=default.target

 Then create another script /usr/local/test_early_kdump.sh file to pass the sysrq crash command

# cat /usr/local/test_early_kdump.sh
#!/bin/bash
/usr/bin/echo c > /proc/sysrq-trigger

Provide executable permission for the script 

# chmod +x /usr/local/test_early_kdump.sh

 Reload the systemd daemon  

# systemctl daemon-reload

 

IMPORTANT: Do not start the test_early_kdump.service (test crash) service otherwise, the system will crash immediately.

Enable this test_early_kdump service at the boot level

# systemctl enable test_early_kdump.service

Reboot the system

# reboot

 

While system booting as per the custom test script, it will trigger a crash and keep rebooting

Disable the custom unit & script files and remove after tested

Boot the system in rescue mode using 'systemd.unit=rescue.target' using 2153996.1 and disable the service 'test_early_kdump' at boot time

# systemctl disable test_early_kdump.service

Above command disables the custom unit file. Next time system will boot normally.

Remove the custom unit files and crash script file as the TEST crash is completed

# rm /etc/systemd/system/test_edump.service
rm: remove regular file '/etc/systemd/system/test_edump.service'? y 

 

# rm /usr/local/test_early_kdump.sh

Check the /var/crash/ folder as per the kdump.conf (path /var/crash) mentioned for the vmcore

# ls -l /var/crash/127.0.0.1-2019-08-20-17:09:23
total 56648
-rw-------. 1 root root 57959829 Aug 20 17:09 vmcore
-rw-r--r--. 1 root root 41452 Aug 20 17:09 vmcore-dmesg.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值