Score:2

Fix Grub2 boot with encrypted root LUKS partition

fi flag

I currently have 3 different boot partitions:

  1. Windows 11 on nvme0n1
  2. Fedora 35 on nvme1n1
  3. Ubuntu 22.04 on sdc with an encrypted root partition on sdc4

When I initially configure the system the Windows partition and the Ubuntu partition dual boot on the the same /boot (nvme0n1p1). Due to a system error I had to reinstall Windows which made my Ubuntu partition unbootable, using the Boot Repair I was able recreate the menu entry on the grub entry in the Fedora partition.

I'm able to boot into Ubuntu from the Fedora boot partition (same from on Ubuntu boot partition) but I'm always prompt with initramfs where I have to type:

(initramfs) > cryptoSetup luksOpen /dev/sdc4 myVolume
(initramfs) > exit

Then the Ubuntu splashscreen appears asking again to unlock my partition.

Any ideas how to avoid the initramfs from appearing?

My grub2 entry for Ubuntu looks like this:

insmod part_gpt
insmod ext2
set root='hd2,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt3 --hint-efi=hd2,gpt3 --hint-baremetal=ahci2,gpt3  07baf26d-6f32-4a0d-b264-336d15177aba
else
    search --no-floppy --fs-uuid --set=root 07baf26d-6f32-4a0d-b264-336d15177aba
fi
linux /vmlinuz-5.15.0-56-generic root=/dev/mapper/vg0-root ro quiet splash $vt_handoff
initrd /initrd.img-5.15.0-56-generic

My boot partition looks like this:

Disk /dev/nvme0n1: (Windows)

Device             Start       End   Sectors  Size Type
/dev/nvme0n1p1      2048    206847    204800  100M EFI System
/dev/nvme0n1p2    206848    239615     32768   16M Microsoft reserved
/dev/nvme0n1p3    239616 975491071 975251456  465G Microsoft basic data
/dev/nvme0n1p4 975491072 976771071   1280000  625M Windows recovery environment


Disk /dev/nvme1n1: (Fedora)

Device           Start       End   Sectors   Size Type
/dev/nvme1n1p1    2048   1230847   1228800   600M EFI System        -> /efi
/dev/nvme1n1p2 1230848   3327999   2097152     1G Linux filesystem  -> /boot
/dev/nvme1n1p3 3328000 976773119 973445120 464.2G Linux filesystem  -> /


Disk /dev/sdc: (Ubuntu)

Device       Start       End   Sectors   Size Type
/dev/sdc1     2048      4095      2048     1M BIOS boot
/dev/sdc2     4096    503807    499712   244M EFI System        -> /efi
/dev/sdc3   503808   8503295   7999488   3.8G Linux filesystem  -> /boot
/dev/sdc4  8503296 976771071 968267776 461.7G Linux filesystem  -> /

Any ideas are appreciated.

Thanks

oldfred avatar
cn flag
Do not use LVM nor encryption. But does not Ubuntu's grub have insmod luks and cryptomount (hdX,Y) and then would not Fedora's version need that? May be easier to use a configfile entry in Fedora to load Ubuntu either to Ubuntu's UEFI boot file (which is a configfile to grub.cfg in /) or directly to grub in /boot. https://askubuntu.com/questions/1205982/how-make-external-usb-disk-bootable-for-bios-and-uefi Not need to post link to Boot-Repair, better to post link to the summary report so can give better details, if you need those.
HFR1994 avatar
fi flag
Currently the menu entry in grub2 is pointing to the /boot (/dev/sdc3) in the Ubuntu disk, so if I understand correctly I need to change the entry to point to /dev/sdc2 which is the EFI portion? @oldfred
oldfred avatar
cn flag
Yes, but I find when booting different drives, the boot drive is hd0 and then drives seem to normally be in SATA port order. So I have boot stanzas that do not always work, particularly when plugging in flash drives or my external SSD as then drive order changes again. I often have boot entry that says hd1, but because of added drive, have to go into grub and change to hd2 to find correct drive. Or some experiment often required.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.