urandom: save seed even if random pool size is less than 4096 bits Linux 5.18 replaced the LFSR used for entropy extraction with BLAKE2s, which reduced the entropy pool size from 4096 to 256 bits. init.d/urandom extracts the seed to save in 512-byte chunks, rounding down when calculating the number of chunks to save, resulting in no random seed being saved on these kernels. Fix the init script by reading a single variable-sized chunk from /dev/urandom. Signed-off-by: Hunor Csordás --- openrc-0.44.10/init.d/urandom.in.orig 2022-06-10 12:58:17.432472085 +0200 +++ openrc-0.44.10/init.d/urandom.in 2022-06-10 13:15:59.263851886 +0200 @@ -21,15 +21,15 @@ save_seed() { - local psz=1 + local psz=512 if [ -e /proc/sys/kernel/random/poolsize ]; then - : $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 )) + : $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 8 )) fi ( # sub shell to prevent umask pollution umask 077 - dd if=/dev/urandom of="$urandom_seed" count=${psz} 2>/dev/null + dd if=/dev/urandom of="$urandom_seed" bs=${psz} count=1 2>/dev/null ) }