Fix slow SSH startup in Debian Buster


I noticed on some of my Debian Buster installs, SSH times out and then waits until “random: crng init done” happens before restarting and finally allowing remote logins. This can sometimes add an extra 1+ minutes to boot time and can be pretty annoying. So if you’re experiencing a problem with SSH hanging or timing out while you’re server is booting up, then hopefully this quick how-to guide will help you out!

Why does it happen?

I did a bit of Googling and found a Debian bug report for this at which gives some thoughts on the problem and that it seems to be related to RNG. So if you’re experiencing the issue of SSH waiting on “random: crng init done” before it restarts and completes startup then it’s because of low entropy on your system (especially when it comes to virtual machines/vpses).

You can check the available entropy on your machine by running:

cat /proc/sys/kernel/random/entropy_avail

If that shows a number below 300 or so then you’re running low on available entropy.

How to fix it

If you encounter this SSH timeout issue, you can fix it by installing haveged or rng-tools5 (if you have a hardware RNG device). Both of these packages generate entropy so you won’t be running low on entropy and ssh should start like normal during the boot process.

Install haveged

To install haveged on your Debian or Ubuntu server, just run this command:

sudo apt install haveged

and it should automatically start and already be generating entropy after install. You can check the status of it by running the following command:

sudo systemctl status haveged

Now when you run the command:

cat /proc/sys/kernel/random/entropy_avail

you should have a lot more entropy available! Try rebooting your system after installing haveged and you should notice that SSH no longer times out and your boot process should be a lot faster as a result.


I hope that this article will be of use to someone encountering this same problem. If you have any questions or comments, please let me know by leaving a comment below.

Image Credit: The featured image for this article was created using an image created by Luke Chesser on Unsplash.

5 Replies to “Fix slow SSH startup in Debian Buster”

  1. You know, seriously, thanks so much for this.

    I had the same symptom as Paul – Both SSH and Apache both would not run at reboot time but installing haveged fixed the problem.

    As I am hosting on DigitalOcean (a virtual host), installing rng-tools5 does not fix the issue..

    …but installing haveged did.

    Posting log entries to boost keywords for search engines:

    systemd[1]: apache2.service: Control process exited, code=killed, status=15/TERM
    systemd[1]: apache2.service: Failed with result ‘timeout’.
    systemd[1]: Failed to start The Apache HTTP Server.

    systemd[1]: ssh.service: Start-pre operation timed out. Terminating.
    systemd[1]: ssh.service: Control process exited, code=killed, status=15/TERM
    systemd[1]: ssh.service: Failed with result ‘timeout’.

  2. hi,
    i am getting the exact same message when rebooting my raspi. unfortunately it doesn´t go away within at least 5 minutes. do you have an idea how i can solve this?

Leave a Reply

Your email address will not be published. Required fields are marked *