OpenSSH on VPS crash after update

On a VPS with Ubuntu 24.04, after upgrade of the latest packages and reboot, SSH connection is failing with message Connection Refused.
I was able to see that the OpenSSH was updated.
I was able to connect on rescue mode and mount the server disk. Seems the custom port is still set in SSH socket. Log does show SSH server is starting. No error in the log on failing connection.
Server still working (mail server still functional).
Any obvious reason why logging on SSH is failing,

You can probably get more information by making the output verbose with the -v option. Add more v for more verbose output:

For example: ssh -p <portnumber> -vvv <user>@<remotehost>

Also, does your VPS provider have a console access system so that you can connect directly to the machine, rather than via SSH? That will make debugging easier at the other end.

1 Like

Hello, thx for the answer.
the verbose mode does not provide extra.
OVH provide a rescue mode into which you can mount your VPS directory from a extra system and then access it, but no real access while running…

You might want to check that sshd service is running, and not ssh service

My understanding is that it is socket enabled.
I have systemd ssh.socket active. The journalctl log clearly states “…systemd[1]: Listening on ssh.socket - OpenBSD Secure Shell server socket.”
There is a link in /etc/systemd/system/multi-user.target.wants between /usr/lib/systemd/system/ssh.socket and ssh.socket.
In /etc/systemd/system/ssh.socket.d there is a listen.conf file with ListenStream=xxxxx.
When connecting to xxxxx it is quick refused error while it is longer when trying port 22 or others. So seems the port is ok
In fact I changed nothing, it was working good on the custom port. I logged, upgraded package with apt, rebooted, then no access anymore… I was able to see in the terminal log that openssh was upgraded… so my guess is that it changed something.

The upgrade did the same to me, I think your understanding is wrong.
You need to shutdown ssh.socket and start ssh.service.
That did it for me.

How to do that just by changing files in directory as I have no direct access to the live system (it is hosted…)

My understanding is that the ssh.service is started by the ssh.socket one on ssh connection…

Most hosting providers have a control panel such as cpanel. I use webmin on my servers. It has a section to control running processes, and boot processes.

There also may be a host control panel, all that I have dealt with have shell access through the host control panel.

I just came over from slackware and don’t know systemd well yet.
There may be a config file to set it, but I am not aware of where it is.