在之前的博客中,我们介绍了DM8 中共享磁盘的udev 挂载问题,如下:
麒麟V10 操作系统下 DM8 DMDSC 集群 ASM 共享磁盘挂载 说明
https://www.cndba.cn/cndba/dave/article/116429
我们在配置之后,并没有重启udev,而是采用重新加载的方式:
[dave@www.cndba.cn mapper]# /sbin/udevadm control --reload-rules
[dave@www.cndba.cn mapper]# udevadm trigger --action=add
[dave@www.cndba.cn mapper]# /sbin/udevadm trigger --type=devices --action=change
这里一个主要原因是因为udev 无法重启,重启的命令如下:
[root@dcm2 ~]# systemctl restart systemd-udev-trigger.service
Failed to restart systemd-udev-trigger.service: Operation refused, unit systemd-udev-trigger.service may be requested by dependency only (it is configured to refuse manual start/stop).
See system logs and 'systemctl status systemd-udev-trigger.service' for details.
这里直接重启会提示无法重启, 查看状态是激活状态:
[root@dcm2 ~]# systemctl status systemd-udev-trigger.service
● systemd-udev-trigger.service - udev Coldplug all Devices
Loaded: loaded (/usr/lib/systemd/system/systemd-udev-trigger.service; static; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/systemd-udev-trigger.service.d
└─systemd-udev-trigger-no-reload.conf
Active: active (exited) since Thu 2023-02-09 23:26:51 CST; 22h ago
Docs: man:udev(7)
man:systemd-udevd.service(8)
Process: 632 ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add (code=exited, status=0/SUCCESS)
Process: 640 ExecStart=/usr/bin/udevadm trigger --type=devices --action=add (code=exited, status=0/SUCCESS)
Main PID: 640 (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 0B
CGroup: /system.slice/systemd-udev-trigger.service
Feb 09 23:26:51 dcm3 systemd[1]: Started udev Coldplug all Devices.
[root@dcm2 ~]#
这是服务的默认配置,是一种保护机制。
我们可以查看服务里的配置,linux 的服务都在/usr/lib/systemd/system目录下,我们直接查看udev的服务:
[root@dcm2 ~]# cat /usr/lib/systemd/system/systemd-udev-trigger.service
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=udev Coldplug all Devices
Documentation=man:udev(7) man:systemd-udevd.service(8)
DefaultDependencies=no
Wants=systemd-udevd.service
After=systemd-udevd-kernel.socket systemd-udevd-control.socket
Before=sysinit.target
ConditionPathIsReadWrite=/sys
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add
ExecStart=/usr/bin/udevadm trigger --type=devices --action=add
[root@dcm2 ~]#
服务里并没有RefuseManualStop 选项,所有这里只能通过重启操作系统,或者重新加载配置。
但对于有些服务,虽然也是拒绝重启,但可以手工修改,设置RefuseManualStop=no 参数,然后就可以重启,比如审计服务。
[root@dcm2 ~]# cat /usr/lib/systemd/system/auditd.service
[Unit]
Description=Security Auditing Service
DefaultDependencies=no
## If auditd is sending or recieving remote logging, copy this file to
## /etc/systemd/system/auditd.service and comment out the first After and
## uncomment the second so that network-online.target is part of After.
## then comment the first Before and uncomment the second Before to remove
## sysinit.target from "Before".
After=local-fs.target systemd-tmpfiles-setup.service
##After=network-online.target local-fs.target systemd-tmpfiles-setup.service
Before=sysinit.target shutdown.target
##Before=shutdown.target
Conflicts=shutdown.target
#RefuseManualStop=yes
ConditionKernelCommandLine=!audit=0
Documentation=man:auditd(8) https://github.com/linux-audit/audit-documentation
[Service]
Type=forking
PIDFile=/var/run/auditd.pid
ExecStart=/sbin/auditd
## To not use augenrules, copy this file to /etc/systemd/system/auditd.service
## and comment/delete the next line and uncomment the auditctl line.
## NOTE: augenrules expect any rules to be added to /etc/audit/rules.d/
ExecStartPost=-/sbin/augenrules --load
#ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
# By default we don't clear the rules on exit. To enable this, uncomment
# the next line after copying the file to /etc/systemd/system/auditd.service
#ExecStopPost=/sbin/auditctl -R /etc/audit/audit-stop.rules
### Security Settings ###
MemoryDenyWriteExecute=true
LockPersonality=true
ProtectControlGroups=true
ProtectKernelModules=true
Restart=on-failure
[Install]
WantedBy=multi-user.target
[root@dcm2 ~]#
版权声明:本文为博主原创文章,未经博主允许不得转载。