Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problems with urandom, haveged, and rng-tools
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Nov 07, 2021 4:37 pm    Post subject: Problems with urandom, haveged, and rng-tools Reply with quote

I'm splitting this off from [solved] ACPI error, how to fix?
because it really is a separate topic. CPU is an AMD A8-7600 APU on a Gigabyte F2A88X-D3HP motherboard.

Urandom is used before initialization. Specifically udevd is using it.
Code:
# dmesg|grep random
[    0.000000] random: get_random_u32 called from bsp_init_amd+0x173/0x218 with crng_init=0
[    3.874664] random: fast init done
[    4.143378] random: udevd: uninitialized urandom read (16 bytes read)
[    4.143867] random: udevd: uninitialized urandom read (16 bytes read)
[    4.221362] random: udevd: uninitialized urandom read (16 bytes read)
[    5.850624] urandom_read: 2 callbacks suppressed
[    5.850626] random: dd: uninitialized urandom read (512 bytes read)
[    5.856097] random: mktemp: uninitialized urandom read (10 bytes read)
[    7.289861] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[    7.293168] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[    7.424440] random: xdm: uninitialized urandom read (40 bytes read)
[    9.772066] random: crng init done

I've tried haveged in both runlevel boot and default and rng-tools in runlevel boot (not at the same time).
Code:
 # dmesg|grep random
[    0.000000] random: get_random_u32 called from bsp_init_amd+0x173/0x218 with crng_init=0
[    3.874664] random: fast init done
[    4.143378] random: udevd: uninitialized urandom read (16 bytes read)
[    4.143867] random: udevd: uninitialized urandom read (16 bytes read)
[    4.221362] random: udevd: uninitialized urandom read (16 bytes read)
[    5.850624] urandom_read: 2 callbacks suppressed
[    5.850626] random: dd: uninitialized urandom read (512 bytes read)
[    5.856097] random: mktemp: uninitialized urandom read (10 bytes read)
[    7.289861] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[    7.293168] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[    7.424440] random: xdm: uninitialized urandom read (40 bytes read)
[    9.772066] random: crng init done
Full dmesg at http://dpaste.com/3KD3AT6V3
kernel config at http://dpaste.com/3KD3AT6V3
No initramfs, latest stable kernel 5.10.76
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3925
Location: Hamburg

PostPosted: Sun Nov 07, 2021 4:46 pm    Post subject: Reply with quote

And what is your question ?

Those messages are interesting for kernel devs and volunteers who like to improve kernel boot phase.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6103
Location: Dallas area

PostPosted: Sun Nov 07, 2021 4:51 pm    Post subject: Reply with quote

for rng-tools I pass it the "-q" option via /etc/conf.d/rngd

Code:
$ tail -5  /etc/conf.d/rngd


# Any extra arguments for rngd
#
EXTRA_ARGS="-q"

_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Nov 07, 2021 6:10 pm    Post subject: Reply with quote

Added EXTRA_ARGS
Code:
~ # dmesg|grep random
[    0.000000] random: get_random_u32 called from bsp_init_amd+0x173/0x218 with crng_init=0
[    3.865616] random: fast init done
[    4.123751] random: udevd: uninitialized urandom read (16 bytes read)
[    4.124233] random: udevd: uninitialized urandom read (16 bytes read)
[    4.242734] random: udevd: uninitialized urandom read (16 bytes read)
[    5.939040] urandom_read: 2 callbacks suppressed
[    5.939051] random: mktemp: uninitialized urandom read (10 bytes read)
[    5.942990] random: dd: uninitialized urandom read (512 bytes read)
[    7.394760] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[    7.397935] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[    7.526383] random: xdm: uninitialized urandom read (40 bytes read)
[    9.901947] random: crng init done

Code:
 # zgrep RANDOM /proc/config.gz
# CONFIG_SLAB_FREELIST_RANDOM is not set
CONFIG_ARCH_RANDOM=y
# CONFIG_RANDOMIZE_BASE is not set
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_HW_RANDOM_INTEL=y
CONFIG_HW_RANDOM_AMD=y
# CONFIG_HW_RANDOM_BA431 is not set
CONFIG_HW_RANDOM_VIA=y
# CONFIG_HW_RANDOM_XIPHERA is not set
CONFIG_RANDOM_TRUST_CPU=y
CONFIG_RANDOM_TRUST_BOOTLOADER=y
# CONFIG_RANDOM32_SELFTEST is not set
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
I think I should drop that INTEL & VIA stuff. What other changes?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6103
Location: Dallas area

PostPosted: Sun Nov 07, 2021 6:26 pm    Post subject: Reply with quote

Code:
$ grep RANDOM /usr/src/linux/.config
# CONFIG_SLAB_FREELIST_RANDOM is not set
CONFIG_ARCH_RANDOM=y
CONFIG_RANDOMIZE_BASE=y
CONFIG_RANDOMIZE_MEMORY=y
CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING=0x0
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
# CONFIG_HW_RANDOM_INTEL is not set
# CONFIG_HW_RANDOM_AMD is not set
# CONFIG_HW_RANDOM_BA431 is not set
# CONFIG_HW_RANDOM_VIA is not set
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_HW_RANDOM_XIPHERA is not set
CONFIG_HW_RANDOM_TPM=y
CONFIG_RANDOM_TRUST_CPU=y
CONFIG_RANDOM_TRUST_BOOTLOADER=y
# CONFIG_RANDOM32_SELFTEST is not set
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set


The MB I use claims to have a tpm unit, so that's why I have that flag enabled.

Edit to add: use flags that I use on rng-tools
Code:
$ emerge -pv rng-tools

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] sys-apps/rng-tools-6.14-r2::gentoo [6.14-r1::gentoo] USE="jitterentropy nistbeacon pkcs11 -rtlsdr (-selinux)"

_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sun Nov 07, 2021 9:55 pm    Post subject: Reply with quote

toralf wrote:
And what is your question ?

This is Tony0945's crng:
Code:
[    9.772066] random: crng init done

And this is my crng:
Code:
[    0.163516] random: crng done (trusting CPU's manufacturer)

9.7 seconds is too long. The question is: how can Tony0945 lower his crng init time?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6103
Location: Dallas area

PostPosted: Sun Nov 07, 2021 10:43 pm    Post subject: Reply with quote

Probably entropy related, if it gets low enough the system "hangs" until sufficient entropy is created.

If you think entropy might be the problem then doing something like hitting random keys on the keyboard or moving the mouse (a lot) while booting, will make it boot faster.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum