I have a new gentoo install and the only boot step that takes time is the one that says:

Trying to unpack rootfs image as initramfs...

It does take around 10 second at boot time. I tried to read on initramfs to figure out why does this step takes longer, but it still all very cryptic to me. I do have an initramfs in my boot partition:

~ $ cd /boot/
malcolm@Host-002 /boot $ ls
grub                                       lost+found
initramfs-genkernel-x86_64-4.12.12-gentoo  System.map-genkernel-x86_64-4.12.12-gentoo

grub2-mkconfig -o /boot/grub/grub.cfg did found the initramfs-genkernel and it is in my /boot/grub/grub.cfg:

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuent$
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
    insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --$
          search --no-floppy --fs-uuid --set=root 80e1a69b-be52-4845-a6c7-4f7e8353bc1e
    echo    'Loading Linux x86_64-4.12.12-gentoo ...'
        linux   /kernel-genkernel-x86_64-4.12.12-gentoo root=UUID=2eb28949-50a7-4178-9d0a-309$
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-genkernel-x86_64-4.12.12-gentoo

I am confused as to what unpacking roots image as initramfs means. Since initramfs is needed to load the tools needed to load the system, I thought my system would unpack the initramfs-genkernel on my boot partition. What is this rootfs image ?

I know it is all very confused as a question, but so am I, and any hint on how to make it better will be greatly appreciated.


/var/log/dmesg around the actual point wth the initramfs

[    0.275512] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7 window]
[    0.275514] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff window]
[    0.275515] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[    0.275516] pci_bus 0000:00: resource 7 [mem 0xd0000000-0xfebfffff window]
[    0.275517] pci_bus 0000:00: resource 8 [mem 0xfed40000-0xfed4bfff window]
[    0.275518] pci_bus 0000:03: resource 0 [io  0x2000-0x2fff]
[    0.275519] pci_bus 0000:03: resource 1 [mem 0xd0100000-0xd02fffff]
[    0.275520] pci_bus 0000:03: resource 2 [mem 0xd0300000-0xd04fffff 64bit pref]
[    0.275521] pci_bus 0000:04: resource 1 [mem 0xf1000000-0xf10fffff]
[    0.275611] NET: Registered protocol family 2
[    0.275839] TCP established hash table entries: 65536 (order: 7, 524288 bytes)
[    0.276037] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
[    0.276238] TCP: Hash tables configured (established 65536 bind 65536)
[    0.276353] UDP hash table entries: 4096 (order: 5, 131072 bytes)
[    0.276455] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
[    0.276597] NET: Registered protocol family 1
[    0.276691] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.277288] PCI: CLS 64 bytes, default 64
[    0.277324] Trying to unpack rootfs image as initramfs...
[    5.396096] Freeing initrd memory: 38272K
[    5.396183] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    5.396270] software IO TLB [mem 0xba0af000-0xbe0af000] (64MB) mapped at [ffff918efa0af000$
[    5.396465] RAPL PMU: API unit is 2^-32 Joules, 4 fixed counters, 655360 ms ovfl timer
[    5.396587] RAPL PMU: hw unit of domain pp0-core 2^-14 Joules
[    5.396670] RAPL PMU: hw unit of domain package 2^-14 Joules
[    5.396752] RAPL PMU: hw unit of domain dram 2^-14 Joules
[    5.396835] RAPL PMU: hw unit of domain pp1-gpu 2^-14 Joules
[    5.397284] audit: initializing netlink subsys (disabled)
[    5.397435] audit: type=2000 audit(1513038122.396:1): state=initialized audit_enabled=0 re$
[    5.397762] Initialise system trusted keyrings
[    5.397883] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    5.398161] SELinux:  Registering netfilter hooks
[    5.398739] Key type asymmetric registered

Even though the log says 5 sec, the actual time I see on boot and that i outputted is around 10 seconds :/

  • initramfs-genkernel-x86_64-4.12.12-gentoo contains your rootfs image. The file contains a compressed archive that is unpacked into a ramfs, which is then used as a temporary root filesystem. The idea is that this filesystem contains the necessary drivers to be able to properly boot the system. I don't know why it is slow. Maybe it just seems slow, if the computer goes on doing something else without printing a message. – Johan Myréen Dec 23 '17 at 14:49
  • Thanks that already makes it clearer to me. Hum could that explain the difference in time, where it takes more than 10 sec while booting, but in the log file it says 5 seconds ? I couldn't explain that. – Malcolm Dec 23 '17 at 15:06
  • 1
    What does the log say? There may be differences in what is considered "booting". For example, the kernel might think it's the time from when the kernel starts until it has started the first user space program, init. – Johan Myréen Dec 23 '17 at 15:24
  • @Malcolm How do you measure 10 seconds? With a stopwatch which is pressed start at pressing the power on button of a computer? Then the remaining 5 seconds are time for the BIOS/UEFI to initialize (hardware). schd.ws/hosted_files/osseu17/84/… gives details about stuff that happens at UEFI boot. – Pro Backup Dec 23 '17 at 16:56
  • The times are written on the left of each operation while booting, is how I measure it. I am Botting in legacy mode and not in UEFI. Could that be it ? – Malcolm Dec 23 '17 at 17:18

Unpacking an archive depend on two things (imho):

  1. algorithm in use
  2. size of the files in the archive

Hence in my opinion your init ram disk is too big.

In order to speed-up the process, you can try to minimize the size and play with the various supported archiving algorithms to see what works best for your setup.

For me it is bare minimum kernel compressed with LZ4 without init ramdisk. With this I've reached 0.9s to from grub to sysv init on hp envy 14 (amd apu on 1.8GHZ) If you are interested, in optimizing your process, you can find a great guide to minimizing the kernel and the init ram disk size here https://www.dotslashlinux.com/post/the-linux-kernel-configuration-guide-part-1-introduction/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.