I have a Raspberry Pi Model B and I updated it this afternoon from wheezy to jessie. I connect headlessly with VNC and SSH (usually the latter) because I play around with home LAMP and nodeJS servers.

Both worked fine before the upgrade. Since upgrading to jessie, SSH has been refusing my connections. The error is:

ssh: connect to host port 22: Connection refused

So, I double checked the IP - no problem there. Then, I checked the hostname and users, both are correct. Then, I tried clearing my RSA keys on both the Mac and the Pi. No luck.

Finally, I checked to make sure the SSH daemon was actually running. And, it wasn't. So, I went through raspi-config and started SSH. I checked again with service ssh status and still got an empty response.

So, my question is: why isn't the SSH service starting and could it have something to do with updating to jessie?

If so, is my only option to reflash with wheezy?

  • Jessie uses systemd. Services in /etc/init.d/ should start at boot, but it might be worth running systemctl enable sshd && systemctl start sshd... – jasonwryan Dec 6 '15 at 5:25
  • Look at your logs (/var/log/messages, possibly /var/log/secure or /var/log/sshd/something) to see why the service isn't starting. Without that info, no-one can help you. – Mat Dec 6 '15 at 5:46
  • People have been having problems left and right with systemd in ARM. I have been using Jessie without systemd. – Rui F Ribeiro Dec 6 '15 at 8:33

First of all check that /etc/ssh/sshd_config is valid and service should listen on port 22. Then check iptables rules:

iptables -L -nvx

(Eventually /etc/iptables/rules.v4 if you're chrooted into the system).

You can check /var/log/auth.log for messages like:

error: Could not load host key: /etc/ssh/ssh_host_rsa_key

which might mean that some keys are missing, check with:

ls -al /etc/ssh/ssh*key

Easiest way how to fix this would be:

dpkg-reconfigure openssh-server

Jessie uses sort of hybrid mode for running services, there should be /etc/init.d/ssh script and also systemd config. Systemd ssh service should be enabled:

systemctl is-enabled ssh

in case that it's not, enable with systemctl enable ssh.

Make sure that /var/run/sshd directory exists:

/bin/mkdir -p -m0755 /var/run/sshd

And finally you can try running sshd in debug mode:

/usr/sbin/sshd -f /etc/ssh/sshd_config -d  

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.