On Mon, Sep 30, 2019 at 09:06:36AM -0700, Linus Torvalds wrote: > Obviously, that can be a problem if you then need sshd in order to get > into a headless box, so my patch fixes things for you too, but at > least your box doesn't show the problem that Ahmed had, and the boot > completing presumably means that you got more entropy from other disk > IO being done by the rest of the boot.
Right, another observation I did was that when it would wait for entropy, if I press random keys, it would get done faster because apparently it would collect entropy from the key presses too. > If you want to test my hacky "do /dev/urandom too", it was this one-liner: > > --- a/drivers/char/random.c > +++ b/drivers/char/random.c > @@ -2027,6 +2027,7 @@ urandom_read(struct file *file, char __user > *buf, size_t nbytes, loff_t *ppos) > static int maxwarn = 10; > int ret; > > + if (!crng_ready()) try_to_generate_entropy(); > if (!crng_ready() && maxwarn > 0) { > maxwarn--; > if (__ratelimit(&urandom_warning)) > > and that should get rid of the warnings. So when I add this by hand and do git diff, it adds a second hunk: --- diff --git a/drivers/char/random.c b/drivers/char/random.c index c2f7de9dc543..93bad17bef98 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2027,6 +2027,7 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) static int maxwarn = 10; int ret; + if (!crng_ready()) try_to_generate_entropy(); if (!crng_ready() && maxwarn > 0) { maxwarn--; if (__ratelimit(&urandom_warning)) @@ -2520,4 +2521,4 @@ void add_bootloader_randomness(const void *buf, unsigned int size) else add_device_randomness(buf, size); } -EXPORT_SYMBOL_GPL(add_bootloader_randomness); \ No newline at end of file +EXPORT_SYMBOL_GPL(add_bootloader_randomness); --- and I kinda get what it is trying to tell me but this is new. And when I do $ xxd drivers/char/random.c .. 000125e0: 646f 6d6e 6573 7329 3b0a domness);. there's a 0xa at the end so what's git really trying to tell me? Anyway, that does get rid of the warns too. > Doing something like the above to /dev/urandom is likely the right > thing to do eventually, but I didn't want to mix up "we can perhaps > improve the urandom situation too" with the basic "let's fix the boot > problem". The urandom behavior change would be a separate thing. So make it a separate patch and let's hammer on it during the next weeks and see what happens? > Also, talking about "future changes". Right now > "try_to_generate_entropy()" is actually uninterruptible once it gets > started. I think we should add a test for signal_pending() too, but it Wouldn't that even increase its entropy, which would be a good thing? > should generally complete really fairly quickly so I left it without > one just to see if anybody even notices. Right. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette