Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 703826 - genkernel 4.0.1 dos not integrate initramfs
Summary: genkernel 4.0.1 dos not integrate initramfs
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2019-12-26 10:53 UTC by cazzantonio
Modified: 2019-12-31 09:10 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cazzantonio 2019-12-26 10:53:18 UTC
I use genkernel to build and integrate the initramfs in the kernel image to boot a stub efi kernel.

genkernel --keymap --btrfs --no-ssh --disklabel --luks --gpg --integrated-initramfs --postclear --no-ramdisk-modules initramfs

while genkernel 3.5.3.3 worked, the new 4.0.1 fails to integrate the initramfs.
Specifically the kernel .config still has an empty CONFIG_INITRAMFS_SOURCE, which should instead point to the cpio uncompressed initramfs image generated by genkernel.
CONFIG_INITRAMFS_SOURCE="/var/tmp/genkernel/initramfs-5.3.10-gentoo.cpio"
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-26 15:54:27 UTC
If you really just run

> genkernel --keymap --btrfs --no-ssh --disklabel --luks --gpg --integrated-initramfs --postclear --no-ramdisk-modules initramfs

this cannot work because you told genkernel to only build initramfs.

But because you want your initramfs integrated into kernel, kernel must be (re-)build... so please retry with "all".
Comment 2 cazzantonio 2019-12-28 19:29:36 UTC
I understand what you say but this isn't the behaviour of genkernel so far.
genkernel-3.5.3.3, when invoked with the initramfs option, did recompile the kernel modifying the CONFIG_INITRAMFS_SOURCE entry and adding the generated initramfs.

Also, what you describe doesn't seem the intended behaviour of genkernel-4.0.1.
Here is what genkernel 4.0.1 prints as an output:

* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
*         >> Appending base_layout cpio data ...
*         >> Appending auxilary cpio data ...
*         >> Appending blkid cpio data ...
*         >> Appending btrfs cpio data ...
*         >> Appending busybox cpio data ...
*         >> Appending gpg cpio data ...
*         >> Appending luks cpio data ...
*         >> Appending modprobed cpio data ...
*         >> Not copying modules due to --no-ramdisk-modules ...
*         >> Appending linker cpio data ...
*         >> Deduping cpio ...
*         >> Pre-generating initramfs' /etc/ld.so.cache ...
*         >> --integrated-initramfs is set; Setting CONFIG_INITRAMFS_* options ...
*         >> Running 'make olddefconfig' due to changed kernel options ...

*         >> Compiling 5.4.6-gentoo bzImage ...
* 
* You will find the initramfs in '/boot/initramfs-5.4.6-gentoo.img'.

* WARNING... WARNING... WARNING...
* Additional kernel parameters that *may* be required to boot properly:
* - Add "dobtrfs" for Btrfs device scanning support
* 
* With support for several ext* filesystems available, it may be needed to
* add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters.

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
* 
* Make sure you have the latest ~arch genkernel before reporting bugs.

As you can see genkernel claims he's modifying CONFIG_INITRAMFS entry and recompiling the kernel to integrate the image, however in the .config there is still
CONFIG_INITRAMFS_SOURCE=""
and the recompiled kernel does not include the initramfs.

This is the expected behaviour inferred from the previous genkernel versions and is in complete disagreement with your previous statement.


P.S.
I suspect there are also other severe bugs in this release, even if off topic here I will mention them just in case. It seems that even if I integrate the generated cpio initramfs file, in /var/tmp/genkernel/, it still fails to load my system because something is missing. I suppose it's luks, because it fails to find my encripted root partition. I will not however investigate this further until the previous bug is fixed, so eventually I'll file another bug report if needed.
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-28 21:33:12 UTC
It works for me:

I run

> # genkernel --kernel-append-localversion=-integrated-test1 --no-clean --integrated-initramfs all

> # ls -lv /boot
> [...]
> -rw-r--r-- 1 root root  4853304 Nov 24 17:45 initramfs-4.9.202-gentoo-x86_64.img
> -rw-r--r-- 1 root root  4617152 Dec 16 23:34 initramfs-4.9.203-gentoo-x86_64.img
> lrwxrwxrwx 1 root root       46 Dec 28 22:12 kernel -> vmlinuz-4.9.203-gentoo-x86_64-integrated-test1
> lrwxrwxrwx 1 root root       29 Dec 28 22:13 kernel.failsafe -> vmlinuz-4.9.203-gentoo-x86_64
> lrwxrwxrwx 1 root root       50 Dec 28 22:12 kernel.old -> vmlinuz-4.9.203-gentoo-x86_64-integrated-test1.old
> drwx------ 2 root root    12288 Jan  2  2013 lost+found
> -rw-r--r-- 1 root root  5501424 Nov 19 19:36 vmlinuz-4.9.202-gentoo-x86_64
> -rw-r--r-- 1 root root  5661168 Nov 27 14:06 vmlinuz-4.9.203-gentoo-x86_64
> -rw-r--r-- 1 root root 15270384 Dec 28 22:12 vmlinuz-4.9.203-gentoo-x86_64-integrated-test1

A LUKS-encrypted system booted from that kernel with integrated initramfs like expected:

> # dmesg
> [    0.000000] Linux version 4.9.203-gentoo-x86_64-integrated-test1 (root@vm-genkernel-test) (gcc version 9.2.0 (Gentoo 9.2.0-r2 p3) ) #3 SMP PREEMPT Sat Dec 28 22:11:58 CET 2019
> [    0.000000] Command line: BOOT_IMAGE=/kernel ssh domdadm dolvm video=1024x768 crypt_root=UUID=6edcbfa4-bc2b-4e22-9893-9f682f6fd15f root=UUID=06e3ba17-c77a-4d13-bfb0-2cc0845fde5c rootfstype=ext4 dosshd gk.sshd.wait=10 gk.log.keep=/var/log/genkernel-boot.log init=/sbin/openrc-init
> [...]


> # cat /var/log/genkernel-boot.log
> [2019-12-28 22:14:23] Executed: '/bin/busybox --install -s'
> [2019-12-28 22:14:23] [OK] Genkernel 4.0.1 (2019-12-28 21:11:41 UTC). Linux kernel 4.9.203-gentoo-x86_64-integrated-test1
> [2019-12-28 22:14:23] Executed: 'rm /linuxrc'
> [...]
> [2019-12-28 22:14:25] Executed: 'raidautorun /dev/md126'
> [2019-12-28 22:14:25] Executed: 'cryptsetup isLuks /dev/md126'
> [2019-12-28 22:15:21] Executed: 'cryptsetup luksOpen /dev/md126 root'
> [2019-12-28 22:15:21] Executed: 'touch /tmp/ROOT.opened'
> [...]
> [2019-12-28 22:15:21] [OK] Root device detected as /dev/dm-4!
> [...]


> # grep -F _INITRAMFS $KERNEL_OUTPUTDIR/.config
> CONFIG_INITRAMFS_SOURCE="/var/tmp/genkernel/initramfs-x86_64-4.9.203-gentoo-x86_64-integrated-test1.cpio"

Note:
The saved configuration in /etc/kernels won't get updated for the integrated initramfs.

It's also crucial that you run genkernel with action "all". If you call action "initramfs" only or compiled kernel on your own and just want to use genkernel's initramfs you are on your own because we expect a valid kernel created by genkernel with --integrated-initramfs option turned set.
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-28 23:17:06 UTC
OK, I can at least acknowledge one problem: A bug in current released v4.0.1 causes CONFIG_INITRAMFS_SOURCE to be empty sometimes. Will push v4.0.2 shortly.
Comment 5 Larry the Git Cow gentoo-dev 2019-12-29 04:03:56 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=53161dfada35f9d5a766a74413341c69cde0a67a

commit 53161dfada35f9d5a766a74413341c69cde0a67a
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-12-29 03:57:58 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-12-29 03:57:58 +0000

    gen_initramfs.sh: create_initramfs(): Fix integrated initramfs creation
    
    - CONFIG_INITRAMFS_SOURCE value must be quoted.
    
    - CONFIG_INITRAMFS_COMPRESSION_* is only available in >=linux-4.10.
    
    - Use CONFIG_RD_* for <linux-4.10. But make sure that only option for
      selected compression type is set and every other type is disabled.
      Otherwise, last set compression type would be used all the time,
      see $KERNEL_DIR/usr/Makefile for details.
    
    - Add sanity check which checks for integrated initramfs.
    
    Bug: https://bugs.gentoo.org/703826
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_initramfs.sh | 21 +++++++++++++++++++--
 genkernel        |  7 +++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-29 04:04:34 UTC
Please test live ebuild.
Comment 7 cazzantonio 2019-12-31 09:10:21 UTC
Live version works perfectly for me