I own an old laptop which is powered by the Linux operating system. It was always starting in about 20 seconds, but recently I noticed that I have to wait over two minutes for it to boot. This was rather strange because I was not making any significant changes to the system and it was inconvenient because I like it to start quickly.
I took a look at the dmesg output looking for the place where the time is wasted. What I found was:
$ sudo dmesg | less [...] [ 16.899023] IPv6: ADDRCONF(NETDEV_CHANGE) ... [ 156.757845] random: crng init done [...]
So, it looks like my kernel is wasting over two minutes to initialize random number generator. It surfaced that there is a bug which is exhausting the entropy pool used by the kernel for the random number generator. By default, this entropy pool is refilled by collecting disk operations and such things as mouse moves. It was definitely not working for me.
Fortunately, there is a simple solution to this issue. There is an application which can be installed and will be generating random numbers for the entropy pool working as a daemon (in the background). So you should simply install it, enable and start.
sudo apt install haveged sudo systemctl enable haveged sudo systemctl start haveged
From now on, this daemon will start on every boot, but the most important is that the entropy pool will be filled in the meantime – when your system is working. Once I installed haveged and let it work for some time, my boot time decreased to the usual 20 seconds.
My operating system is Ubuntu 18, but the same issue occurs in Ubuntu 16 as far as I can tell and can be spotted also in other distributions.