Eu executo algum comando através do ssh: ssh root@remote "SOME_COMMAND", mas o ssh não retorna após o comando ser executado. Apenas fique pendurado lá.
O log ssh do lado do cliente:
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status 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: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: send packet: type 80
debug3: receive packet: type 82
debug3: send packet: type 80
debug3: receive packet: type 82
E o log do sshd:
2024-03-03T03:24:34.988431+00:00 self sshd[26283]: debug2: channel 0: read<=0 rfd 12 len 0
2024-03-03T03:24:34.988518+00:00 self sshd[26283]: debug2: channel 0: read failed
2024-03-03T03:24:34.988559+00:00 self sshd[26283]: debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 12 efd 14 [read])
2024-03-03T03:24:34.988600+00:00 self sshd[26283]: debug2: channel 0: input open -> drain
2024-03-03T03:24:34.988635+00:00 self sshd[26283]: debug2: channel 0: ibuf_empty delayed efd 14/(0)
2024-03-03T03:24:34.988671+00:00 self sshd[26283]: debug2: notify_done: reading
2024-03-03T03:24:34.988706+00:00 self sshd[26283]: debug1: Received SIGCHLD.
2024-03-03T03:24:34.988740+00:00 self sshd[26283]: debug1: session_by_pid: pid 26284
2024-03-03T03:24:34.988775+00:00 self sshd[26283]: debug1: session_exit_message: session 0 channel 0 pid 26284
2024-03-03T03:24:34.988813+00:00 self sshd[26283]: debug2: channel 0: request exit-status confirm 0
2024-03-03T03:24:34.988849+00:00 self sshd[26283]: debug3: send packet: type 98
2024-03-03T03:24:34.988882+00:00 self sshd[26283]: debug1: session_exit_message: release channel 0
2024-03-03T03:24:34.988916+00:00 self sshd[26283]: debug2: channel 0: write failed
2024-03-03T03:24:34.988950+00:00 self sshd[26283]: debug2: channel 0: chan_shutdown_write (i1 o0 sock -1 wfd 11 efd 14 [read])
2024-03-03T03:24:34.988984+00:00 self sshd[26283]: debug2: channel 0: send eow
2024-03-03T03:24:34.989022+00:00 self sshd[26283]: debug3: send packet: type 98
2024-03-03T03:24:34.989055+00:00 self sshd[26283]: debug2: channel 0: output open -> closed
2024-03-03T03:24:34.989089+00:00 self sshd[26283]: debug2: channel 0: ibuf_empty delayed efd 14/(0)
2024-03-03T03:24:34.989123+00:00 self sshd[26283]: debug2: channel 0: ibuf_empty delayed efd 14/(0)
2024-03-03T03:24:38.727125+00:00 self sshd[3758]: debug3: receive packet: type 2
2024-03-03T03:24:38.727213+00:00 self sshd[3758]: debug3: Received SSH2_MSG_IGNORE
2024-03-03T03:25:05.790042+00:00 self sshd[30063]: debug3: receive packet: type 2
2024-03-03T03:25:05.790129+00:00 self sshd[30063]: debug3: Received SSH2_MSG_IGNORE
2024-03-03T03:25:34.218472+00:00 self sshd[26283]: debug3: receive packet: type 80
2024-03-03T03:25:34.218559+00:00 self sshd[26283]: debug1: server_input_global_request: rtype [email protected] want_reply 1
2024-03-03T03:25:34.218607+00:00 self sshd[26283]: debug3: send packet: type 82
O log do servidor “ibuf_empty atrasado efd” parece suspeito. Mas não encontrei nenhuma informação útil na internet.
O comando ssh executado é um script. Acontece que ele contém alguns comandos executados em segundo plano:
Eu os mudei para:
Ao redirecionar STD IO, o travamento foi corrigido. Parece que o ssh se recusa a perder quaisquer dados do/para o trabalho em segundo plano.