I used this excellent guide to update my Raspbian from Stretch to Buster:

After rebooting my Pi, the SSH connection was gone.

Logging into the Pi using the attached keyboard and monitor allowed me to debug the issue:

service ssh status

journalctl -u ssh -n 200

„Missing privilege separation directory /run/sshd“

This directory needs to be created at startup for the ssh daemon to start properly.

You can ensure that this directory gets created by creating a special file:

sudo nano /usr/lib/tmpfiles.d/sshd.conf

add the following content to this file:

# Fixup for ssh missing directory
d /run/sshd 0755 root root

image

Save (Ctrl + O) and Exit (Ctrl + X)

Ensure the user rights are correctly set:

ls -alh /usr/lib/tmpfiles.d/sshd.conf

image

Reboot your Pi:

sudo reboot

SSH should now hopefully come up again.

Ref: