原因分析
以下和日志相关的服务不正常或者意外关闭
systemd-journald.service
rsyslog.service
解决方法
确保以下服务正常运行
# systemctl status systemd-journald.service、
# systemctl status rsyslog.service
以下和日志相关的服务不正常或者意外关闭
systemd-journald.service
rsyslog.service
确保以下服务正常运行
# systemctl status systemd-journald.service、
# systemctl status rsyslog.service
/etc/systemd/system/
[Unit]
Description=<service name>
Before=<another1.service> <another2.service> <another3.service>......
After=<another1.service> <another2.service> <another3.service>......
Requires=<another1.service> <another2.service> <another3.service>......
[Service]
Type=<type name>
ExecStart=<script>
[Install]
WantedBy=<action1>.target
WantedBy=<action2>.target
WantedBy=<action3>.target
......
(
补充:
1) Description= 服务的名称
2) Before= 必须在什么服务启动之前启动此服务
3) After= 必须在什么服务启动之后启动此服务
4) Requires= 启动此服务必须要求什么服务
5) Type= 启动此服务的方式,可以是 oneshot 或者 forking
6) ExecStart= 要执行的脚本
7) WantedBy= 在系统执行什么动作时启动此服务,可以是 default.target、poweroff.target、reboot.target 或者 halt.target
)
# chage -l mingyuzhu
configuration error - unknown item 'USERADD_CMD' (notify administrator)
configuration error - unknown item 'USERDEL_PRECMD' (notify administrator)
configuration error - unknown item 'USERDEL_POSTCMD' (notify administrator)
configuration error - unknown item 'CHARACTER_CLASS' (notify administrator)
......
# cat /var/log/messages
......
......chage[31546]: shadow: unknown configuration item 'USERADD_CMD' in '/etc/login.defs'
......chage[31546]: shadow: unknown configuration item 'USERDEL_PRECMD' in '/etc/login.defs'
......chage[31546]: shadow: unknown configuration item 'USERDEL_POSTCMD' in '/etc/login.defs'
......chage[31546]: shadow: unknown configuration item 'CHARACTER_CLASS' in '/etc/login.defs'
......
在 /etc/login.defs 文件中有不被系统支持的参数
SLES 15.7 及以上的版本不再支持以下参数:
USERADD_CMD
USERDEL_PRECMD
USERDEL_POSTCMD
CHARACTER_CLASS
将所有和报错相关的参数注释掉,例如
# vi /etc/login.defs
注释掉以下内容:
......
#USERADD_CMD /usr/sbin/useradd.local
......
#USERDEL_PRECMD /usr/sbin/userdel-pre.local
......
#USERDEL_POSTCMD /usr/sbin/userdel-post.local
......
#CHARACTER_CLASS ......
......
Problem: module php:7.2:820181215112050:76554e01.x86_64 from rhel-8-for-x86_64-appstream-rpms requires module(nginx:1.14), but none of the providers can be installed
- module nginx:1.14:820181214004940:9edba152.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.24) provided by nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms
- module nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.14) provided by nginx:1.14:820181214004940:9edba152.x86_64 from rhel-8-for-x86_64-appstream-rpms
- module nginx:1.14:8000020190830002848:f8e95b4e.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.24) provided by nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms
- module nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.14) provided by nginx:1.14:8000020190830002848:f8e95b4e.x86_64 from rhel-8-for-x86_64-appstream-rpms
- conflicting requests
Dependencies resolved.
# dnf module disable php
# dnf module reset php && dnf module enable php:7.2
(补充:这里以设置 php:7.2 模块为例)
# rpm -qa | grep kdump || zypper install kdump
(注意:此方法只有 openSUSE & SLES 可以使用)
# kdumptool calibrate
config option KDUMP_COPY_KERNEL is deprecated, ignoring
Total: 1023
Low: 0
High: 342
MinLow: 0
MaxLow: 325
MinHigh: 0
MaxHigh: 325
(补充:这里的 Low 值为 0,High 值为 342)
(注意:这里数字的单位是兆 “M”)
# cat /proc/scsi/scsi | grep Lun | wc -l
2
(补充:这里显示的多路径设备数是 2)
(注意:这里需要排除掉多路径的设备,因为系统会忽略这些设备)
1) 当 kdumptool calibrate 命令执行的结果中 Low 值小于或等于 72M 时,Low 值应该设置为 72M
2) 当 kdumptool calibrate 命令执行的结果中 Low 值大于 72M 时,Low 应该设置为和kdumptool calibrate 命令执行的结果中的 Low 值一样
例如步骤 2.1.1 中的 Low 值为 0,所以这里的 Low 内存值为 72M
(补充:Low 值表示 DMA 32 区域中的内存预留值,是仅支持 32 位设备所需要的内存量,即 4GB 以内的全部内存。其值的设置应该注意以下两点)
(注意:在没有任何仅支持 32 为设备的情况下,为 Low 指指定 72M 的默认分配大小可确保一切正常,但 NUMA 系统似乎需要更多的 Low 内存。所以建议使用 numa=off 引导 Kdump 内核以去报常规内核分配不使用 Low 内存)
SIZE_HIGH = RECOMMENDATION + (LUNs / 2)
例如步骤 2.1.1 中的 High 值为 342,步骤 2.1.2 中获取到的数字是 2,所以这里的 High 内存值为 343
根据步骤 2.1.3.1 和步骤 2.1.3.2 可计算出这次需要给 KDUMP 预留的内存大小如下:
crashkernel=343M,high crashkernel=72M,low
# vim /etc/default/grub
在这一行里:
.....
GRUB_CMDLINE_LINUX_DEFAULT="......"
.....
确保有:
.....
GRUB_CMDLINE_LINUX="crashkernel=343M,high crashkernel=72M,low......"
.....
并确保此文件其他地方没有和 crashkernel= 相关的参数
(补充:这里的 crashkernel=343M,high crashkernel=72M,low 是由步骤 2.1 计算得到的)
# grub2-mkconfig -o /boot/grub2/grub.cfg
# reboot
# systemctl enable kdump.service ; systemctl restart kdump.service
# echo c > /proc/sysrq-trigger
# last | grep crash
# ls /var/crash
(注意:如果 Kdump 没有生成的话,可以适当增加 crashkernel=,high 的值,之后再执行相印的步骤,之后再测试)
https://documentation.suse.com/sles/15-SP7/html/SLES-all/cha-tuning-kexec.html#sec-tuning-kexec-crashkernel
https://documentation.suse.com/zh-cn/sles/15-SP7/html/SLES-all/cha-tuning-kexec.html#sec-tuning-kexec-crashkernel