70 seconds delay during boot of raspberry pi due to lack of entropy?
I've been enjoying alpine on the raspberry pi, after the initial setup struggle (#11210 (closed)) it works quite nicely.
But I did notice a quite long delay during booting. It's after the loading progress bar and the creating initramfs image
message. Looking at the dmesg, there seems to be a 70 seconds before random
is done initializing. Seeing #9960 (closed) and comments about not having an ARM solution, I guess this is related to entropy?
So I did 2 things:
- As suggested in #9960 (closed) I installed rng-tools and added
rngd
at boot level - Flashed lastest rasbian on same SD card.
Here is what I learned.
Raspian Lite
[ 0.000000] Linux version 4.19.97+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1294 Thu Jan 30 13:10:54 GMT 2020
....
[ 0.000000] random: get_random_bytes called from start_kernel+0x8c/0x494 with crng_init=0
....
[ 2.246096] random: fast init done
....
[ 8.755949] random: systemd: uninitialized urandom read (16 bytes read)
[ 8.787834] random: systemd: uninitialized urandom read (16 bytes read)
[ 8.797997] systemd[1]: Listening on udev Control Socket.
[ 8.809610] random: systemd: uninitialized urandom read (16 bytes read)
....
[ 24.256082] random: crng init done
[ 24.256107] random: 7 urandom warning(s) missed due to ratelimiting
Alpine 3.11.3
[ 0.000000] Linux version 5.4.12-0-rpi (buildozer@build-3-11-armhf) (gcc version 9.2.0 (Alpine 9.2.0)) #1-Alpine Thu Jan 16 14:37:06 UTC 2020
....
[ 0.000000] random: get_random_u32 called from __kmem_cache_create+0x20/0x310 with crng_init=0
....
[ 2.306888] random: fast init done
....
[ 3.609602] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:e9:4e:e0
[ 76.841124] random: crng init done
(there are no messages excluded between 3.6 and 76.8)
Analysis
Raspbian takes 30s to boot the kernel, alpine takes 93s. More than a minute slower.
I love to help and debug this, but I'm a bit lost what else to try.
(For installation I followed the Wiki's instructions)