This bloody error makes my headache going bigger and bigger everyday. I never met a same situation like this time.

Well, after I authenticated into SSH successfully, doing few stuffs then my SSH connection being dropped suddenly!!?

Here is my error message: packet_write_wait: Connection to XXX.XX.XX.XXX: Broken pipe

I wished my error message look like this: Write Failed: broken pipe a lot, believe me!

I tried a tons of resolution on the Internet like added ServerAliveInterval, ServerAliveCountMax, ClientAlive....

Someone said: Turn your TCPKeepAlive to no, added ServerAlive bllah blah idiot. I did that also but still same error.

There is no luck for me until this moment.

Any help will be appreciate.

  • 1
    If you are in a corporate environment, check with your firewall admins and see if they were updating rules and/or restarting the firewall after some sort of a change when this happens. If it is happening to a personal server of yours, you need to provide more information on what were you doing on the sshd server side, when this happened. Broken pipe generally means there was a network disconnect for some reason. – MelBurslan Feb 2 '16 at 6:20
  • I just moved and this is happening constantly with my new connection. Cox Cable is my ISP, and I've got a Netgear C6300BD cable modem running on default settings from the install. This used to happen at my old location and I could never resolve it. It lasted for months and eventually stopped happening. I forgot how miserable and unsolvable it was until today. – T. Brian Jones Apr 19 '16 at 22:15
  • I feel your pain. I came here as a last resort before I'm going to slap all my hardware into tiny little pieces. Isn't this supposed to be a fairly simple protocol? – DerpyNerd May 30 '17 at 11:11
up vote 3 down vote accepted

Dear 2018 and later readers,

Let me show you a comment from MelBurslan,

If you are in a corporate environment, check with your firewall admins and see if they were updating rules and/or restarting the firewall after some sort of a change when this happens. If it is happening to a personal server of yours, you need to provide more information on what were you doing on the sshd server side, when this happened. Broken pipe generally means there was a network disconnect for some reason.

So basically, if you are trying to use ssh username@0.0.0.0 over a VPN (corporate environment). Then this error must be there with you over and over.

The only solution I found so far is mobile-shell. Thanks who created it.

You will need to install mosh-server in your target (the server you want to ssh'ed to) and mosh-client in your host machine.

It will auto reconnect when your packets lost, that's pretty cool and suit all our needs, I think.

Happy ssh'ing!

First, make sure your issue is not related to this one.

If not and the problem is still present, read on.

I experienced this problem as well and spent a few days tried to bissect it.

Like specified, playing with SSH KeepAlive parameters or kernel TCP parameters (TCPKeepAlive on/off) does not solve the problem.

After playing with usb to ethernet drivers and TCP dump, I realized the issue was due to the kernel 4.8. I switched the source (sending side) to 4.4 LTS and the problem disappeared (rsync, scp were working nicely again). The destination side can remain on 4.8 if you want, in my use case this was working (tested).

On the technical side, we can narrow a little bit the issue thanks to the wireshark dump below I made. We can see the TCP channel of the SSHv2 protocol is being reset (RST flag of TCP set to 1) causing the connection to abort. I don't know the cause of the RST yet. I need to make some bisection from 4.8.1 to 4.8.11 for that. enter image description here

I'm not saying your problem is specifically due to the kernel 4.8, but wrt. the date you posted your question/message, you may have been using a kernel version which was actually buggy.

Answered initially on StackOverflow.

  • Kernel is not the problem, because I was using 4.4 LTS all the time. The real problem here was answered by @MelBursan in question's comment. My internet connection using VPN, that is why. Solution: mosh.org – Toan Nguyen Dec 9 '16 at 4:14
  • @ToanNguyen Ok. That way, could you please put his/her comment as answer to your question and mark it as fixed? :-) If you have found the technical reasons why you needed mosh, please add them too :-). On my side, I have VPN connections as well and these were working flawlessly without mosh. – wget Dec 9 '16 at 10:12
  • I'm getting back on this. The problem was not due to a buggy kernel, but to a buggy driver, especially the part dedicated to the hardware checksum offload. See this thread for more info. – wget Jun 2 '17 at 14:38
  • Does it solve your problem? – Toan Nguyen Jun 3 '17 at 3:24
  • @ToanNguyen Actually last time I had this issue I simply downgraded the kernel and it was working again. Now, I simply disabled the hw checksum offload, without downgrading anything and it solved the issue, yes. – wget Jun 4 '17 at 14:42

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.