2

I tried to reinstall my raspberry, I added the ssh file with touch on the boot partition and started raspbian lite.

In the boot sequence I can see "Started Tun on SSH if /boot/ssh is present".

When I try to ssh to the raspberry I get Connection closed by 192.168.1.79 port 22

I also noticed that the ssh file gets removed from the boot partition

Is there something changed? Or am I missing something?

I have the latest March version of raspbian:

Version:March 2018
Release date:2018-03-13
Kernel version:4.9
  • How are you connected to the raspi? Ethernet? Wifi? Please edit your question and insert the output from ssh -v 192.168.1.79. – Ingo Apr 15 '18 at 20:44
  • 1
    The fact that /boot/ssh is removed is normal as far as I can tell. I guess the idea is that the first time you ssh into a headless install you'd set up ssh properly. Though, of course you can't get in the first time, which is the issue, this comment is just to assure you that the disappearance of /boot/ssh looks normal - i.e. a systemd oneshot startup performs the following command update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /boot/ssh ; rm -f /boot/ssh.txt – Jaromanda X Apr 15 '18 at 23:27
  • I recently setup some headless Pi3's and had the same issue. I'm not sure, but I think that on first boot, the root partition was extended, and this took a long time (several minutes), and there may have even been a reboot once done. Of course, this would mean /boot/ssh was no longer present. What I did for the 2nd and subsequent pi was let the first boot go for about 10 minutes (probably overkill), then poweroff, remove the sdcard and add ssh using another computer, reinsert the card and ssh worked fine, at which point I enabled ssh properly – Jaromanda X Apr 15 '18 at 23:34
  • I analyzed the syslog from the ssd, and somehow sshd generated empty host certficates. after reflashing everything works fine. I'm going to reproduce this. – Sander Visser Apr 16 '18 at 11:27
1

As you've noticed, you'll need to pull your microSD card, and re-create the empty file named SSH. When you make your next attempt, you should run ssh in verbose mode, as that may provide useful information:

ssh -v pi@192.168.1.79

One possibility: You may be attempting to make a connection to the wrong host. Have you verified, or do you know for certain, that 192.168.1.79 is the address of your new RPi? Try this:

ping 192.168.1.79
arp -a | grep --ignore-case b8:27:eb

An RPi MAC address will begin with b8:27:eb, so if there's any doubt that it's an RPi you're trying to connect to, the arp command above will help you verify that.

  • 1
    Hey yes the ip 192.168.1.79 is correct, somehow ssh generated empty host certificates, i could trace down the error messages in the syslog. Not sure how it could happend that ssh generated those empty certificates. – Sander Visser Apr 16 '18 at 11:54
  • 1
    So you're connected now... problem solved?? – Seamus Apr 16 '18 at 12:18
  • 1
    Yes, :) but still curious how it could happen, maybe I accidentally restarted my pi while booting ssh. (loose power connector?) – Sander Visser Apr 16 '18 at 12:21
  • 1
    :) yes... I'm often curious about how things happen with these silly machines. – Seamus Apr 16 '18 at 12:26
1

i successfully enabled ssh with the Pi3 but had issues with the older model (0e) Model B 512MB. i am using image 2018-03-13-raspbian-stretch.

headless did not work but the port was open. The error message was: Connection reset by 10.104.76.193 port 22

I used nmap to confirm port 22 was listening. I connected the pi to a monitor, keyboard, and mouse. The configuration confirmed SSH was enabled but it still was not allowing incoming connections.

I discovered that some files in the /etc/ssh/ directory are zero length.

-rw------- 1 root root 0 Apr 24 16:01 ssh_host_rsa_key -rw-r--r-- 1 root root 0 Apr 24 16:01 ssh_host_rsa_key.pub

I copied the /etc/ssh/ssh_host* files from a working pi3 to the older pi and rebooted. I can now successfully access the model B rev 2 raspberry pi using ssh.

I hope this helps others in this situation still using the (0e) model B.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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