Score:1

No prompt to decrypt luks partition on boot

ng flag

Fresh install of Ubuntu 22.04.2 LTS to a LUKS partition. When I boot, it never prompts me for my LUKS password, fails to load the system, and instead puts me at a command prompt. If I type

cryptsetup open /dev/nvme0n1p6 nvme0n1p6_crypt

at this prompt, and enter my password, and then exit, the system will then successfully boot. So LUKS is set up properly except that it's not prompting me for the password, making me do that manually.

I set up my system based on this tutorial. In brief, /dev/nvme0n1p6 is a LUKS partition that should map to /dev/mapper/nvme0n1p6_crypt which corresponds to a volume group called "treehouse-vg" which contains treehouse--vg-swap_1 (a swap partition) and treehouse--vg-root (mounted to /).

lsblk output for device nvme0n1:

nvme0n1
│      259:0    0 476.9G  0 disk  
├─nvme0n1p1
│      259:1    0   100M  0 part  /boot/efi
├─nvme0n1p2
│      259:2    0    16M  0 part  
├─nvme0n1p3
│      259:3    0 166.5G  0 part  
├─nvme0n1p4
│      259:4    0   900M  0 part  
├─nvme0n1p5
│      259:5    0  1000M  0 part  /boot
└─nvme0n1p6
       259:6    0 308.5G  0 part  
  └─nvme0n1p6_crypt
       253:0    0 308.5G  0 crypt 
    ├─treehouse--vg-swap_1
    │  253:1    0    32G  0 lvm   [SWAP]
    └─treehouse--vg-root
       253:2    0 276.5G  0 lvm   /var/snap/firefox/common/host-hunspell
                                  /

Contents of /etc/crypttab:

nvme0n1p6_crypt UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none luks,discard

(UUID is the UUID output of blkid /dev/nvme0n1p6)

However, after editing crypttab, when I try

$ sudo update-initramfs -k all -c
update-initramfs: Generating /boot/initrd.img-5.19.0-32-generic
cryptsetup: WARNING: target 'nvme0n1p6_crypt' not found in /etc/crypttab
I: The initramfs will attempt to resume from /dev/dm-1
I: (/dev/mapper/treehouse--vg-swap_1)
I: Set the RESUME variable to override this.
update-initramfs: Generating /boot/initrd.img-5.19.0-46-generic
cryptsetup: WARNING: target 'nvme0n1p6_crypt' not found in /etc/crypttab
I: The initramfs will attempt to resume from /dev/dm-1
I: (/dev/mapper/treehouse--vg-swap_1)
I: Set the RESUME variable to override this.

So something may be wrong there but I can't figure out what. Why is it giving me a warning that "nvme0n1p6_crypt" is not found in crypttab, when it's exactly what I typed into crypttab?

Here is my /etc/fstab (which I haven't touched):

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/treehouse--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/nvme0n1p5 during installation
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /boot           ext4    defaults        0       2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=XXXX-XXXX  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/treehouse--vg-swap_1 none            swap    sw              0       0

In case it's helpful, here are the error messages I get when I boot, and what I do to continue the boot:

enter image description here

Score:0
ng flag

Figured it out. Make sure there is a newline at end of file in /etc/crypttab before you run update-initramfs -k all -c. Without that newline, cryptsetup will just choke and ignore the line.

The funny thing is I thought I had tried that hours ago and it didn't work, but maybe I forgot to update-initramfs at the time or something. I only discovered it by chance when I tried adding a second line to crypttab for a bogus crypt device just to see what would happen, and the first line suddenly started working.

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.