Failed to start OpenBSD Secure Shell server error when I try to run apt-get or to install Ubuntu upgrades
Solution 1:
This issue is caused by a bad configuration of /etc/ssh/sshd_config file. When the service try to launch it does not recognize every fields of this configuration file. In order to solve this issue, you must use the tool
/usr/sbin/sshd -T
In case /etc/ssh/sshd_config was wrong, this would show wrong parameters with lines.
You must correct this issues and then restart the service:
/etc/init.d/sshd restart
Solution 2:
If this happens right after installing Ubuntu Server, press Ctrl + F2 or F3,...F7 to switch to another TTY if you don't have a free terminal. It will ask you to login. Then, you should be able to run sudo ssh-keygen -A
and then reboot and it should be able to start the service.