0

I have a brand new Raspberry Pi 4B running a fresh install of Raspberry Pi OS full. My intent is to use it primarily over ssh. I'm not currently using wifi for this, just an ethernet connection directly from the pi to my laptop (Windows 10 machine) with nothing in between.
I'm able to initiate an ssh connection just fine (using OpenSSH from Windows terminal). However, after I've been connected for several minutes, the pi will disconnect and I get client_loop: send disconnect: Connection reset. This doesn't only happen when connection has been idle; it often happens while I'm running commands. It's typically about 1-4 minutes after I first connect. Once I've been disconnected, I can't connect again until I uplug the ethernet cable and plug it in again. I've verified that the pi is not rebooting when this happens. Here's what I've tried:

  • Several different power supplies for the pi (with plenty of wattage)
  • Reinstalling Pi OS
  • Connecting from a different windows machine
  • Adding TCPKeepAlive yes to /etc/ssh/sshd_config
  • Adding ClientAliveInterval 60 and ClientAliveCountMax 5 to /etc/ssh/sshd_config
  • Adding IPQoS cs0 cs0 to /etc/ssh/sshd_config as suggested by a lot of people, even though none of them seem to have any idea what it means.

Note that I restarted sshd after each edit to the config file.
For anyone interested, here are the ssh logs on triple verbose for a single login. Unfortunately, there are no logs at the time of the disconnection, the logfile skips straight to the time of the next login.

EDIT: After further testing, it looks like the pi ALWAYS disconnects 185 seconds after I connect the ethernet cable, independent of when I log in over ssh. The 185 number is very consistent. So, maybe not an ssh issue? Maybe hardware or firmware?

6
  • 1
    This is not a Pi problem. Why don't you connect the Pi to your router the way it is intended to run.
    – Milliways
    Commented May 2 at 22:20
  • Far from an expert, but do you have a source for your claim that the pi is "intended to" be connected to a router? Personally, I've always found direct computer-to-computer ethernet to be the most reliable way to get an ssh connection. Typically if there are any issues I start by getting it working in this configuration before adding any other variables. Commented May 3 at 1:15
  • Incidentally, in this specific instance, I have spent a fair bit of time trying to get this working using a router as you suggest. So far I haven't been able to connect over ssh or ping the pi at all that way. You may be right that it's not a problem with the pi. If so, do you have any suggestions about what it might be? Commented May 3 at 1:17
  • 1
    If you want help you need to explain what you tried because ssh via router works for everyone else. The default networking on Pi (like most computers) expects a DHCP server.
    – Milliways
    Commented May 3 at 1:47
  • What is the IP address of the Pi? APIPA? If you get logged-out, and log-in again with SSH, is the IP address the same? Commented May 3 at 15:39

1 Answer 1

0

You can have a look to this post:https://unix.stackexchange.com/questions/602518/ssh-connection-client-loop-send-disconnect-broken-pipe-or-connection-reset

Note that the post edits file ~/.ssh/config (This is ssh client config and not server config. Global ssh client config also is in /etc/ssh/ssh_config (not ssh_config, not sshd_config). This helps if you try to initiate connection from the pi itself.

IPQoS CS0 CS0 is something that sets quality of service for hte packet (type of service, i.e. ToS, in IP header). This has nothing to do with your problem. It counts only if there is a congestion in your network. and, btw, I didn't find this IPQoS thing in sshd_config or ssh_config man pages!

I would suggest that you try a different SSH client from your windows (try PuTTY, it is a bit reliable). If it works fine then the problem is probably with your windows OpenSSH client.

Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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