Preserve random seed across reboots
At first I tried to just use systemd's systemd-random-seed, but that one
does not actually use an appropriate ioctl for persuading kernel that
entropy is there. There's a patch [1] for this, but its fate is far from
certain, and even with it, I am not completely sure that I got
everything working correctly (some boots were quick, others waited for
systemd-resolved in the same manner as before this patch).
In the end, just seeding stuff from the initrd [2] is much easier. A
downside is that the systemd unit systemd-random-seed.service will add
the contents of that file once again -- but that doesn't matter much
because we do not patch it, and therefore it does not increase kernel's
idea about available entropy.
Changes from that upstream rndaddentropy:
- larger buffer
- more conservative entropy contribution
[1] https://github.com/systemd/systemd/pull/10621 .
[2] https://github.com/rfinnie/twuewand/blob/master/rndaddentropy/rndaddentropy.c
Change-Id: Ibe3c926c241d75fb7d7c40f3df2a96813931971b
diff --git a/package/czechlight-cfg-fs/init-czechlight.sh b/package/czechlight-cfg-fs/init-czechlight.sh
index a550906..cb45f7b 100644
--- a/package/czechlight-cfg-fs/init-czechlight.sh
+++ b/package/czechlight-cfg-fs/init-czechlight.sh
@@ -46,4 +46,8 @@
/bin/cp -a /cfg/etc/* /etc/
fi
+if [ -f /cfg/random-seed/random-seed ]; then
+ cat /cfg/random-seed/random-seed | /sbin/czechlight-random-seed
+fi
+
exec /sbin/init