When I boot my desktop sshd is not running:
=$ systemctl status sshd.service
○ sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
If I'll do sudo systemctl enable sshd.service; sudo systemctl start sshd.service
it comes online without problem and status shows:
=$ sudo systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-10-25 12:25:47 CEST; 1min 11s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 14091 (sshd)
Tasks: 1 (limit: 76311)
Memory: 2.3M
CPU: 8ms
CGroup: /system.slice/sshd.service
└─ 14091 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Oct 25 12:25:47 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 25 12:25:47 orange.home.depesz.com sshd[14091]: Server listening on 0.0.0.0 port 22.
Oct 25 12:25:47 orange.home.depesz.com sshd[14091]: Server listening on :: port 22.
Oct 25 12:25:47 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
But on next reboot - it's still down.
Last lines from journalctl | grep sshd.service
don't show anything bad:
Oct 18 11:45:20 orange.home.depesz.com sudo[4936]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl enable sshd.service
Oct 18 11:45:27 orange.home.depesz.com sudo[5039]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl start sshd.service
Oct 18 11:45:28 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 18 11:45:28 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 18 11:51:40 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 18 11:51:41 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 18 11:51:41 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 18 11:56:37 orange.home.depesz.com sudo[3079]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl enable sshd.service
Oct 18 11:56:40 orange.home.depesz.com sudo[3114]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl start sshd.service
Oct 18 11:56:40 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 18 11:56:40 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 18 11:56:49 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 18 11:56:49 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 18 11:56:50 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 18 11:57:18 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 18 11:57:18 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 18 12:26:50 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 18 12:26:50 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 18 12:26:50 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 18 12:31:42 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 18 12:31:42 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 18 12:51:31 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 18 12:51:31 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 18 12:51:31 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 18 13:30:04 orange.home.depesz.com baloo_file_extractor[3719]: kf.baloo: "/home/depesz/tmp/old-orange/var/lib/systemd/deb-systemd-helper-enabled/sshd.service" id seems to have changed. Perhaps baloo was not running, and this file was deleted + re-created
Oct 18 17:02:51 orange.home.depesz.com sudo[41862]: depesz : TTY=pts/5 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl start sshd.service
Oct 18 17:02:51 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 18 17:02:51 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 19 14:02:24 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 19 14:02:24 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 19 14:02:24 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 19 14:02:24 orange.home.depesz.com systemd[1]: sshd.service: Consumed 1.732s CPU time.
Oct 19 14:05:10 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 19 14:05:10 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 23 10:25:58 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 23 10:25:58 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 24 20:57:45 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 24 20:57:45 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 24 20:57:45 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 24 20:57:45 orange.home.depesz.com systemd[1]: sshd.service: Consumed 2.378s CPU time.
Oct 25 07:50:08 orange.home.depesz.com sudo[8157]: depesz : TTY=pts/10 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl enable sshd.service
Oct 25 07:50:10 orange.home.depesz.com sudo[8275]: depesz : TTY=pts/10 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl start sshd.service
Oct 25 07:50:10 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 25 07:50:10 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 25 11:44:24 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 25 11:44:24 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 25 11:44:24 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 25 12:25:37 orange.home.depesz.com sudo[13952]: depesz : TTY=pts/2 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl enable sshd.service
Oct 25 12:25:47 orange.home.depesz.com sudo[14088]: depesz : TTY=pts/2 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl start sshd.service
Oct 25 12:25:47 orange.home.depesz.com systemd[1]: Starting sshd.service - OpenSSH server daemon...
Oct 25 12:25:47 orange.home.depesz.com systemd[1]: Started sshd.service - OpenSSH server daemon.
Oct 25 12:26:30 orange.home.depesz.com sudo[14226]: depesz : TTY=pts/2 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/journalctl _SYSTEMD_UNIT=sshd.service
Oct 25 12:26:58 orange.home.depesz.com sudo[14388]: depesz : TTY=pts/2 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl status sshd.service
Oct 25 12:27:48 orange.home.depesz.com systemd[1]: Stopping sshd.service - OpenSSH server daemon...
Oct 25 12:27:48 orange.home.depesz.com systemd[1]: sshd.service: Deactivated successfully.
Oct 25 12:27:48 orange.home.depesz.com systemd[1]: Stopped sshd.service - OpenSSH server daemon.
Oct 25 12:40:37 orange.home.depesz.com sudo[7448]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl status sshd.service
Oct 25 12:40:48 orange.home.depesz.com sudo[7604]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl status sshd.service
Oct 25 12:40:54 orange.home.depesz.com sudo[7672]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl status sshd.service
Oct 25 12:41:15 orange.home.depesz.com sudo[7772]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/systemctl status sshd.service
Oct 25 12:41:49 orange.home.depesz.com sudo[7988]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/journalctl _SYSTEMD_UNIT=sshd.service
Oct 25 12:42:20 orange.home.depesz.com sudo[8147]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/journalctl _SYSTEMD_UNIT=sshd.service -n 100
Oct 25 12:42:25 orange.home.depesz.com sudo[8214]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/journalctl _SYSTEMD_UNIT=sshd.service -n 50
Oct 25 12:42:28 orange.home.depesz.com sudo[8286]: depesz : TTY=pts/1 ; PWD=/home/depesz ; USER=root ; COMMAND=/usr/bin/journalctl _SYSTEMD_UNIT=sshd.service -n 50
Any idea on how to fix/debug it?
Ah, as final note - there is nothing listening on :22 after reboot. And I can start sshd.service without any problem using systemctl start sshd.service