Welcome! Log In Create A New Profile

Advanced

Ox820 / Kernel 4.14.x: Entropy pool filled by USB activity? Delay on boot with SATA...

Posted by christian 
Hello all,
I have switched the rootfs on my STG-212 Medion NAS with Kernel 4.14.x from USB-Stick to SATA-SSD.
Aim is to increase performance of Nextcloud as much as possible and it looks very good :-)

But after the change I immediately saw a big delay during boot caused by "random".

Please have a look on the timestamps from my boot log...

Boot from USB-Stick:
Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.176-oxnas-tld-1 (root@tldDebian) (gcc version 8.3.0 (Debian 8.3.0-6)) #2 SMP PREEMPT Sun Apr 26 15:24:37 PDT 2020
...
Begin: Loading essential drivers ... done.
[    6.088284] scsi 1:0:0:0: Direct-Access     SanDisk' Cruzer Fit       1.00 PQ: 0 ANSI: 6
[    6.101703] sd 1:0:0:0: [sdb] 30031872 512-byte logical blocks: (15.4 GB/14.3 GiB)
[    6.112340] sd 1:0:0:0: [sdb] Write Protect is off
[    6.120133] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    6.141416]  sdb: sdb1
[    6.160645] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[    6.180753] random: fast init done
...
[   23.691514] random: crng init done

Boot from SATA-SSD:
Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.180-oxnas-tld-1 (root@tldDebian) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP PREEMPT Wed May 13 02:38:34 PDT 2020
...
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Will now check root file system ... fsck from util-linux 2.33.1
[/sbin/fsck.ext3 (1) -- /dev/sda1] fsck.ext3 -a -C0 /dev/sda1 
[   15.990558] random: fast init done
...
[....] Starting Apache httpd web server: apache2[   30.148078] random: mktemp: uninitialized urandom read (10 bytes read)
[   30.209710] random: mktemp: uninitialized urandom read (10 bytes read)
[   30.279390] random: apache2: uninitialized urandom read (8 bytes read)
[  265.597214] random: crng init done
[  265.600616] random: 6 urandom warning(s) missed due to ratelimiting

Two times "random" is delayed massively.

I read inside several threads, that "random" (maybe) gets it input data for entropy pool by USB activity...!

Now my questions:
- Is it setup in Ox820-kernel-4.14.x as I read in the thread and missing USB-Stick slows down my boot sequence?
- Do I have a chance to choose a different data input source for "random"?
- Installation of "haveged" doesn't really seem to fix it - does anybody have a solution working on the Ox820 device?

Best regards,
Christian
Re: Ox820 / Kernel 4.14.x: Entropy pool filled by USB activity? Delay on boot with SATA...
May 18, 2020 05:14PM
Christian,


> Aim is to increase performance of Nextcloud as
> much as possible and it looks very good :-)

Cool!

>
> But after the change I immediately saw a big delay
> during boot caused by "random".
>
> I read inside several threads, that
> "random" (maybe) gets it input data for
> entropy pool by USB activity...!

That's true.

>
> Now my questions:
> - Is it setup in Ox820-kernel-4.14.x as I read in
> the thread and missing USB-Stick slows down my
> boot sequence?

Yes it does. Especially when you use SSD as boot drive. SSD does not have moving parts, so the random is very limited. If this were an HDD then it would behave the same way as USB.

> - Do I have a chance to choose a different data
> input source for "random"?

No, we don't have any control over this.

> - Installation of "haveged" doesn't really
> seem to fix it - does anybody have a solution
> working on the Ox820 device?

haveged should have fixed it. Check to see if you all all necessary steps done to activate it during boot.

This random is no longer an issue in the newer kernel (5.6.x). We are running 4.14.x with Oxnas boxes, so workaround like haveged must be used. Once we move on to kernel 5.x, I hope it will no longer be an issue.

Also, it is not really a bug. So delay in booting 4.14 is not that big a deal if you don't restart the box too often.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Havaged worked for me on a Kirkwood box booting from SSD. I think it was simple to install, IIRC it just worked.
Hello guys,
many thanks for your replys!

Just to point it out:
Random has in summary a startdelay of 245 seconds.
~10 seconds at first init
~ 235 seconds at crng init done

Yes the Nextcloud is setup for 24/7, therefore the bootdelay is not as worse as for a machine which is always shut down after work.
I just run into this issue again when I did the Kernel update to 4.14.180 yesterday.

What about plugging an additional USB-Stick parallel and mount it to a Folder like "/media/usb"?
Does initializing and mounting of the Stick even create enough random data input to speed up random intialization?
I will give this a try today...!?!

Best regards
Christian
Re: Ox820 / Kernel 4.14.x: Entropy pool filled by USB activity? Delay on boot with SATA...
May 19, 2020 01:16AM
christian,

> What about plugging an additional USB-Stick
> parallel and mount it to a Folder like
> "/media/usb"?
> Does initializing and mounting of the Stick even
> create enough random data input to speed up random
> intialization?

Yes it will.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
O.k. - just a quick response regarding "Dummy USB-Stick".

Thanks bodhi - it really speeds up the booting sequence.

Stick is just plugged into USB and gets mounted by fstab entry to "/media/USB/".

Now the delay for random is:
~ 0 seconds at first init
~ 35 seconds at crng init done

That makes it tolerable.

After boot/development-phase I can unmount the stick and unplug it in run mode.

Now I'll wait with tension for the upcomming release of kernel-5.6.x :-)

Best regards,
Christian
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: