Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 821376 - sys-kernel/genkernel-4.2.5 initrd for LUKS does not find root filesystem
Summary: sys-kernel/genkernel-4.2.5 initrd for LUKS does not find root filesystem
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-02 22:23 UTC by Stefan Trenker
Modified: 2021-11-20 09:28 UTC (History)
1 user (show)

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 Stefan Trenker 2021-11-02 22:23:04 UTC
Since `libcrypt` got moved out of `glibc` to `libxcrypt`, running `genkernel` for me failed to build an initramfs which is able to initialize an LUKS encryptet root filesystem.

This is my Kernel Command Line which stopped working for genkernel-4.2.5:

init=/usr/lib/systemd/systemd dolvm crypt_root=UUID=2cdef804-0332-4d3f-9867-93dee1204ef0 root=/dev/mapper/lvm--vg-root scsi_mod.use_blk_mq=1 root_trim=yes CONSOLE=/dev/tty1 fbcon=font:TER16x32 video=i915drmfb:1920x1200-24@60 systemd.show_status=1 loglevel=5 keymap=de kaslr i915.enable_guc=2

I use systemd-boot to secure boot my system.
Comment 1 Stefan Trenker 2021-11-02 22:35:19 UTC
This is how i call genkernel:

genkernel --kerneldir=/usr/src/linux --loglevel=4 --no-menuconfig --save-config --firmware --microcode=all --virtio --no-clean --no-mrproper --install --oldconfig --ramdisk-modules --no-module-rebuild --makeopts=-j9 --mountboot --lvm --dmraid --e2fsprogs --microcode-initramfs --luks --gpg --busybox --compress-initramfs-type=bzip2 all
Comment 2 Stefan Trenker 2021-11-02 23:04:29 UTC
The last lines on the console show that eudev fails to start. After entering the rescueshell there are no commands available. Not even 'ls' is found.
Comment 3 Thomas Deutschmann gentoo-dev Security 2021-11-15 00:26:49 UTC
Please check that you really started genkernel's initramfs and maybe attach a screenshot/photo showing the genkernel error.

The only problems related to libxcrypt change were build issues, i.e. you were unable to build busybox or dropbear. Never seen any runtime issues caused by this. And the build issues should be fixed in 4.2.5.
Comment 4 Stefan Trenker 2021-11-19 19:32:52 UTC
I made a video from the boot process and replayed it in slow motion. Now i can confirm, that the problem is NOT related to the libcrypt-change.

The kernel is not able to decompress the bzip2 compressed initramdisk.

And that is what i do not understand. 

# zcat /proc/config.gz | grep CONFIG_RD
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y
CONFIG_RD_ZSTD=y

shows that bzip2 compressed initramdisks should be supported. And they are on all my other boxes and vm's. Just on this one laptop it stopped working.

When i use gzip for initramdisk compression the kernel is able to decompress the initramdisk and the boot process works as expected. 

Re-emerging of bzip2 brings no change.
Re-installation of the latest systemd-boot bootloader brings no change.

Even bzip2 compression worked until beginning of November 2021.

I have tested with 5.10.x, 5.14.x and 5.15.x: bzip2 compressed initramdisks are  broken, compression with gzip works.

I am out of ideas.
Comment 5 Stefan Trenker 2021-11-19 20:29:02 UTC
I did two other tests:

1. Initramdisk build with genkernel and zstd compression works
2. Initramdisk build with dracut and bzip2 compression works

I can uncompress and extract all files via "bzcat initramdisk | cpio -idmuv" of the bzip2 compressed initramdisk build by genkernel. But during the boot process with systemd-boot as bootloader it is still broken.
Comment 6 Thomas Deutschmann gentoo-dev Security 2021-11-19 22:12:45 UTC
(In reply to Stefan Trenker from comment #4)
> I made a video from the boot process and replayed it in slow motion. Now i
> can confirm, that the problem is NOT related to the libcrypt-change.
> 
> The kernel is not able to decompress the bzip2 compressed initramdisk.

This sounds like you are only using genkernel to build initramfs only. In this case it is crucial to pass --kernel-config to genkernel or you will end up with an initramfs not supported by your kernel.
Comment 7 Stefan Trenker 2021-11-19 22:58:43 UTC
(In reply to Thomas Deutschmann from comment #6)
> (In reply to Stefan Trenker from comment #4)
> > I made a video from the boot process and replayed it in slow motion. Now i
> > can confirm, that the problem is NOT related to the libcrypt-change.
> > 
> > The kernel is not able to decompress the bzip2 compressed initramdisk.
> 
> This sounds like you are only using genkernel to build initramfs only. In
> this case it is crucial to pass --kernel-config to genkernel or you will end
> up with an initramfs not supported by your kernel.

No, that is not correct. I use genkernel to build the kernel plus initramdisk for the boot process. Please see Comment #1 for the complete genkernel comandline i use (with default genkernel.conf).
Comment 8 Thomas Deutschmann gentoo-dev Security 2021-11-20 00:08:20 UTC
I don't have a system where I use systemd-boot but I just set up a new VM where I used systemd at least to test booting with bzip2 compressed initramfs:

I called genkernel-4.2.5 with `genkernel --kernel-config=/proc/config.gz --compress-initramfs-type=bzip2 all`:

> -rw-r--r-- 1 root root 17432317 Nov 20 01:35 initramfs-5.10.76-gentoo-r1-x86_64.img
> -rw-r--r-- 1 root root  8431360 Nov 20 01:30 vmlinuz-5.10.76-gentoo-r1-x86_64
> 
> # file initramfs-5.10.76-gentoo-r1-x86_64.img
> initramfs-5.10.76-gentoo-r1-x86_64.img: bzip2 compressed data, block size = 900k

I had no problems booting that kernel with initramfs.

Based on my experience from other genkernel bug reports your problem sounds like you are booting either a kernel not matching initramfs or initramfs not matching kernel (like if you see something from eudev, genkernel initramfs was loaded -- now you are saying it failed to decompress initramfs which doesn't make sense).

Please check your bootloader and ensure that the correct kernel _and_ initramfs will be booted.

Maybe start over, remove failed kernel version, cleanup all leftover and emerge sources again, run genkernel again and finally install kernel/initramfs again.

And please share the video with us. Maybe we will spot something.
Comment 9 Stefan Trenker 2021-11-20 09:28:09 UTC
(In reply to Thomas Deutschmann from comment #8)
> I don't have a system where I use systemd-boot but I just set up a new VM
> where I used systemd at least to test booting with bzip2 compressed
> initramfs:
> 
> I called genkernel-4.2.5 with `genkernel --kernel-config=/proc/config.gz
> --compress-initramfs-type=bzip2 all`:
> 
> > -rw-r--r-- 1 root root 17432317 Nov 20 01:35 initramfs-5.10.76-gentoo-r1-x86_64.img
> > -rw-r--r-- 1 root root  8431360 Nov 20 01:30 vmlinuz-5.10.76-gentoo-r1-x86_64
> > 
> > # file initramfs-5.10.76-gentoo-r1-x86_64.img
> > initramfs-5.10.76-gentoo-r1-x86_64.img: bzip2 compressed data, block size = 900k
> 
> I had no problems booting that kernel with initramfs.
> 
> Based on my experience from other genkernel bug reports your problem sounds
> like you are booting either a kernel not matching initramfs or initramfs not
> matching kernel (like if you see something from eudev, genkernel initramfs
> was loaded -- now you are saying it failed to decompress initramfs which
> doesn't make sense).
> 
> Please check your bootloader and ensure that the correct kernel _and_
> initramfs will be booted.
> 
> Maybe start over, remove failed kernel version, cleanup all leftover and
> emerge sources again, run genkernel again and finally install
> kernel/initramfs again.
> 
> And please share the video with us. Maybe we will spot something.

Please find under the link

https://drive.google.com/file/d/19LsPwSLDGGhOFSJZQd2joWPEgUiDLvBS/view?usp=sharing

the slow motion video. The error message comes in th elast 10th of the video.

The genkernel-options are as follows:

 CMD_LOGLEVEL: 4
 CMD_MENUCONFIG: no
 CMD_SAVE_CONFIG: yes
 CMD_FIRMWARE: yes
 CMD_MICROCODE: all
 CMD_VIRTIO: yes
 CMD_CLEAN: no
 CMD_MRPROPER: no
 CMD_INSTALL: yes
 CMD_CLEAN: no
 CMD_OLDCONFIG: yes
 CMD_RAMDISKMODULES: yes
 CMD_MODULEREBUILD: no
 CMD_MAKEOPTS: -j9
 CMD_MOUNTBOOT: yes
 CMD_LVM: yes
 CMD_DMRAID: yes
 CMD_E2FSPROGS: yes
 CMD_MICROCODE_INITRAMFS: yes
 CMD_LUKS: yes
 CMD_GPG: yes
 CMD_BUSYBOX: yes
 CMD_COMPRESS_INITRD_TYPE: bzip2
 Gentoo Linux Genkernel; Version 4.2.5
 Using genkernel configuration from '/etc/genkernel.conf' ...
 Running with options: --kerneldir=/usr/src/linux-5.14.20-gentoo/ --kernel-config=/usr/src/linux-5.14.20-gentoo//.config --loglevel=4 --no-menuconfig --save-config --firmware --microcode=all --virtio --no-clean --no-mrproper --install --oldconfig --ramdisk-modules --no-module-rebuild --makeopts=-j9 --mountboot --lvm --dmraid --e2fsprogs --microcode-initramfs --luks --gpg --busybox --compress-initramfs-type=bzip2 all
 Resolving config file, command line, and arch default settings.
 ARCH 'x86_64' detected ...

 Sourcing default modules_load from '/usr/share/genkernel/defaults/modules_load' ...
 Sourcing arch-specific config.sh from '/usr/share/genkernel/arch/x86_64/config.sh' ...
 Sourcing arch-specific modules_load from '/usr/share/genkernel/arch/x86_64/modules_load' ...
 Using '/usr/src/linux-5.14.20-gentoo/include/config/kernel.release' to extract LOCALVERSION ...
 KERNEL_ARCH set to 'x86' ...
 Checking for suitable kernel configuration ...

 Working with Linux kernel 5.14.20-gentoo-x86_64 for x86_64
 Using kernel config file '/usr/src/linux-5.14.20-gentoo/.config' ...