Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 738378 - sys-kernel/genkernel-4.1.0: long boot process with initramfs
Summary: sys-kernel/genkernel-4.1.0: long boot process with initramfs
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-21 11:22 UTC by Karlson2k
Modified: 2020-08-24 10:28 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
genkernel-4.1.0-r2 boot log (genkernel-boot.log,6.39 KB, text/plain)
2020-08-21 16:51 UTC, Karlson2k
Details
genkernel-4.0.10 boot log (genkernel-boot.log,5.90 KB, text/plain)
2020-08-21 17:00 UTC, Karlson2k
Details
genkernel-4.0.10 boot log with nanoseconds (genkernel-boot-4.0.10-nanosec.log,6.67 KB, text/plain)
2020-08-24 09:02 UTC, Karlson2k
Details
genkernel-4.1.0-r2 boot log with nanoseconds (genkernel-boot-4.1.0-nanosec.log,7.22 KB, text/plain)
2020-08-24 09:03 UTC, Karlson2k
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karlson2k 2020-08-21 11:22:20 UTC
Boot process becomes much longer after upgrading from 4.0.10 to 4.1.0-r2.
I suspect that it happens due to unconditional inclusion of eudev (and devicemanager) to cpio archive.

genkernel-4.0.10 initramfs:
 Startup finished in 2.790s (firmware) + 405ms (loader) + 1.960s (kernel) + 1.506s (userspace) = 6.663s.

genkernel-4.1.0-r2 initramfs:
 Startup finished in 2.791s (firmware) + 430ms (loader) + 2.975s (kernel) + 1.587s (userspace) = 7.784s.

Kernel boot time is increased by 50%.

initramfs became 2.5 times larger:
-rwxr-xr-x 1 root root  4585135 Jul 31 12:27 initramfs-5.7.11-gentoo.img
-rwxr-xr-x 1 root root  4585151 Aug  1 17:27 initramfs-5.7.12-gentoo.img
-rwxr-xr-x 1 root root  4585206 Aug  6 21:25 initramfs-5.7.13-gentoo.img
-rwxr-xr-x 1 root root  4585206 Aug 10 11:00 initramfs-5.7.14-gentoo.img
-rwxr-xr-x 1 root root  4588854 Aug 14 14:28 initramfs-5.7.15-gentoo.img
-rwxr-xr-x 1 root root 11617525 Aug 21 11:56 initramfs-5.7.16-gentoo.img

For me it doesn't look like improvement.
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-21 14:26:07 UTC
Set gk.log.keep=yes command-line argument and reboot. This will create /genkernel-boot.log. Please attach this file to this bug.
Comment 2 Karlson2k 2020-08-21 16:51:08 UTC
Created attachment 655972 [details]
genkernel-4.1.0-r2 boot log

rootfs location was found on first step. All modprobes and udevd are not required to boot.
Comment 3 Karlson2k 2020-08-21 17:00:41 UTC
Created attachment 655976 [details]
genkernel-4.0.10 boot log
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-21 17:38:40 UTC
I must admit that I am not sure if I can take this bug report seriously. You are complaining about 1 additional second your system now spends in initramfs. 

Sorry, but I am not going to spend any time on this issue: udevd in general helps systemd users and for everyone else it will help to avoid race conditions. Don't get me wrong here but if you have a specific system which can't have such problems and that second is critical for you, maybe genkernel isn't the tool for you.
Comment 5 Larry the Git Cow gentoo-dev 2020-08-21 18:48:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=6bc4264df660ff6f639cdd9625f5f0da20418e25

commit 6bc4264df660ff6f639cdd9625f5f0da20418e25
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-08-21 18:44:32 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-08-21 18:44:32 +0000

    defaults/initrd.scripts: log_msg(): Log milliseconds
    
    This will allow us to see more in detail where initramfs spent time.
    
    Bug: https://bugs.gentoo.org/738378
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 defaults/initrd.scripts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-21 18:49:46 UTC
I am curious, maybe you want to test again with the patch from previous post (which can also be applied against genkernel-4.0.10) so we get a little more insight? It's probably the udevd start itself but who knows...
Comment 7 Karlson2k 2020-08-24 08:41:57 UTC
(In reply to Thomas Deutschmann from comment #4)
> I must admit that I am not sure if I can take this bug report seriously. You
> are complaining about 1 additional second your system now spends in
> initramfs. 
> 
> Sorry, but I am not going to spend any time on this issue: udevd in general
> helps systemd users and for everyone else it will help to avoid race
> conditions. Don't get me wrong here but if you have a specific system which
> can't have such problems and that second is critical for you, maybe
> genkernel isn't the tool for you.

My Gentoo installations are based on systemd, but I don't need udev in initramfs. systemd does its job just well, after mounting root FS.
genkernel 4.0.10 doesn't add eudev to initramfs and I had no problem with it.

I use Gentoo for HTPC, boot time is important. Currently it takes ~ 7 seconds from powering on to Kodi screen.
Last kernel optimisation saved 0.4 seconds (2.340 -> 1.960). Additional 50% of kernel boot time is not improvement for me.
Mandatory eudev in initramfs doesn't give me any improvement, I just don't need it.
Larger initramfs archive is just a waste of my (limited) disk space.

I will test with nanoseconds patch.
Comment 8 Karlson2k 2020-08-24 09:02:53 UTC
Created attachment 656414 [details]
genkernel-4.0.10 boot log with nanoseconds
Comment 9 Karlson2k 2020-08-24 09:03:29 UTC
Created attachment 656416 [details]
genkernel-4.1.0-r2 boot log with nanoseconds
Comment 10 Karlson2k 2020-08-24 09:26:01 UTC
Booting with genkernel 4.0.10 initramfs takes 0.29 second, 4.1.0-r2 initramfs takes 1.18 second. 
Version 4.1.0 doesn't bring any improvements.
udev was optional for 4.0.10. Why not not to make it optional for 4.1.0 as well?
Comment 11 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-24 10:05:55 UTC
Thank you for the new logs.

However, we will not change anything. And you are also mixing genkernel-next with genkernel: We never supported both in genkernel and we won't start doing this. Our maintenance resources are limited -- we cannot double test amount just to support two device managers because of 1s.
Comment 12 Karlson2k 2020-08-24 10:16:55 UTC
(In reply to Thomas Deutschmann from comment #11)
> Thank you for the new logs.
> 
> However, we will not change anything. And you are also mixing genkernel-next
> with genkernel: We never supported both in genkernel and we won't start
> doing this. Our maintenance resources are limited -- we cannot double test
> amount just to support two device managers because of 1s.

I never tried genkernel-next.

I'm referring initramfs generation process.
With genkernel-4.0.10:
* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
*         >> Appending base_layout cpio data ...
*         >> Appending auxilary cpio data ...
*         >> Appending busybox cpio data ...
*         >> Appending blkid cpio data ...
*         >> Appending btrfs cpio data ...
*         >> Appending modprobed cpio data ...
*         >> Appending modules cpio data ...
*         >> Appending linker cpio data ...
*         >> Deduping cpio ...
*         >> Pre-generating initramfs' /etc/ld.so.cache ...
*         >> Compressing cpio data (.lz4) ...

With genkernel-4.1.0:
* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
*         >> Appending base_layout cpio data ...
*         >> Appending eudev cpio data ...
*         >> Appending devicemanager cpio data ...
*         >> Appending auxilary cpio data ...
*         >> Appending busybox cpio data ...
*         >> Appending blkid cpio data ...
*         >> Appending btrfs cpio data ...
*         >> Appending modprobed cpio data ...
*         >> Appending modules cpio data ...
*         >> Appending linker cpio data ...
*         >> Deduping cpio ...
*         >> Pre-generating initramfs' /etc/ld.so.cache ...
*         >> Compressing cpio data (.lz4) ...*

Notice "eudev" and "devicemanager" itmes.
I had an impression that with genkernel 4.0.10 they were optional, depending on configured modules (llvm etc.)
Comment 13 Karlson2k 2020-08-24 10:19:02 UTC
(In reply to Karlson2k from comment #12)

> I had an impression that with genkernel 4.0.10 they were optional, depending
> on configured modules (llvm etc.)

I mean LVM, mdadm and others.
Comment 14 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-24 10:28:26 UTC
This is probably just bad naming: I am using "devicemanager" to add dmsetup which is part of LVM. Prior genkernel-4.1, this was really only built and appended to initramfs if you enabled LVM support (--lvm). Because in udev world, dmsetup is used in most udev rules related to block devices based on devicemapper, we are now appending dmsetup stuff in its own function (https://gitweb.gentoo.org/proj/genkernel.git/tree/gen_initramfs.sh?h=v4.1.0#n181). Full LVM support has additional requirements.