느린 ssh 로그인-org.freedesktop.login1 활성화 시간이 초과되었습니다 myhost systemd[1]: Started Login Service. Jul 21

내 서버 중 하나에서 SSH 로그인이 실제로 지연되는 것을 알았습니다.

ssh -vvv 옵션을 사용하여 연결하면 지연이 발생합니다. debug1: Entering interactive session.

연결 추출 :

debug1: Authentication succeeded (publickey).
Authenticated to IP_REDACTED ([IP_REDACTED]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1

여기에 설명 된 방법을 사용하여 strace 출력을 생성하고 14:09:53.676004 ppoll([{fd=5, events=POLLIN}], 1, {24, 999645000}, NULL, 8) = 1 ([{fd=5, revents=POLLIN}], left {0, 0}) <25.020764>25 초가 걸리는 라인 을 확인했습니다 .

strace 출력의 추출 :

14:09:53.675567 clock_gettime(CLOCK_MONOTONIC, {4662549, 999741404}) = 0 <0.000024>
14:09:53.675651 recvmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"l\4\1\1\n\0\0\0\2\0\0\0\215\0\0\0\1\1o\0\25\0\0\0", 24}], msg_controll
en=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24 <0.000024>
14:09:53.675744 recvmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"/org/freedesktop/DBus\0\0\0\2\1s\0\24\0\0\0"..., 146}], msg_controllen
=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 146 <0.000025>
14:09:53.675842 recvmsg(5, 0x7ffe0ff1dfa0, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailab
le) <0.000023>
14:09:53.675925 clock_gettime(CLOCK_MONOTONIC, {4662550, 96075}) = 0 <0.000024>
14:09:53.676004 ppoll([{fd=5, events=POLLIN}], 1, {24, 999645000}, NULL, 8) = 1 ([{fd=5, revents=POLLIN}], left {0, 0}) <25.020764>
14:10:18.696865 recvmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"l\3\1\0013\0\0\0\3\0\0\0m\0\0\0\6\1s\0\5\0\0\0", 24}], msg_controllen=0,     msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24 <0.000017>
14:10:18.696944 recvmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{":1.10\0\0\0\4\1s\0#\0\0\0org.freedesktop."..., 155}], msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 155 <0.000018>

관련 시간에 인증 로그에 항목이 나타났습니다.

Jul 21 14:10:18 click sshd[8165]: pam_systemd(sshd:session): Failed to create session: Activation of org.freedesktop.login1 timed out

이것에 대해 충분히 알지 못하면 무엇을 폴링하려고하고 왜이 특정 서버에서 25 초가 걸리는가?

journalctl -u systemd-logind명령을 보여줍니다

Jul 20 11:33:06 click systemd-logind[19415]: Failed to abandon session scope: Transport endpoint is not connected
Jul 21 05:04:54 myhost systemd[1]: Started Login Service.
Jul 21 12:15:30 myhost systemd[1]: Started Login Service.
Jul 21 12:17:04 myhost systemd[1]: Started Login Service.
Jul 21 12:49:55 myhost systemd[1]: Started Login Service.
Jul 21 13:57:05 myhost systemd[1]: Started Login Service.
Jul 21 13:58:49 myhost systemd[1]: Started Login Service.
Jul 21 14:01:55 myhost systemd[1]: Started Login Service.
Jul 21 14:08:32 myhost systemd[1]: Started Login Service.
Jul 21 14:09:53 myhost systemd[1]: Started Login Service.
Jul 21 14:19:08 myhost systemd[1]: Started Login Service.
Jul 21 14:21:26 myhost systemd[1]: Started Login Service.
Jul 21 14:22:37 myhost systemd[1]: Started Login Service.
Jul 21 14:25:20 myhost systemd[1]: Started Login Service.
Jul 21 14:30:27 myhost systemd[1]: Started Login Service.
Jul 21 15:02:56 myhost systemd[1]: Started Login Service.

명령을 실행 systemctl restart systemd-logind.service하면 수정됩니다 (현재로서는).

Activation of org.freedesktop.login1그것이 언급 하는 것은 무엇입니까 ? 나중에 로그인을 다시 시작하지 못하게 할 수있는 방법이 있습니까? 시간이 지남에 따라 내가 관리하는 나머지 서버 에서이 문제가 발생합니다.

다른 서버에서이 작업이 시작되는 것을 보았습니다.

$ sudo service systemd-logind status

● systemd-logind.service - Login Service
   Loaded: loaded (/lib/systemd/system/systemd-logind.service; static)
   Active: active (running) since Tue 2015-06-16 14:10:57 BST; 1 months 12 days ago
     Docs: man:systemd-logind.service(8)
           man:logind.conf(5)
           http://www.freedesktop.org/wiki/Software/systemd/logind
           http://www.freedesktop.org/wiki/Software/systemd/multiseat
 Main PID: 1701 (systemd-logind)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-logind.service
           └─1701 /lib/systemd/systemd-logind

Jul 28 13:16:21 myhost systemd[1]: Started Login Service.
Jul 28 13:16:47 myhost systemd[1]: Started Login Service.
Jul 28 16:09:23 myhost systemd[1]: Started Login Service.
Jul 28 16:09:49 myhost systemd[1]: Started Login Service.
Jul 28 16:10:15 myhost systemd[1]: Started Login Service.
Jul 28 16:10:41 myhost systemd[1]: Started Login Service.
Jul 28 22:50:19 myhost systemd[1]: Started Login Service.
Jul 29 05:00:15 myhost systemd[1]: Started Login Service.
Jul 29 11:00:20 myhost systemd[1]: Started Login Service.
Jul 29 11:09:56 myhost systemd[1]: Started Login Service.

편집-확장 journalctl출력.

EDIT2-다른 서버에서 시작할 때 주석에서 제안한대로 시스템 로그인 상태를 추가했습니다.

업데이트-이것은 나머지 Jessie 서버에서 발생하기 시작합니다. 내가 이것을 경험하는 유일한 사람입니까? systemd-logind를 다시 시작하는 것 외에 다른 수정이 있어야합니다.

770135 에 대한 데비안 버그 보고서가 있습니다.



답변

이는 dbus가 다시 시작되었지만 systemd-logind가 다시 시작되지 않은 경우에 발생합니다. 다음을 수행하십시오.

systemctl restart systemd-logind

해결책은 여기입니다 :
https://major.io/2015/07/27/very-slow-ssh-logins-on-fedora-22/


답변

사용 :

systemctl restart systemd-logind

일시적으로 만 문제를 해결합니다.

한 가지 해결 방법은 여기에.scope 설명 된대로 cron 작업에서 모든 파일 을 제거하는 입니다.

* 2,14 * * * root /bin/rm -f /run/systemd/system/*.scope

관련된 systemd bug report는 다음과 같습니다 : “systemctl list-unit-files”의 속도를 늦추고 로그인을 지연시키는 스코프 유닛의 누출 .

사실에 DBUS의 버그 보인다 : 유닉스 전략 중 기내 깨진 계산 됩니다 DBUS 버전 1.11.10에서 해결

이 버그를 영구적으로 수정하려면이 버전의 dbus가 배포판에 나타날 때까지 기다려야합니다. 현재 데비안 스트레치는 dbus 1.10.18, 우분투 17.04 (Zesty)는 1.10.10, CentOS 7은 dbus 1.6.12입니다.


답변