
Debian 서버를 종료하거나 다시 시작하는 명령을 보낼 때마다 쉘이 멈추고 응답하지 않습니다(명령을 입력할 수 없음).
Ubuntu에서 동일한 작업을 수행하면 세션이 정상적으로 종료되므로 번들 터미널이 거기에 걸려 있지 않습니다.데비안에서 동일한 동작을 얻으려면 설치해야 하는 패키지나 구성 변경이 있습니까?
답변1
이것은 나에게 효과적입니다.
apt-get install libpam-systemd dbus
UsePAM yes
또한 SSH 구성에 해당 항목이 있는지 확인하십시오 .
grep -i UsePAM /etc/ssh/sshd_config
안타깝게도 솔루션을 적용하려면 재부팅해야 합니다...
상해서버 장애.
답변2
systemd
현재 추적 중인 문제인 것 같습니다.버그 #751636.
호스트가 종료되거나 다시 시작되면 systemd
SSH 세션이 종료되기 전에 네트워크가 종료될 수 있습니다.
여러 가지 솔루션이 제공되었지만 구체적인 내용은 없습니다.
전원 이벤트 처리를 위해
acpid/acpi-support-base
다음을 추가합니다./etc/acpi/powerbtn-acpi-support.sh
else - # Normal handling. - /sbin/shutdown -h -P now "Power button pressed" + + if [ -x /bin/systemctl ] ; then + echo "\nPower button pressed\nThe system is going down for system halt NOW!" |\ + /usr/bin/wall -n + /bin/systemctl --force poweroff + else + # Normal handling. + /sbin/shutdown -h -P now "Power button pressed" + fi + fi
그런 다음 다음에서 별칭을 만듭니다
~/.bashrc
.alias reboot='echo "The system is going down for system reboot NOW!" |\ /usr/bin/wall -n ; /bin/systemctl --force reboot' alias poweroff='echo "The system is going down for system halt NOW!" |\ /usr/bin/wall -n ; /bin/systemctl --force poweroff'
/etc/systemd/system/ssh-user-sessions.service
다음 콘텐츠를 사용하여 만듭니다.[Unit] Description=Shutdown all ssh sessions before network After=network.target [Service] TimeoutStartSec=0 Type=oneshot RemainAfterExit=yes ExecStart=/bin/true ExecStop=/usr/bin/killall sshd