用git拉取代码莫明其妙出现packet_write_wait: Connection to 35.231.145.151 port 22: Broken pipe错误
操作系统为manjaro 18.0 ,桌面为平铺窗口管理器 i3wm。
当时打算从gitlab上拉取一个爬虫项目。然后出现下面的错误提示
正克隆到 'jdspider'... packet_write_wait: Connection to 35.231.145.151 port 22: Broken pipe fatal: 无法读取远程仓库。 请确认您有正确的访问权限并且仓库存在
按照提示以为是publickey有问题。然后删除了know_hosts文件并且重新创建了几次publickey。问题依旧没有解决。
查看了gitlab的参考文档,发现可以用 -Tv 参数来debug连接过程
连接信息如下
OpenSSH_7.9p1, OpenSSL 1.1.1 11 Sep 2018 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: Applying options for * debug1: Connecting to gitlab.com [35.231.145.151] port 22. debug1: Connection established. debug1: identity file /home/zijieya/.ssh/id_rsa type 0 debug1: identity file /home/zijieya/.ssh/id_rsa-cert type -1 debug1: identity file /home/zijieya/.ssh/id_dsa type -1 debug1: identity file /home/zijieya/.ssh/id_dsa-cert type -1 debug1: identity file /home/zijieya/.ssh/id_ecdsa type -1 debug1: identity file /home/zijieya/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/zijieya/.ssh/id_ed25519 type -1 debug1: identity file /home/zijieya/.ssh/id_ed25519-cert type -1 debug1: identity file /home/zijieya/.ssh/id_xmss type -1 debug1: identity file /home/zijieya/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_7.9 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 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 gitlab.com:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw debug1: Host 'gitlab.com' is known and matches the ECDSA host key. debug1: Found key in /home/zijieya/.ssh/known_hosts:1 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey after 134217728 blocks debug1: Will attempt key: /home/zijieya/.ssh/id_rsa RSA SHA256:GjBMc3pVeAeE+ujeq7nrPjsD1ROTV45XTDCed07Nw2I debug1: Will attempt key: /home/zijieya/.ssh/id_dsa debug1: Will attempt key: /home/zijieya/.ssh/id_ecdsa debug1: Will attempt key: /home/zijieya/.ssh/id_ed25519 debug1: Will attempt key: /home/zijieya/.ssh/id_xmss debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/zijieya/.ssh/id_rsa RSA SHA256:GjBMc3pVeAeE+ujeq7nrPjsD1ROTV45XTDCed07Nw2I debug1: Server accepts key: /home/zijieya/.ssh/id_rsa RSA SHA256:GjBMc3pVeAeE+ujeq7nrPjsD1ROTV45XTDCed07Nw2I debug1: Authentication succeeded (publickey). Authenticated to gitlab.com ([35.231.145.151]:22). debug1: channel 0: new [client-session] debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: pledge: network debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0 debug1: Remote: Forced command. debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: PTY allocation disabled. debug1: Remote: Forced command. debug1: Remote: Port forwarding disabled. debug1: Remote: X11 forwarding disabled. debug1: Remote: Agent forwarding disabled. debug1: Remote: PTY allocation disabled. packet_write_wait: Connection to 35.231.145.151 port 22: Broken pipe
可以发现publickey验证成功了。应该是在用ssh传输数据时出错了。
百度了一下,大多数人都认为连接超时断开了。然而连接时间设为很长依旧会出现此问题。
应该在ssh的配置文件中增加
IPQoS lowdelay throughput