Max_G
Posts: 32
Joined: Sat May 28, 2016 8:27 am

rPi3 fresh install, no ssh connection via wired Ethernet

Thu Feb 16, 2017 1:06 pm

Pulled a fresh rPi3 out of the cupboard and installed JessieLight (2017) on it. Added the file 'ssh' to the root of the sd card to enable the by default disabled ssh; put the SD into the Pi, network cable and power; red LED on, green blinking... rPi3 acquired IP address via DHCP; I can ping it, nmap shows port 22 is open... however, when connecting via laptop on Mint, I get an error: ssh Read from socket failed: Connection reset by peer

If I try to connect from a windows 10 PC I get: Network error; Software caused connection abort

I have no clue what to do next, given this is a new install, on a new Pi, without any other software than the Jessie light image and the file ssh to run a headless pi. I have changed the SD card, wrote image, added ssh file and same result.

There are other rPis (running Jessie 2016) on the network I can connect to w/o problems.

Any help appreciated.

Davies
Posts: 150
Joined: Sat Apr 04, 2015 4:24 pm

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Thu Feb 16, 2017 2:59 pm

could try on terminal

Code: Select all

sudo raspi-config
then choose "interfacing options", "SSH", "Yes" (which would require a screen)
or.. and i know this wouldnt answer what the issue is, but if you have an SD set up that already works you could create an .img of the sd card then flash that to your new card, using win32diskimager or something as such.

Max_G
Posts: 32
Joined: Sat May 28, 2016 8:27 am

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Thu Feb 16, 2017 10:30 pm

Thanks for trying... port 22 is open... adding the empty file 'ssh' works, as I have proven on another rPi.
It must be something else.

va1da5
Posts: 1
Joined: Sat Feb 25, 2017 12:08 pm

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Sat Feb 25, 2017 12:18 pm

Same issue here as well. After quick debugging I found the issue which was related to SSH keys.
When trying to login I have found the following errors

Code: Select all

[email protected]:/etc/ssh$ sudo tail -f /var/log/auth.log
Feb 25 11:59:49 raspberrypi sshd[1630]: error: key_load_public: invalid format
Feb 25 11:59:49 raspberrypi sshd[1630]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Feb 25 11:59:49 raspberrypi sshd[1630]: error: key_load_public: invalid format
Feb 25 11:59:49 raspberrypi sshd[1630]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Feb 25 11:59:49 raspberrypi sshd[1630]: error: key_load_public: invalid format
Feb 25 11:59:49 raspberrypi sshd[1630]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Feb 25 11:59:49 raspberrypi sshd[1630]: error: key_load_public: invalid format
Feb 25 11:59:49 raspberrypi sshd[1630]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Feb 25 11:59:49 raspberrypi sshd[1630]: fatal: No supported key exchange algorithms [preauth]
The actual files for keys exist, but they are zero in length.

Code: Select all

[email protected]:/etc/ssh$ ls -la
total 260
drwxr-xr-x   2 root root   4096 Feb 25 12:01 .
drwxr-xr-x 111 root root   4096 Feb 25 10:42 ..
-rw-r--r--   1 root root 242091 Jul 24  2016 moduli
-rw-r--r--   1 root root   1690 Jul 24  2016 ssh_config
-rw-r--r--   1 root root   2548 Feb 25 12:01 sshd_config
-rw-r--r--   1 root root   2541 Feb 25 11:54 sshd_config_orig
-rw-------   1 root root      0 Nov 25 18:09 ssh_host_dsa_key
-rw-r--r--   1 root root      0 Nov 25 18:09 ssh_host_dsa_key.pub
-rw-------   1 root root      0 Nov 25 18:09 ssh_host_ecdsa_key
-rw-r--r--   1 root root      0 Nov 25 18:09 ssh_host_ecdsa_key.pub
-rw-------   1 root root      0 Nov 25 18:09 ssh_host_ed25519_key
-rw-r--r--   1 root root      0 Nov 25 18:09 ssh_host_ed25519_key.pub
-rw-------   1 root root      0 Nov 25 18:09 ssh_host_key
-rw-r--r--   1 root root      0 Nov 25 18:09 ssh_host_key.pub
-rw-------   1 root root      0 Nov 25 18:09 ssh_host_rsa_key
-rw-r--r--   1 root root      0 Nov 25 18:09 ssh_host_rsa_key.pub
So the solution to this was to generate new SSH key files

Code: Select all

sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
Hope this will solve your issue.

Udo1
Posts: 7
Joined: Sat Dec 15, 2012 5:39 pm

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Sun Feb 26, 2017 11:16 am

Wondering how I could do this all without ssh?

Greeting
Udo

User avatar
emgi
Posts: 357
Joined: Thu Nov 07, 2013 4:08 pm
Location: NL

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Sun Feb 26, 2017 8:48 pm

By pure coincidence I just tested the latest jessie image on an old model 2B, the version with only two usb ports.
I was somewhat annoyed to find that ssh is initially disabled as described here:
https://www.raspberrypi.org/blog/a-secu ... ian-pixel/

It is amazing to how far the foundation will go -imho- to suit the lowest common denominator.

Anyway, it didn't take too long to fiddle this out and in my case it was enough to add the ssh file in /boot.
With that in place, this rather old Pi booted fine with the latest image AND ssh worked.
No RPi3 in this home yet :| .

Ernst
Posts: 1141
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Mon Feb 27, 2017 10:21 am

emgi wrote:By pure coincidence I just tested the latest jessie image on an old model 2B, the version with only two usb ports.
I was somewhat annoyed to find that ssh is initially disabled as described here:
https://www.raspberrypi.org/blog/a-secu ... ian-pixel/

It is amazing to how far the foundation will go -imho- to suit the lowest common denominator.

Anyway, it didn't take too long to fiddle this out and in my case it was enough to add the ssh file in /boot.
With that in place, this rather old Pi booted fine with the latest image AND ssh worked.
No RPi3 in this home yet :| .
I am not amused about your statement on the foundation, you forget that the foundation has a responsibility to educate and, for this reason, to ensure that the "pupils" do no get into trouble. There are many ways to hook the Pi into a network, if done "badly" the Pi can become an open gateway into a normally closed environment. Even in a closed (educational) network an open Pi can be target for students to try to hack into any device they can find.

It is a wise decision to limit the access to the Pi and to bring security awareness to the community.
The road to insanity is paved with static ip addresses

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: rPi3 fresh install, no ssh connection via wired Ethernet

Wed Mar 08, 2017 8:31 am

I had the same issue on the latest raspbian on my zerow.

I had to remove the existing files first though.

Code: Select all

sudo rm /etc/ssh/ssh_host*
Also

Code: Select all

sudo ssh-keygen -A
Does all the keys for you.

One liner

Code: Select all

sudo rm /etc/ssh/ssh_host* && sudo ssh-keygen -A

Return to “Troubleshooting”