[systemd-devel] Switch root slowness

Lennart Poettering lennart at poettering.net
Thu Oct 30 06:35:17 PDT 2014


On Thu, 30.10.14 13:18, Jan Synáček (jsynacek at redhat.com) wrote:

> Hello,
> 
> commit 539618a0ddc2dc7f0fbe28de2ae0e07b34c81e60
> Author: Lennart Poettering <lennart at poettering.net>
> Date:   Wed Oct 29 17:06:32 2014 +0100
> 
>     util: make use of the new getrandom() syscall if it is available when needing entropy
> 
>     Doesn't require an fd, and could be a bit faster, so let's make use of
>     it, if it is available.
> 
> Oct 30 13:08:37 fedora-rawhide-systemd-virt kernel: EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
> Oct 30 13:08:38 fedora-rawhide-systemd-virt systemd[1]: Switching root.
> Oct 30 13:08:38 fedora-rawhide-systemd-virt systemd-journal[109]: Journal stopped
> ^^^^
> Hangs here for a while with no output.
> vvvv
> Oct 30 13:09:44 fedora-rawhide-systemd-virt systemd-journal[279]: Runtime journal is using 8.0M (max allowed 100.0M, trying to leave 150.1M free of 992.7M available → current limit 100.0M).
> Oct 30 13:09:44 fedora-rawhide-systemd-virt systemd-journal[279]: Runtime journal is using 8.0M (max allowed 100.0M, trying to leave 150.1M free of 992.7M available → current limit 100.0M).
> Oct 30 13:09:44 fedora-rawhide-systemd-virt systemd-journald[109]: Received SIGTERM from PID 1 (systemd).
> <snip a lot of selinux related stuff>
> Oct 30 13:09:44 fedora-rawhide-systemd-virt kernel: random: nonblocking pool is initialized
> 
> Is anyone else running into this?

This could be due to the blocking nature of getrandom() if little
entropy is available. The call waits by default until the pool is
initialized before returning, which is probably what your system is
waiting on.

I wish there was a way how we could use getrandom() in a way like
/dev/urandom, where we can pull out the non-initialized data
anyway. In absence of that we can just fallback to /dev/urandom on
EAGAIN I guess, and always pass GRND_NONBLOCK.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list