The Problem

So, I was bored and tried to deploy new ssh keys. But my OpenSSH server refused to start with the following error message:

Unable to load host key "/etc/ssh/ssh_host_rsa_key": invalid format
Unable to load host key: /etc/ssh/ssh_host_rsa_key
sshd: no hostkeys available -- exiting.

However, the key was ok and worked in another setup.

Possible Solution

Apparently, there was only a newline missing at the end of the file. It got lost while deploying it. Happened to me on Alpine 3.2.1 on Docker…