linux的kdump配置

https://www.cnblogs.com/gaoyuechen/p/8595183.html

https://www.cnblogs.com/poiqwe/archive/2012/12/19/2824731.html

https://blog.csdn.net/weixin_35910783/article/details/116609447

[root@scaqan03dv0101 crashfiles]# echo “c”>/proc/sysrq-trigger

kdump的配置文件
/etc/kdump.conf
修改该配置文件之后需要重启kdump service
systemctl restart kdump.service
查看kdump service是否正常
[root@scaqan03dv0201 crashfiles]# systemctl status kdump.service
● kdump.service - Crash recovery kernel armingLoaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled)Active: active (exited) since Fri 2022-01-28 21:54:15 CST; 1min 8s agoProcess: 53221 ExecStop=/usr/bin/kdumpctl stop (code=exited, status=0/SUCCESS)Process: 53271 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS)Main PID: 53271 (code=exited, status=0/SUCCESS)Jan 28 21:53:46 scaqan03dv0201 systemd[1]: Starting Crash recovery kernel arming...
Jan 28 21:53:46 scaqan03dv0201 kdumpctl[53271]: Detected change(s) in the following file(s):
Jan 28 21:53:46 scaqan03dv0201 kdumpctl[53271]: /etc/kdump.conf
Jan 28 21:53:46 scaqan03dv0201 kdumpctl[53271]: Rebuilding /boot/initramfs-4.14.35-2047.508.3.3.el7uek.x86_64kdump.img
Jan 28 21:54:15 scaqan03dv0201 kdumpctl[53271]: kexec: loaded kdump kernel
Jan 28 21:54:15 scaqan03dv0201 kdumpctl[53271]: Starting kdump: [OK]<=== 这里表示kdump是处于正常状态
Jan 28 21:54:15 scaqan03dv0201 systemd[1]: Started Crash recovery kernel arming.测试kdump是否正常工作[root@scaqan03dv0101 crashfiles]#  echo "c">/proc/sysrq-triggerecho "c" >> /proc/sysrq-trigger
echo c>>/proc/sysrq-trigger我发现追加模式echo "c" >> /proc/sysrq-trigger   会重启机器,但是有时候不会生成coredump

crash命令是用来对kdump产生的vmcore进行分析的命令
如果没有的需要安装,可以通过yum或者从网上找一个rpm包来安装

[root@scaqan03dv0201 ~]# rpm -ivh ./crash-7.2.3-11.el7.x86_64.rpm
warning: ./crash-7.2.3-11.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:crash-7.2.3-11.el7               ################################# [100%]

需要安装另外两个kernel debug rpm来对kdump生成的vmcore进行分析

根据你自己的kernel版本来选择下载

[root@scaqan03dv0201 bin]# uname -a
Linux scaqan03dv0201 4.14.35-2047.508.3.3.el7uek.x86_64 #2 SMP Wed Nov 10 13:27:37 PST 2021 x86_64 x86_64 x86_64 GNU/Linux[root@scaqan03dv0201 ~]# rpm -ivh kernel-uek-debuginfo-4.14.35-2047.508.3.3.el7uek.x86_64.rpm kernel-uek-debuginfo-common-4.14.35-2047.508.3.3.el7uek.x86_64.rpm

进入到包含vmcore文件的目录,对这个vmcore进行分析

[root@scaqan03dv0201 127.0.0.1-2022-01-29-10:27:21]# ls
vmcore  vmcore-dmesg.txt
[root@scaqan03dv0201 127.0.0.1-2022-01-29-10:27:21]# crash /usr/lib/debug/lib/modules/4.14.35-2047.508.3.3.el7uek.x86_64/vmlinux vmcore

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注