12

I'm trying to set up a raspberry pi with the command ssh pi@raspberrypi.local but I keep getting these messages:

ssh -v pi@raspberrypi.local 
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 53: Applying options for *
debug1: Connecting to raspberrypi.local [2601:47:4001:d250:88ff:ddb5:f761:74d2] port 22.
debug1: Connection established.
debug1: identity file /Users/liz/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Raspbian-10+deb9u1
debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to raspberrypi.local:22 as 'pi'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 2601:47:4001:d250:88ff:ddb5:f761:74d2 port 22

I have a hunch that it has something to do with the fact that I previously ssh-ed into a different raspberry pi with the exact same hostname and username, but I don't know how to fix it so that I can access this one (and probably rename it to avoid this problem in the future). I tried doing ssh-keygen -R raspberrypi.local but I'm still getting the same messages. Is there more I need to do to remove it? I'm also using a mac running on Sierra 10.12.6. I tried looking through similar issues but couldn't find anything that worked. Thanks!

jww
  • 97,681
  • 90
  • 411
  • 885
liz
  • 163
  • 1
  • 1
  • 7
  • Is it possible that the two devices are also trying to use the same IP address? – that other guy Oct 29 '17 at 23:31
  • That could be, although the first pi has been offline the entire time I've been trying to connect. Would I need to reroute it or reconfigure it somehow? – liz Oct 29 '17 at 23:41
  • Never mind then. It would only be an issue if both were on the network with the same IP at the same time – that other guy Oct 30 '17 at 02:08
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Oct 30 '17 at 16:20

2 Answers2

29

I had this problem too.

Here's the solution that worked for me: https://raspberrypi.stackexchange.com/a/60375/26923

In essence:

rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

I believe the problem is that the keypair files that are generated on first boot were corrupt (perhaps from plugging and unplugging power during the setup process).

coolaj86
  • 74,004
  • 20
  • 105
  • 125
0

I ended up installing dpkg via homebrew, and re-flashing the SSD card and then it worked. Not really sure why it was so finicky but helpful information in case anyone else runs into a similar issue.

liz
  • 163
  • 1
  • 1
  • 7