Closed lieux closed 5 years ago
/dev/random
slow-downs are due to its security. It will block until enough entropy is collected to be more random than off of a cold boot alone (entropy is collected from mouse movements, keyboard input, microphone input, etc).
I don't know that speed and security should necessarily be a trade-off. So, I think what I may do is have the seeding forked into the background during boot.
So does this mean that input (mouse movements, keyboard input, microphone input, etc.) is always necessary during boot?
Not necessarily; it's hardware dependent, but even if there's no external USB devices, the kernel still draws entropy from jack inputs with nothing plugged in. Some systems may generate entropy faster than others. This is the point behind a seed file, though.
That being said, a seed file is created on a safe shutdown using hummingbird. If you don't mind testing something for me, start your machine, log in, and then shutdown using the shutdown command. The next boot should pan out without needing input at all.
Alright, so I reverted the input file to be the random
device, and changed the directory to /var
; I didn't want to use another temporary directory in the event that it gets washed by another process for whatever reason, and the seed is by some definition variable data.
This should suffice; it will have you do input and such on the first boot, but the following reboots should be fine. I also changed it so the file isn't removed. This was for no real reason other than the seed not being in a temporary directory anymore, so it has no reason to be removed.
If these changes work on your system as well, I'll merge them in, just let me know.
Working fine. Thank you.
/dev/random
generates PRNGs slower than/dev/urandom
which is suspected to slow down thesetup_random
function during bootTaken from: https://git.2f30.org/ports/file/fs/bin/rc.init.html#l86 https://git.2f30.org/ports/file/fs/bin/rc.shutdown.html#l43