SSH error “remote side unexpectedly closed network connection”

SSH error “remote side unexpectedly closed network connection”

https://paste.osmc.tv/xufucadece

I am running OSMC on a Raspberry Pi 3. I have been using my setup for over a month, no problem. I even connected via SSh early on. Now when I connect via SSh I get the error “remote side unexpectedly closed network connection”.

The link to the error log is given. You help is greatly appreciated.

What is the client you are using to connect?

Also looks you tried to reinstall ssh on 20th April, was this the time where you got connection issues?

Which IP Address are you connecting to?

My client is Raspberry Pi 3 with OSMC.
I uninstalled and reinstalled the SSH server when I first encountered this error.
That didnt change anything.
The IP address I’m connecting to is 192.168.0.103

No, the server you are connecting to is a Raspberry Pi 3 with OSMC the client is your laptop or desktop computer either using a built-in SSH tool or a separate program like PuTTY. If you are using a separate program then check to see if there is an update available for it.

My client is a Windows 10 machine running Putty Release 0.73 Build platform: 64-bit x86 Windows.
This happens to be the latest version available.

Ok, I was asking as I didn’t see any ssh connection try in the log you uploaded.

192.168.0.103 is the IP address for the server

Yes, but as written I didn’t see a log entry that showed you tried to connect.

Suggest to do some more logging. Maybe first try to see what the client reports.
In putty check the event-log or for more details enable Logging under Session menu.

You might try it with Win10’s built-in application. Bring up the Windows command prompt and type in…
ssh osmc@192.168.0.103

https://paste.osmc.tv/afupakojul

I couldnt understand what you meant by Logging under Session menu. I tried connecting via ssh 3 times after enabling Component specific, event and event notification logging.

You’re on the latest version of putty, so that’s unlikely to be the problem.

I can see from the log that you seem to have chosen to install the package maintainer’s version of /etc/ssh/sshd_config when reinstalling the openssh_server package.

Later there was an attempt (not clear what the source was) to purge the package ssh_app_osmc, which failed, but the package was later reinstalled, apparently successfully.

Since any further diagnostic work will require some kind of command line access – and SSH isin’t available – you’ll either need to attach a USB keyboard and use the TV as a monitor or go for a reinstall. Let us know what you choose.

Have you got any port forwarding set up on your router to allow SSH from outside of your network? I’m always a bit suspicious when I comes to SSH issues .

1 Like

Well as ssh logging on OSMC in your case would require terminal access I wanted to make your life easy and said to start checking logs on the client (putty).
So in putty check event logs and check session logging

1 Like

I did as you suggested - tried the ssh command on Windows10 command prompt. The first time this is the response I got.:

The authenticity of host ‘192.168.0.103 (192.168.0.103)’ can’t be established.
ECDSA key fingerprint is SHA2S6:aUHVzr98sPQPg7/Uj/7tl+N3HqF3FqvMPNUlV3i1+nQ.
Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added ‘192.168.0.103’ (ECDSA) to the list of known hosts.
osmc@192.168.0.103’s password:
GetConsoleMode on hOutputConsole failed with 6

*** At this point the console simply hung doing nothing. Upon my pressing Cntrl-C, it printed out the following line.

Connection to 192.168.0.103 closed.

*** I repeated the same command immediately - this time it asks me directly for a password and gives me a working ssh console. I did some basic shell commands and it responded appropriately. I closed it and tried Putty. It still wouldn’t work. Retried the Windows10 console ssh command and it worked well just like last time.

What to make of it. Why wont Putty respond.

I can easily attach a USB keyboard and use the TV as monitor. Please let me know what is to be done.
I just tried doing the ssh command on my client Windows10 command prompt. After failure it connected and seemed to work properly as an ssh terminal should. But Putty still wouldnt work.

I document this on another reply on this discussion.

No I don’t.

I tried, no log file is generated. Once I click away the alert that says remote side closed network connection, the putty window indicates inactive and has to be closed.

So if you can connect from there keep that window open and run sudo journalctl -f then try to connect from Putty and check what is displayed in the journal.

I ran the command and the screen printed some logs which finally culminated in:
pam_unix(sudo:session): session opened for user root by osmc(uid=0)

The window hangs and session has to be killed with a Ctrl-C

Putty still doent work.

Why do you try to login as root?
Try to login as osmc first