Some services SSH die after restart on Ubuntu... Or so they say. The status is "inactive (dead)", but you can connect to the server. What could be the problem here? What can one check?
Some factors that might be important:
- Those are virtual servers on a Proxmox 8 host (ZFS/LXC).
- Things worked fine on CentOS with mostly the same things running under the hood (same types of services, same physical infrastructure).
- Recently migrated to Ubuntu 22.04.2 LTS (reinstalled services on new virtual machines).
- When SSH is "inactive" I can connect to it.
- When SSH is "inactive" it is not logging anything. E.g. this is empty:
journalctl -u ssh --since yesterday
- When SSH is "inactive" it is unstable. E.g.
scp
gets disconnected randomly when running a script (a script that used to work fine and was very stable before migration to Ubuntu).
Here is a loop that I use to check services:
# check ssh service status
# (xargs = trim)
for someServer in ${serverList[@]}
do
connectionString=`getConnectionString "$someServer"`
status=`ssh $connectionString "service ssh status | grep active" | xargs`
printf "%15s: $status\n" $someServer
done
Full status info:
# service ssh status
○ ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)