Something got borked somewhere and I had to run update-initramfs
. I found very similar instructions in three separate places:
- https://ubuntuforums.org/showthread.php?t=2409754&s=e1f324bf5e566b3bb93374cd07bdcc17&p=13828993
- https://askubuntu.com/a/868726/538768
- https://feeding.cloud.geek.nz/posts/recovering-from-unbootable-ubuntu-encrypted-lvm-root-partition/
Here's how I got there.
I loaded Ubuntu off a live USB and ran fdisk -l
to see my partitions and guess which one was encrypted. I saw these (among others):
/dev/nvme2n1p1
: 512M EFI System
/dev/nvme2n1p2
: 732M Linux filesystem
/dev/nvme2n1p3
: 1.8T Linux filesystem <-- I guessed it was this one.
Then I decrypted the partition and mounted it like this:
sudo -i
cryptsetup open /dev/nvme2n1p3 $name
vgchange -ay
mkdir /mnt/root
mount /dev/mapper/$name /mnt/root
That let me inspect /etc/crypttab
to see which device name to use when decrypting the partition (nvme0n1p3_crypt
in this case):
nvme0n1p3_crypt UUID=743ab129-75bb-429b-8366-9c066f00c4fe none luks,discard
Then I looked at /etc/fstab
to see which partitions were the boot partition and EFI partition:
# /boot was on /dev/nvme0n1p2 during installation
UUID=773ceeb2-5c0f-4838-baad-a1182d7fdd80 /boot ext4 defaults 0 2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=5C17-FB32 /boot/efi vfat umask=0077 0 1
At installation, these partitions were named like nvme0n1p*
, but no longer. I could find their current names by listing /dev/disk/by-uuid
:
$ ls -l /dev/disk/by-uuid/
lrwxrwxrwx 1 root root 15 Jan 31 12:29 5C17-FB32 -> ../../nvme2n1p1
lrwxrwxrwx 1 root root 15 Jan 31 12:29 743ab129-75bb-429b-8366-9c066f00c4fe -> ../../nvme2n1p3
lrwxrwxrwx 1 root root 15 Jan 31 12:29 773ceeb2-5c0f-4838-baad-a1182d7fdd80 -> ../../nvme2n1p2
Now I had all the pieces I needed to follow the instructions. Here are the actual commands I executed:
sudo -i
cryptsetup open /dev/nvme2n1p3 nvme0n1p3_crypt
mount /dev/mapper/nvme0n1p3_crypt /mnt/root
mount /dev/nvme2n1p2 /mnt/root/boot
mount /dev/nvme2n1p1 /mnt/root/boot/efi
mount --bind /dev /mnt/root/dev
mount --bind /run /mnt/root/run
chroot /mnt/root
mount -t proc proc /proc
mount -t sysfs sys /sys
update-initramfs -c -k all
Then I was able to restart the machine and boot into one of the installed kernels.