Recent kernels have issues with loop-aes's build-initrd.sh in some configurations. USEPIVOT=2 does not work w/SW raid on 5.10+ kernels, and USEPIVOT=1 fails to build when booted in a standard Gentoo install ISO environment. Details: An initrd needs to mount /boot to access key material, and then losetup the device that will be mounted at /. loop-aes's build-initrd.sh helper script builds a minimal initrd. It can handle simple single-disk / HW raid, and/or can auto-assemble-able software RAID using metadata 0.90 (more complex software RAID has always required a "fatter" initrd). There are multiple methods/options for initrd kernel / bootloader configuration, controlled by build-initrd.sh config options. USEPIVOT=1 mounts a minix filesystem image and calls pivot_root, leaving behind an /initrd mount. USEPIVOT=2 uses a cpio archive as initramfs and leaves no lingering mount point. USEPIVOT=2 continues to work fine when the devices are single-disk and/or HW raid. When a system uses autodetect SW RAID for its boot and root devices, the initrd needs to be able to assemble them, mount /boot for key material, then losetup the device that will be mounted at /, etc. However, kernel raid APIs changed somewhere around 5.10, making the minimal initrd made by build-initrd.sh in USEPIVOT=2 mode unable to assemble the RAID prior to setting up loop device, so the system can no longer boot. USEPIVOT=1 still works with 5.10+ kernels, but there is a Gentoo-specific catch. build-initrd.sh uses minix by default (for its low overhead), and it also assumes that the 'mount' command is loop-aes's patched one. When booted on a Gentoo install ISO, neither of these is true: the minix filesystem is not supported by the ISO's kernel, and the standard mount is present. So it has never(?) been possible to build a USEPIVOT=1 initrd when booted from a Gentoo install ISO.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bb250ff921c5789e395e491530c23156a01fc3b commit 0bb250ff921c5789e395e491530c23156a01fc3b Author: Hank Leininger <hlein@korelogic.com> AuthorDate: 2022-03-04 03:20:22 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2022-03-11 08:31:03 +0000 sys-fs/loop-aes: Version bump to 3.7w, minor Gentoo compat fixes Upstream version bump added 5.16 support. Also, updates to the bundled build-initrd.sh script to be compatible with Gentoo's install ISO kernel (see bug). Signed-off-by: Hank Leininger <hlein@korelogic.com> Closes: https://bugs.gentoo.org/834546 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Closes: https://github.com/gentoo/gentoo/pull/24399 Signed-off-by: Joonas Niilola <juippis@gentoo.org> sys-fs/loop-aes/Manifest | 1 + .../files/build-initrd_explicit-losetup.patch | 28 +++++++++ sys-fs/loop-aes/loop-aes-3.7w.ebuild | 69 ++++++++++++++++++++++ 3 files changed, 98 insertions(+)