Fix for slow boot with newer kernels on older hardware.
Dmesg shows large delay before "crng init done."
I hope that this is useful to somebody...
Background:
I've recently been working to resurrect an old Zoostorm laptop. This is actually a rebadged Clevo W251HU laptop which died in 2015 due to thermal runaway in Windows 7.
I obtained a replacement motherboard from a similar model (a W251EU). The only difference is the connection of the audio jack/USB daughter board, (a flat cable on the W251EU and a mini plug/ribbon cable on the original W251HU).
I also needed a new battery as the old one was totally dead.
With parts obtained, coupled with a reasonable SSD, the latest BIOS update available and some decent heatsink paste, I then proceeded to rebuild the machine.
Everything went fine until I reached the point of installing Linux Mint 19.1 .
/Background
A "poor quality" BIOS which doesn't support GPT properly caused a few problems until I had hit on the correct BIOS settings for a working MBR Linux installation.
The installation was smooth and error free. On rebooting I fully updated the machine and installed the latest stable kernel using UKUU (kernel 5.0.5).
On rebooting again, the problems started. Boot times had increased from seconds to minutes, Bluetooth failed and wifi was shown as hard locked. The keyboard combo Fn + F11 would unlock wifi but it remained flakey.
I spent a couple of hours looking at the Bluetooth and wifi problems (a mistake here, I should have looked more closely at what dmesg was telling me).. After working out how to disable them fully on boot (no Bios options to do this) I found that the slow boot problem remained.
Original dmesg extract:
Code:
[ 5.616124] RTL8211E Gigabit Ethernet r8169-302:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=r8169-302:00, irq=IGNORE)
[ 5.802721] r8169 0000:03:00.2 enp3s0f2: Link is Down
[ 139.712493] random: crng init done
[ 139.712499] random: 7 urandom warning(s) missed due to ratelimiting
[ 181.079833] iwlwifi 0000:02:00.0: RF_KILL bit toggled to enable radio.
[ 181.079838] iwlwifi 0000:02:00.0: reporting RF_KILL (radio enabled)
There is a big clue at 139 seconds i.e. "crng init done."
A little research showed that prior to this point, "the entropy pool is depleted". This is used for random number generation purposes.
Another quote:
"The system has long reached its default boot target before the kernel gathered enough entropy to initialize the pool. Due to systemd requiring entropy at an early stage, it may happen though that the pool is depleted in the boot process without further kernel warnings."
The fix, in this case, is to use haveged.
Quote:
"Haveged is an easy-to-use, unpredictable random number generator based upon an adaptation of the HAVEGE algorithm. Haveged was created to remedy low-entropy conditions in the Linux random device that can occur under some workloads, especially on headless servers"
This is installed and initialised on a systemd machine as follows:
Code:
sudo apt install haveged
sudo systemctl enable haveged
After a reboot, the machine now works great. Boot times are now as expected and all hardware works perfectly.
Bodge99