Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 851501

Summary: sys-kernel/genkernel-4.2.6-r2: requires new kernel 5.18 flag BLOCK_LEGACY_AUTOLOAD for initramfs
Product: Gentoo Hosted Projects Reporter: Thibaud CANALE <thican>
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: UNCONFIRMED ---    
Severity: normal CC: ahipp0, gpuzankin, phils
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Thibaud CANALE 2022-06-12 09:27:47 UTC
Hello,

With Linux kernel 5.18, the config flag "BLOCK_LEGACY_AUTOLOAD" has been introduced.
If this flag it disabled, and genkernel is used to generate the initramfs, this last can’t find the "root" partition to open or unlock.

Tested with genkernel 4.2.6 on a RAID1 then LUKS system.

Genkernel USE flags:
> sys-kernel/genkernel-4.2.6-r2::gentoo was built with the following:
> USE="firmware (-ibm)" ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_9 -python3_10 -python3_8"

Kernel and initramfs compilation options:
> genkernel --makeopts='-j16' --no-clean --no-mrproper --no-install --no-symlink --no-all-ramdisk-modules --no-module-rebuild --kernel-config=/usr/src/linux/.config --no-splash --busybox --no-ssh --mdadm --mdadm-config=/root/mdadm_root.conf --no-dmraid --gpg --luks --lvm --microcode=amd --no-firmware --compress-initramfs --compress-initramfs-type=zstd --strip=all all

Options as kernel arguments:
> domdadm doluks crypt_root=UUID=1[...] root_keydev=UUID=[...] root_key=/efi/gentoo/drive.gpg dolvm real_root=UUID=[...] rootfstype=xfs keymap=fr resume=UUID=[...]

When failing it asks to provide the root path before querying the passphrase for the GPG key.

Once this BLOCK_LEGACY_AUTOLOAD kernel flag is set and the new kernel rebuilt, the system boots as usual.
Comment 1 Phil Stracchino (Unix Ronin) 2022-08-04 17:51:18 UTC
I just ran into this exact same problem myself.  Verifying right now that enabling BLOCK_LEGACY_AUTOLOAD solves the boot failure.
Comment 2 Phil Stracchino (Unix Ronin) 2022-08-04 18:04:27 UTC
(In reply to Phil Stracchino (Unix Ronin) from comment #1)
> I just ran into this exact same problem myself.  Verifying right now that
> enabling BLOCK_LEGACY_AUTOLOAD solves the boot failure.


Confirmed that the system would not boot, unable to find the boot device, until BLOCK_LEGACY_AUTOLOAD was enabled in the kernel.

If this is now considered legacy functionality, then there needs to be a lot better documentation readily findable on how to configure booting "correctly" so that BLOCK_LEGACY_AUTOLOAD is NOT required.
Comment 3 Andrey 2023-01-09 07:24:13 UTC
(In reply to Thibaud CANALE from comment #0)
> With Linux kernel 5.18, the config flag "BLOCK_LEGACY_AUTOLOAD" has been
> introduced.
> If this flag it disabled, and genkernel is used to generate the initramfs,
> this last can’t find the "root" partition to open or unlock.
>
> ...
> 
> Once this BLOCK_LEGACY_AUTOLOAD kernel flag is set and the new kernel
> rebuilt, the system boots as usual.

Same issue on kernel 6.1.4 with "CONFIG_BLOCK_LEGACY_AUTOLOAD is not set" and a custom initramfs,
which merely does `mdadm --assemble --scan`.
(no udev is running as part of initramfs, but devtmpfs is automatically mounted prior to that)
Rebuilding the kernel with CONFIG_BLOCK_LEGACY_AUTOLOAD=y fixed the problem.
Comment 4 ascendant512+gentoo 2023-02-25 04:02:34 UTC
Not a genkernel user myself, but came across this when Googling.  I have a script that runs `mdadm --assemble --scan` and it stopped working until I enabled BLOCK_LEGACY_AUTOLOAD.