Skip to content

installer: Rebuild initramfs for LUKS installs so crypttab reaches the initramfs - #186

Open
ggiesen wants to merge 1 commit into
linuxmint:masterfrom
ggiesen:fix-luks-initramfs-crypttab
Open

installer: Rebuild initramfs for LUKS installs so crypttab reaches the initramfs#186
ggiesen wants to merge 1 commit into
linuxmint:masterfrom
ggiesen:fix-luks-initramfs-crypttab

Conversation

@ggiesen

@ggiesen ggiesen commented Jun 24, 2026

Copy link
Copy Markdown

A UEFI encrypted (LVM-on-LUKS) install completes but cannot boot: it drops to an initramfs shell (ALERT! /dev/mapper/lvmmint-root does not exist). The target inherits live-boot's diverted update-initramfs, which no-ops unless the live medium is mounted at /run/live/medium inside the chroot. /run is bind-mounted non-recursively, so that submount is absent and finish_installation()'s update-initramfs call is silently skipped, leaving the crypttab out of the initramfs.

Fix, gated on self.setup.luks: remove live-boot's initramfs hook (/usr/share/initramfs-tools/hooks/live, which references the live-only /usr/lib/live/boot and fails on the installed system), resolve the real un-diverted update-initramfs via dpkg-divert --truename, and run it in the chroot so the cryptsetup hook bakes in /conf/conf.d/cryptroot.

Scope/regression: the guard means plain and LVM-without-encryption installs are untouched. On a target with no live-boot diversion, dpkg-divert --truename returns the plain /usr/sbin/update-initramfs and the rm -f of the absent hook is a no-op, so it just runs update-initramfs one extra (harmless) time. On BIOS, where this layout already boots, the rebuild is a harmless no-op improvement. The manual-partition (skip_mount) dm-crypt path is not covered.

Testing (LMDE 7, OVMF/QEMU): a UEFI LVM-on-LUKS install on master drops to an initramfs shell at boot; with this change it prompts for the passphrase, unlocks, and boots. BIOS installs of the same layout boot in both cases.

Split out of #180 so it can be reviewed and land independently.

Fixes #183

A UEFI lvm-on-luks install completes but cannot boot: it drops to an
initramfs rescue shell with "ALERT! /dev/mapper/lvmmint-root does not
exist", because the crypttab never reaches the initramfs.

The target is copied from the live squashfs, so it inherits live-boot's
diverted update-initramfs -- a wrapper that no-ops unless the live
medium is mounted at /run/live/medium inside the chroot. The engine
bind-mounts /run non-recursively, so that submount is absent and the
update-initramfs call is silently skipped; the crypttab is never baked
in. On BIOS the copied live initrd happens to unlock and boot from the
kernel cmdline, so the failure is firmware-dependent -- UEFI is broken.

For LUKS, remove live-boot's initramfs hook (it references a live-only
path and fails on the installed system) and run the real, un-diverted
update-initramfs so the crypttab is baked in. No-ops cleanly where
there is no diversion or hook.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UEFI encrypted (LVM-on-LUKS) install is unbootable: drops to an initramfs shell

1 participant