raspberrypi / bookworm-feedback

13 stars 1 forks source link

client_loop: send disconnect: Connection reset after a few minutes over ssh on fresh OS #197

Open Olaf2K opened 9 months ago

Olaf2K commented 9 months ago

Describe the bug SSH into Raspberry Pi 4 or 5 causes client_loop: send disconnect: Connection reset error after about 120-140 seconds on Bookworm 32 and 64 BIT 2023-12-05.

To Reproduce I flash a new OS via RaspberryPI imager 1.8.1 and 1.8.4, Bookworm 32 and 64 BIT 2023-12-05, for either Raspberry Pi 4 or 5 both 8GB. I connect the Pi to my PC via ethernet cable. I SSH into Pi via: ssh piname.local, on either powershell or WSL2.

After about 120-140 seconds the connection drops and I get a: client_loop: send disconnect: Connection reset error

Expected behaviour No Error expected.

Desktop:

The name of the OS you are trying to write Bookworm 32 and 64 BIT 2023-12-05 Are you using OS Customisation? Yes: I set the hostname, set username and password, locale settings and enable ssh in raspberry pi imager

Olaf2K commented 9 months ago

Did some more testing, and the same error does not occur when I use Bullseye - 2023-12-05 release on the same PI4 using the same ethernet cables etc.

Olaf2K commented 9 months ago

Final investigation: adding '-o IPQoS=0' to the ssh command fixes the issue for the PI5, this may help narrow down where the issues lies

Edit: does not fix, but extends the time before error occurred significantly (600 seconds)

lurch commented 9 months ago

I connect the Pi to my PC via ethernet cable.

Are they directly connected via a single ethernet cable, or are they e.g. both plugged into separate ethernet ports on the back of your router?

Olaf2K commented 9 months ago

I connect the Pi to my PC via ethernet cable.

Are they directly connected via a single ethernet cable, or are they e.g. both plugged into separate ethernet ports on the back of your router?

All above-mentioned testing is directly to my PC (so PI ethernet port - PC ethernet port, no router in between), but I have tried yesterday via a network switch and it had the same issue.

Olaf2K commented 9 months ago

I have now also verified that the same issue persists when I am SSHing to the PI from a completely different PC.

luckyluca commented 9 months ago

same here on pi5 and latest bookworm. I'm accessing ssh from my Windows11 laptop. Please note, out of two terminals, only one, the one with a script running printing temperatures disconnects. The other idle terminal doesn't disconnect.

HuckToohey commented 6 months ago

This behavior is persistent for me on pi4B, latest bookworm, eth & wifi, using new Windows Terminal v1.19.10128.0 x64 as admin on Windows 11 Pro. I've tried suggestions of adding either 'IPQoS 0x00' or 'IPQoS cs0 cs0' to /etc/sshd_config both directly and by means of a subordinate "qos.conf" with include *.conf in sshd_config. Someone else suggested tweaking Windows' MTU size but weren't specific. Official guidance on how to resolve the pervasive issue would be super.

UladShumeika commented 5 months ago

Is there already a solution? I have the same problem on my PI4b, but I noticed that when I set up a virtual environment to run python scripts, being in the virtual environment, the flight is normal

Olaf2K commented 4 months ago

Is there already a solution? I have the same problem on my PI4b, but I noticed that when I set up a virtual environment to run python scripts, being in the virtual environment, the flight is normal

I have currently fixed the issue by letting a dhcp server (dnsmasq) assign an IP to the pi, then ssh into the pi using that IP. That may be the clue how to fix it, it may be worth exploring if manually setting a static IP fixes the issue if you have time.

edit: if interested I asked the same question here: https://forums.raspberrypi.com/viewtopic.php?p=2185132#p2185132