单选题
工程师小张在RHEL 9上执行systemctl enable httpd后重启服务器,发现httpd未随系统启动。检查发现该服务处于masked状态。他应先执行哪个命令解除屏蔽?
A. systemctl stop httpd
B. systemctl disable httpd
C. systemctl reset-failed httpd
D. systemctl unmask httpd
正确答案:D
依据 systemctl(1) 手册,masked 状态通过符号链接到 /dev/null 阻止服务启动,必须使用 systemctl unmask 解除屏蔽后才能 enable;disable 仅移除开机自启链接,stop 停止运行,reset-failed 清除失败计数,均无法解除 mask。
单选题
运维小李在RHEL 9服务器上用systemctl enable httpd设置开机自启,重启后服务未运行。排查发现服务单元被mask。按 systemctl(1) 文档,解除mask应执行哪条命令?
A. systemctl disable httpd
B. systemctl stop httpd
C. systemctl reset-failed httpd
D. systemctl unmask httpd
正确答案:D
依据 systemctl(1) 手册页,mask 会将服务链接到 /dev/null 阻止启动,必须使用 systemctl unmask 解除屏蔽;disable 仅取消开机自启,stop 停止运行,reset-failed 清理失败计数,均无法解除 mask。