Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kernel 4.16: random crng hangs boot; symptom: wpa_supplicant
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Sun May 27, 2018 12:22 pm    Post subject: kernel 4.16: random crng hangs boot; symptom: wpa_supplicant Reply with quote

Hi all,

I upgraded kernel from 4.14.15 to 4.16.12. All fine but wpa_supplicant. It hangs between 20~70 seconds on first startup at boot (runlevel default). See pastebin for complete log. Hang happens between these two lines: (delay here is 35 seconds)

snipped of log:
1527422625.852320: wlp1s0: Setting scan request: 0.100000 sec
1527422700.196846: ENGINE: Loading dynamic engine

/etc/conf.d/wpa_supplicant:
# conf.d file for wpa_supplicant

# uncomment this if wpa_supplicant starts up before your network interface
# is ready and it causes issues
# rc_want="dev-settle"

# Please check man 8 wpa_supplicant for more information about the options
# wpa_supplicant accepts.
#
wpa_supplicant_args="-dd -t -f /tmp/wpa_foo.log"

/etc/wpa_supplicant/wpa_supplicant.conf:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

network={
   ssid="hmth"
   scan_ssid=1
   key_mgmt=WPA-PSK
   psk=<secret>
}

network={
   ssid="WLAN-573772"
   scan_ssid=1
   key_mgmt=WPA-PSK
   psk=<secret>
}
}

Anyone any ideas?
_________________
hear hear


Last edited by geki on Mon May 28, 2018 7:30 am; edited 1 time in total
Back to top
View user's profile Send private message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Mon May 28, 2018 7:28 am    Post subject: kernel 4.16.12: random crng hangs boot process Reply with quote

wpa_supplicant is just the symptom. AFAIU it currently, the kernel driver random hangs seeding /dev/random (and the like?) until dmesg message "random: crng init done" appears[0]. To solve this, one should merge sys-apps/rng-tools and add rngd to sysinit boot level to utilize hardware rng. eudev and others need it, too, though they do not hang the boot process. Though, my sandybridge cpus do not have the rdrand feature. There seems to be some sandybridge cpus without that hardware rng feature. :?

You see something like this:
Code:
# dmesg |grep random
[    0.988144] random: fast init done
[    1.670544] random: dd: uninitialized urandom read (512 bytes read)
[    1.675143] random: mktemp: uninitialized urandom read (10 bytes read)
[    2.415934] random: salt-master: uninitialized urandom read (32 bytes read)
[   61.559274] urandom_read: 1 callbacks suppressed
[   61.559276] random: ddclient: uninitialized urandom read (4 bytes read)
[  120.910490] random: apache2: uninitialized urandom read (8 bytes read)
[  120.910505] random: apache2: uninitialized urandom read (8 bytes read)
[  120.910513] random: apache2: uninitialized urandom read (8 bytes read)
[  121.163689] random: crng init done
[  121.163692] random: 2 urandom warning(s) missed due to ratelimiting

Any ideas? I will dig further... A ha, just found [1]. So, I have to be security concerned but fixes hang for old cpus without hardware rng, it seems.

Good fix is [0]. Enable your specific hardware rng with rngd, not CAAM. Bad fix is revert [1].


[0] https://www.toradex.com/community/questions/18861/random-number-generator-hangs-for-a-long-time.html
[1] https://unix.stackexchange.com/questions/442698/when-i-log-in-it-hangs-until-crng-init-done
_________________
hear hear
Back to top
View user's profile Send private message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Mon May 28, 2018 4:48 pm    Post subject: Reply with quote

Until kernel behaves again I must apply this patch:
http://geki.selfhost.eu/hacks/linux-4.16.12-undo_random_fix_crng_ready_test.patch

If anyone got any ideas how to make the kernel behave properly, you are welcome! :o
_________________
hear hear
Back to top
View user's profile Send private message
IsisTheDamned
n00b
n00b


Joined: 29 Sep 2004
Posts: 16

PostPosted: Mon Jul 09, 2018 10:36 am    Post subject: Reply with quote

had the same issue on my machine w/ 4.14.52

I noticed that hammering your keyboard gets you started faster :)

fixed the problem by installing sys-apps/rng-tools and adding rngd to the default runlevel like this:

Code:

# emerge sys-apps/rng-tools
# rc-update add rngd default
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5934

PostPosted: Mon Jul 09, 2018 6:53 pm    Post subject: Reply with quote

I had a similar delay recently with using lightdm, installing haveged is another option. :wink:
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
Back to top
View user's profile Send private message
giro83
n00b
n00b


Joined: 24 Aug 2019
Posts: 2

PostPosted: Sat Aug 24, 2019 10:46 pm    Post subject: Reply with quote

IsisTheDamned wrote:
had the same issue on my machine w/ 4.14.52

I noticed that hammering your keyboard gets you started faster :)

fixed the problem by installing sys-apps/rng-tools and adding rngd to the default runlevel like this:

Code:

# emerge sys-apps/rng-tools
# rc-update add rngd default


I had the same issue, and your suggestion fixed it. But adding the service to 'default' was not sufficient, as it would not start in time. I had to add it to 'boot' instead.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3922
Location: Hamburg

PostPosted: Sun Aug 25, 2019 1:25 pm    Post subject: Reply with quote

giro83 wrote:
I had to add it to 'boot' instead.
Yep, that's advised. BTW there're few more rng helper packages:
Code:
timer_entropyd audio-entropyd haveged
worth to be used.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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