Step One: Make sure supportutils has been installed
# rpm -q supportutils
supportutils-3.1.21-150300.7.35.15.1.noarch
(Add: If there is no output, it means supportutils need be installed)
Step Two: Input supportconfig command
# supportconfig
Step One: Make sure supportutils has been installed
# rpm -q supportutils
supportutils-3.1.21-150300.7.35.15.1.noarch
(Add: If there is no output, it means supportutils need be installed)
Step Two: Input supportconfig command
# supportconfig
# rpm -qa | grep crash || yum install crash ; rpm -qa | grep kernel-debug || yum install kernel-debug
# vim /etc/kdump.conf
修改以下内容:
......
path /var/crash
......
(
补充:
1) 默认的存放位置是 /var/crash
2) 把这里修改成想要存放内核崩溃信息的目录
3) 为了保险起见存放内核崩溃信息的位置最好有大于内存大小的剩余空间
)
# systemctl restart kdump ; systemctl enable kdump
# systemctl status kdump
(补充:当显示输出结果里包含 operational 或者 Active: active (exited) 时,则说明 Kdump 已经启用)
# vim /etc/sysctl.conf
添加以下内容:
......
kernel.hung_task_panic=1
# sysctl -p /etc/sysctl.conf
(步骤略)
(
注意:
1) 只有 task hang 住,或者处理器线程 soft lock 时才会自动产生 dump
2) 此过程系统会自动重启
)
# vim /etc/sysctl.conf
添加以下内容:
......
kernel.sysrq = 1
# sysctl -p /etc/sysctl.conf
同时先后按下以下三个按键:
ALT + PRINTSCREEN + C
(
注意:
1) 此过程会让系统自动重启
2) 只是系统死机并不代表有 kernel panic
)
# vim /etc/sysctl.conf
添加以下内容:
......
kernel.unknown_nmi_panic = 1
kernel.panic_on_unrecovered_nmi = 1
kernel.panic_on_io_nmi = 1
# sysctl -p /etc/sysctl.conf
(步骤略)
# echo c > /proc/sysrq-trigger
(注意:此操作会造成系统重启)
参考文献:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/system_design_guide/installing-and-configuring-kdump_system-design-guide
https://access.redhat.com/solutions/916043
https://access.redhat.com/solutions/3698411
https://access.redhat.com/solutions/6038
https://access.redhat.com/solutions/23069
默认情况下,journal 的日志存储在 /run/log/journal,而 /run 目录只是一个临时目录。
将 Storage 参数设置为 persistent 后,journal 的日志将存储在 /var/log/journal,/var/log 则是一个永久的目录。
# vi /etc/systemd/journald.conf
将部分内容修改如下:
[Journal]
......
Storage=persistent
......
# systemctl restart systemd-journald.service
https://linuxconfig.org/introduction-to-the-systemd-journal
kernel: [829455.595333][ C10] critical target error, dev sda, sector 104056241 op 0x3:(DISCARD) ......
如果是在 VMware 上运行的虚拟机在日志里出现 critical target error 此类报错,尤其是涉及到 DISCARD 操作的错误,通常是由 VMware 进行硬盘垃圾空间回收或者进行硬盘优化造成的。
VMware 的控制平台上,检查宿主机的硬盘是否正常。若不正常则修复或者更换硬盘。
supportconfig 是一个 SLES 系统搜集系统整体情况的命令,我们可以选择搜集哪些信息
# supportconfig -C
# sed -i 's\OPTION_AUDIT=1\OPTION_AUDIT=0\g' /etc/supportconfig.conf
(补充:这里使 supportconfig 命令不搜集 audit 日志为例)