SSH: Putty Fatal Error on trying to SSH connect

What is the problem?
I can connect to octoprint via octopi.local through chrome browser no problems at all, however whenever I try to SSH into the pi (want to set up multiple webcams) I use Putty and get the error "PuTTY fatal Error: Remote side unexpectedly closed network connection"

What did you already try to solve it?
Tried connecting via its IP number, as well as octopi.local through PuTTY
Port forwarded the router to the pi (BT home hub 7)
connecting up a monitor to the PI and double checked that SSH is enabled via raspi-config
putting null packets keep session alive up from 0 to 5 and enabling TCP keepalives in PuTTY

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
OctoPrint version: 1.3.10
OctoPi 0.16.0

attached the last log of attempting to log in via SSH too.
Thanks.

octoprint (3).log (11.1 KB)

  • ssh isn't running (you've confirmed that it is)
  • wi-fi signal strength insufficient to keep the Raspi connected on your network (try an Ethernet cable to troubleshoot), run iwconfig and take a look at the signal strengths for yours and other possibly competing zones on the same channel, consider changing your router's channel to something else (out of channels 1/6/11)

Consider adding IPQoS cs0 cs0 to the end of /etc/ssh/ssh_config and /etc/ssh/sshd_config in cases where your wi-fi is terrible.

You might want to look at cat /var/log/auth.log to make sure there aren't hacking attempts.

What port do you have forwarded?

Are you trying to access your OctoPi through that forwarded port? SSH runs on a different port (22) than the OctoPrint interface (port 80 or 5000). Your router may not allow forwarding port 22.

Hi OutsourcedGuru thanks for replying.
I've connected ethernet, connected to it via its ethernet IP (confirmed via router) to only get the same issue, I'll try from here on out just on ethernet to SSH into the pi. the auth.log is just myself, no hacking attempts.

fieldOfView thanks for replying.
Yeah I forwarded port 22 for SSH, Octoprint itself is fine, just seems to be SSH wherein lies the issue, its a real head scratcher.

Are you suggesting that you're passing port tcp/22 from the outside world to your internal network?

I did just for testing purposes, but was only for a 20 minutes or so tops. just trying to eliminate any issues.

And everything is connecting over IPv4- or IPv6-based addresses?

Try for a bit with just the IPv4 address rather than the hostname. If that fixes this then it's entirely possible that your DHCP server is giving stupidly-short leases. It's also possible that your network has bugs in the IPv6 area.

If you're manually issuing IP addresses, make sure that you haven't double-issued the same address. Verify that the netmask and broadcast address is the same throughout.

Yeah its always the same IP address, is there a checklist I can work through to rectify this? I've double checked that there is nothing using the same IP on the router. as for IP's just using whatever is assigned to it I've not gone with manually assigning IP's as I want to try and keep it as simple as possible, its just confusing the hell out of me as I have no issues connecting to the Octoprint interface, just can't seem to SSH into the pi.

Oddly enough: here.

It's probably an IPv6 bug, I'd guess.

It wouldn't hurt to connect a keyboard/monitor/mouse to the Raspi, add the Ethernet cable and then run locally:

sudo apt-get update
sudo apt-get -y upgrade
sudo reboot

Oh wow thats a great post link, thanks very much.

I'll work through it tomorrow, getting late here now, thanks very much.

I ran the Update and upgrade command to no avail along with going through that post. Nothing seemed to work.

after backing up the settings I had, on octoprint, reinstalling on a fresh and different SD card and restoring the backup it seems to be working all ok? very strange issue but resolved now, I will admit the SD card I had before wasn't of the highest quality,

Thanks again for the help guys :slight_smile:

There must have been something wonky about the sshd configuration. :man_shrugging: