1

Just copied over a fresh image of raspbian buster lite with an additional ssh file in the boot partition.

When trying ssh though I'm running into troubles:

ssh raspberrypi
The authenticity of host 'raspberrypi (***)' can't be established.
ECDSA key fingerprint is SHA256:Tbh4r0cgCBP2L7Gtu93Q+ql90rwSwQZXw//gER/w+Qw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'raspberrypi,***' (ECDSA) to the list of known hosts.
daniel@raspberrypi's password: 

 ~  ssh pi@raspberrypi
pi@raspberrypi's password: 
Connection to raspberrypi closed by remote host.
Connection to raspberrypi closed.
 ~  ssh pi@raspberrypi
kex_exchange_identification: read: Connection reset by peer

Verbose mode is not much more helpful either:

OpenSSH_8.2p1, OpenSSL 1.1.1g  21 Apr 2020
debug1: Reading configuration data /home/daniel/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "raspberrypi" port 22
debug2: ssh_connect_direct
debug1: Connecting to raspberrypi [fd0e:94f0:31df::abd] port 22.
debug1: Connection established.
debug1: identity file /home/daniel/.ssh/id_rsa type 0
debug1: identity file /home/daniel/.ssh/id_rsa-cert type -1
debug1: identity file /home/daniel/.ssh/id_dsa type -1
debug1: identity file /home/daniel/.ssh/id_dsa-cert type -1
debug1: identity file /home/daniel/.ssh/id_ecdsa type -1
debug1: identity file /home/daniel/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/daniel/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/daniel/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/daniel/.ssh/id_ed25519 type -1
debug1: identity file /home/daniel/.ssh/id_ed25519-cert type -1
debug1: identity file /home/daniel/.ssh/id_ed25519_sk type -1
debug1: identity file /home/daniel/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/daniel/.ssh/id_xmss type -1
debug1: identity file /home/daniel/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2
kex_exchange_identification: read: Connection reset by peer

Whats going wrong here?

2
  • daniel@raspberrypi will never work unless you create a user by that name. Apr 25, 2020 at 17:43
  • Thanks, for your input, but as you can see from the logs, it's just what I accidentally did on the first run. Also, it doesn't explain the error
    – dba
    Apr 26, 2020 at 14:12

3 Answers 3

4

I cleared a kex_exchange_identification: read: Connection reset by peer error i was getting trying to ssh into a pi by rebooting my client - turns out it was my workstation with the issue not the pi. Hope this helps someone who found themselves on this thread for the same reason.

1
  • 1
    woohoo! this was my problem. thanks Feb 7, 2021 at 2:02
2

I would look at the end of /var/log/auth.log on the raspberrypi to see if there are any clues as to why sshd is disconnecting.

"Connection reset by peer" is often a symptom of IP address conflict -- multiple hosts trying to use the same IP address. Doesn't seem like that's the case here, but it's easy enough to check: run the arp command repeatedly and see if the MAC address for the raspberrypi is ever wrong.

Or just reboot the raspberrypi? That'll restart sshd, which may clear any problems it might be experiencing. Plus it will force the raspberrypi to re-request its DHCP lease which is an opportunity to detect and fix any IP address conflict (assuming you're using DHCP, of course).

1
  • Rebooting the Raspberry Pi (actually: brutally power cycling the Raspberry Pi) fixed the problem for me. But I do not think it was a problem of IP adress conflict (same adress before/after reboot), few devices on network. Aug 20, 2022 at 20:25
2

After facing lots of additional weird problems it turned out, that the micro sd card was just damaged. After trying a new one, everything seems to work as expected.

2
  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Apr 30, 2020 at 7:31
  • I am getting the same issue, and after testing various SD cards I do not think this is the problem. I can boot into Raspian just fine, but for now I cant SSH
    – Nicolas
    Feb 21, 2022 at 15:28

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.