非常に奇妙な問題、SSH接続がすぐに切断され、多くの調査が完了しました。

非常に奇妙な問題、SSH接続がすぐに切断され、多くの調査が完了しました。

同じSDカードを使用する3つのRaspberry Piがあり、何らかの理由でSSH認証後に突然接続が切断されました。

問題はすぐには表示されず、再起動すると問題は解決しますが、しばらくすると再表示されます。

パイのうち1つだけで見ることができます。別のコンピュータの別の有効なキーを使用してSSHを接続すると、問題が発生する可能性があります。

だから私は見る:

+----[SHA256]-----+
Last login: Wed Feb 22 12:59:45 2023 from 192.168.7.93
Connection to strawberrypi.lan closed.

私はこのトピックにさまざまな答えを持つ多くの質問があることを知っています。私はたくさん試しました:

/etc/passwd/まあ...いいえ/bin/false

pi:x:1000:1000:,,,:/home/pi:/bin/bash

w問題のボックスの出力は次のとおりです。

 14:24:35 up 15:07,  2 users,  load average: 0.27, 0.19, 0.19
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               Tue23   15:07m 49.48s  0.16s /usr/bin/lxsession -s LXDE-pi -e LXDE
pi       tty1     -                Tue23   15:07m  0.12s  0.10s -bash

GUIが実行中なので大丈夫に見えます。

などを確認しましたが、.bash_rc .profile .bash_profileすべてのパイが同じです。

コマンドを実行して確認できます/var/log/auth.log

私はちょうど次を見る:

Feb 22 14:18:24 strawberrypi sshd[5685]: Accepted publickey for pi from 192.168.7.60 port 50331 ssh2: ED25519 SHA256:...
Feb 22 14:18:24 strawberrypi sshd[5687]: Received disconnect from 192.168.7.60 port 50331:11: disconnected by user
Feb 22 14:18:24 strawberrypi sshd[5687]: Disconnected from user pi 192.168.7.60 port 50331

また/var/log/messages役に立たないようです。

Feb 22 14:16:21 strawberrypi kernel: [53976.371460] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:34:2c:c4:8a:46:69:08:00 SRC=192.168.7.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0xC0 TTL=1 ID=39975 PROTO=2
Feb 22 14:18:26 strawberrypi kernel: [54101.533131] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:34:2c:c4:8a:46:69:08:00 SRC=192.168.7.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0xC0 TTL=1 ID=39979 PROTO=2

私のssh -vvvvショー:

debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Last login: Wed Feb 22 14:17:18 2023 from 192.168.7.60
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 7 efd 8 [write])
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 6 efd 8 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1)

debug3: send packet: type 1
debug3: fd 1 is not O_NONBLOCK
Connection to strawberrypi.lan closed.
Transferred: sent 2696, received 2044 bytes, in 0.0 seconds
Bytes per second: sent 69971.5, received 53049.6
debug1: Exit status -1

SSH設定は、動作しているPiと問題のあるPiの間で同じです。問題は1時間後に再び現れました。

カーネル5.15.52-v7l+バージョンRaspbian GNU/Linux 11 (bullseye)

どんなアイデアがありますか?

出力sshd debug

debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: rexec_argv[2]='-p'
debug1: rexec_argv[3]='10022'
debug1: Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 10022 on 0.0.0.0.
Server listening on 0.0.0.0 port 10022.
debug1: Bind to port 10022 on ::.
Server listening on :: port 10022.

ベストアンサー1

おすすめ記事