使用 ansible 传输文件失败后 SSH 卡住

使用 ansible 传输文件失败后 SSH 卡住

我的 ssh 客户端出现问题,在通过 Ansible 传输文件失败后,整个系统都卡住了。我不认为这个问题与 Ansible 本身有关,因为它影响的是整个系统。

在运行带有copy未知原因失败的模块的 ansible playbook 后出现问题。

此后,任何主机上都会出现 ssh 问题(即使在第一次运行 playbook 时不存在的主机也是如此)。我猜想这个问题发生在客户端,因为它会影响任何 ssh 服务器上的任何连接:

  • 当我以交互方式在主机 ( ssh <host>) 上进行 ssh 时:没问题,它有效
  • 当我 scp ( scp /tmp/a <host>:/tmp/) 时:它卡住了
  • 当我运行剧本时:它卡在Gathering Facts
  • 当我通过 ssh 运行命令时(ssh <host> ls /tmp/):它卡住了

记录如下ssh -v

[thomas] ± ssh -v <host> /bin/ls /tmp/
OpenSSH_8.0p1, OpenSSL 1.1.1c  28 May 2019
debug1: Reading configuration data /***/.ssh/config
debug1: /***/.ssh/config line 34: Applying options for *.<FQDN>
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to <HOST>.<FQDN> [<IP>] port 22.
debug1: Connection established.
debug1: identity file /***/.ssh/<KEY> type 0
debug1: identity file /***/.ssh/<KEY>-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u2
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u2 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to <HOST>.<FQDN>:22 as '<USER>'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:NscFpuBFizN54BtNjWdhpLqmE3O1ngnN2lAxdEPxECs
debug1: Host '<HOST>.<FQDN>' is known and matches the ECDSA host key.
debug1: Found key in /***/.ssh/known_hosts:92
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /***/.ssh/<KEY> RSA SHA256:e1kfTBa1P5SorMk1Pd2DV+e8bIAnIsZosb/fC9I+l48 explicit agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /***/.ssh/<KEY> RSA SHA256:e1kfTBa1P5SorMk1Pd2DV+e8bIAnIsZosb/fC9I+l48 explicit agent
debug1: Server accepts key: /***/.ssh/<KEY> RSA SHA256:e1kfTBa1P5SorMk1Pd2DV+e8bIAnIsZosb/fC9I+l48 explicit agent
debug1: Authentication succeeded (publickey).
Authenticated to <HOST>.<FQDN> ([<IP>]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending command: /bin/ls /tmp/
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 1

我尝试过在我的系统上使用不同的用户:但问题没有解决。这不是与身份验证相关的问题,当我仅使用时,它就可以工作ssh,上面的日志显示身份验证有效。

我发现修复此问题的唯一方法是重新启动系统......

附加信息:

[thomas:~] $ uname -r
5.1.8-arch1-1-ARCH
[thomas:~] $ ssh -V
OpenSSH_8.0p1, OpenSSL 1.1.1c  28 May 2019

编辑:2 小时后,问题消失,但如果文件复制失败,问题就会再次出现

相关内容