使用 ansible 檔案傳輸失敗後 SSH 卡住

使用 ansible 檔案傳輸失敗後 SSH 卡住

我的 ssh 用戶端出現問題,在透過 Ansible 傳輸檔案失敗後,該用戶端卡在整個系統中。我認為這個問題與 Ansible 本身無關,因為它會影響整個系統。

運行 ansible playbook 後出現問題,其中copy的模組因未知原因而失敗。

之後,任何主機上都會出現 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小時後,問題消失,但如果檔案複製失敗,問題又出現

相關內容