전원 버튼을 통한 정상 종료

전원 버튼을 통한 정상 종료

전원 버튼을 눌러 CentOS 7 시스템을 종료하고 싶습니다. 기본적으로 작동하지 않기 때문에 다음을 시도했습니다.

yum -y install acpid
service acpid start
chkconfig acpid on

불행히도 효과가 없습니다. 아마도 CentOS 6.x에서만 작동하기 때문일 것입니다. 전원 버튼을 눌러 종료 기능을 활성화하는 방법을 아는 사람이 있습니까?

답변1

RHEL 7 및 Centos 7은 System V(SysV) 시작 스크립트 및 실행 수준에서 systemd로 전환되었습니다. 따라서 acpid를 활성화하는 명령은 다음과 같아야 합니다.

systemctl start acpid
systemctl enable acpid

답변2

나에게도 이 문제가 있다.

기본적으로 로그에 표시되는 내용(systemd가 올바르게 구성된 경우 위 중 하나가 작동합니다. 적어도 CentOS7에서는 systemd가 이전 "서비스" 명령을 변환합니다...)

Nov 20 11:12:06 localhost systemd-logind: Power key pressed.
Nov 20 11:12:06 localhost systemd: SELinux policy denies access

따라서 /var/log/audit/audit.log에 계속 액세스해야 하며 다음과 같은 내용이 표시됩니다.

init_t:s0 msg='avc:  denied  { start } for auid=-1 uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:power_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

좋아요, 그러면 시스템 구성 파일이 더 이상 /etc에 없는 이유는 무엇입니까? 어쨌든, 나는 빗나갔다... /usr/lib/systemd/system/poweroff.target이 꺼져 있는 것에 대해 뭔가가 있습니까? : 그런데, 이제 새 자동화 파일이 스스로 혼란스러워지는 방식이 정말 마음에 듭니다... 이제 실제 갈 방향이 없습니다... 이 파일은 완전히 쓸모가 없습니다. 이 옵션은 무엇을 의미합니까? 일부 PFY 관리자에게는 직업 안정이 있을 것으로 추측하고 있으며...나에게는 초과 근무가 더 많을 것으로 예상됩니다. (또 다른 "기능"이어야 합니다!)

#  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=Power-Off
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=systemd-poweroff.service
After=systemd-poweroff.service
AllowIsolate=yes

[Install]
Alias=ctrl-alt-del.target

자, 이제 우리는 실제로 답을 찾기에 충분한 정보를 얻었습니다. 문제는 SELinux 정책이 systemd가 시스템을 종료하는 것을 방지한다는 것입니다.

기다려 보세요! 이에 대한 오류가 있습니다: https://bugzilla.redhat.com/show_bug.cgi?id=1224211

본질적으로 댓글 #60 부근에서 정책 오류가 있음을 발견했습니다. 정기적인 업데이트를 통해 수정될 예정이지만 "everything DVD"의 패키지만 설치하고 싶습니다. 따라서 이 문제를 해결하려면 CentOS 사람들이 7.2를 릴리스할 때까지 기다려야 할 것 같습니다!

관련 정보