Search code examples
randomlinux-kernelboot

Why almost every command is trying to read urandom?


In a recent kernel(5.x) / rootfs for an embedded system (mips/MT7628/busybox, if it matters) I see TONS of:

random: mount: uninitialized urandom read (4 bytes read)
random: fsck.vfat: uninitialized urandom read (4 bytes read)
random: tar: uninitialized urandom read (4 bytes read)
...

This stops when, after a while (~10min!!) I finally see:

[  562.001438] random: crng init done

Two questions:

  1. why does it take so long to initialize /dev/urandom?
  2. for what reason mount or tar should try to use it in the first place?

Note: I did NOT have this problem with older kernels (3.x).


Solution

  • Answer came form another source (THANKS to Alessandro Rubini); I'm relating it here for future reference.

    1. This is expected if "cryptographically strong" random numbers are selected when compiling kernel (randomization without specialized hardware, using just interrupt timings takes a LOT of time); deselect "cryptographic RNG" if that's not required (as in my case).
    2. This has nothing to do with actual commands in general or Barebox in particular; it seems loader randomizes stack position in Virtual Space to harden against buffer-overflow exploits.