During upgrading my linux kernel on my Ubuntu installation I encoutered an error while generating initramfs after the installation. Instead of looking into the error more precisely, I simply restarted my system and ended up with a broken boot setup. The issue was that my bootmanager did not correctly recognize my encrypted partition and therefore did not show the decryption screen, where I would normally enter my password for the partition decryption.
Fortunately there is a way to mount your system via a live disk and reconfigure the initramfs and there is no need to reinstall the whole operating system. As it turned out there were not a lot of resources finding this online and it had cost me several hours finding a solution. This guide is for everyone who might come accross the same issue.
This guide is based on the following blog post: https://unix.stackexchange.com/questions/688707/how-do-i-get-linux-to-find-the-root-filesystem-on-an-encrypted-partition
Thanks to John Freeman for saving me from losing a bunch of work.
First find a linux distro you like and install it on a USB live disk. I simply used Xubuntu, because it has a fairly small iso size, but it really does not matter. Once that is done, restart your broken PC or Laptop and boot from the newly created live disk.
Now that we are up an running on our live disk, first open a partition manager tool (e.g. gparted, KDE partition manager, etc.) and identify your encrypted disk (probably the largest one). Normally you should see the name of your volume group already, if not simply double click in the partition and enter your decryption password (do not do this if you see the name already, because you need to restart if you do this). In my case this was vgkubuntu.
If you needed to decrypt your partition to see the name, you might need to restart and boot into the live disk again.
Now we have all the pieces together and can mount the system with the following commands. Simply replace vgkubuntu with the name of your volume group.
sudo -i cryptsetup luksOpen /dev/nvme0n1p3 vgkubuntu vgchange -ay mkdir /mnt/root mount /dev/mapper/vgkubuntu /mnt/root mount /dev/nvme0n1p2 /mnt/root/boot mount /dev/nvme0n1p1 /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
With that we mounted our root system and can execute any command we would be able to if we “normally” booted into our system. In my case this enabled me to reconfigure my initramfs with the following command:
update-initramfs -c -k all
Now restart your system, enter your decryption password and enjoy!
Quick Links
Legal Stuff