
전원 버튼을 눌러 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
자, 이제 우리는 답을 찾기에 충분한 정보를 얻었습니다. 문제는 systemd가 시스템을 종료하는 것을 방지하는 SELinux 정책입니다.
짜잔! 이에 대한 버그가 있습니다: https://bugzilla.redhat.com/show_bug.cgi?id=1224211
기본적으로 댓글 #60 정도에서 그들은 정책 오류가 있음을 알아냅니다. 정기적인 업데이트를 통해 수정되겠지만 'everything dvd'의 패키지만 설치하고 싶었습니다. 따라서 이 문제를 해결하려면 CentOS 직원이 7.2를 출시할 때까지 기다려야 할 것 같습니다!