Reinstall GRUB after BIOS Update on LUKS encrypted system

Due to reasons unknown I upgraded my Lenovos BIOS via a USB Stick. ๐Ÿ™‚ Everything went well, however after reboot, all my boot options for Linux Mint were gone.
Turns out, somehow my boot setup was erased as well.

Using UEFI without CSM and without secure boot with LUKS encrypted Linux Mint, this was already an issue when first installing. Getting everything right seems to be more of good luck.

So what is the solution

To get back your boot menu, I tried several things, e.g. boot-repair. However since my system is LUKS encrypted, I guess the tools all had some problems.

To get back my system, I accessed my old system via chroot from a Linux Live CD. In this case Linux Mint Live CD.

1. Boot from Linux Live CD, get keyboard locale and network set up. Unlock your LUKS device to the crypt mapper. The Linux Mint Live CD does that by only clicking on the drive, if you are on console, take a look here: https://wiki.ubuntuusers.de/LUKS/

2. Mount all necessary partitions out of old system
To find the LUKS drives, use lvscan:

sudo lvscan

For me my /root turns out to be in /dev/mint-vg/root
If you have separated partitions, e.g. for home, or other devices, make sure to adapt parts below for mounting.

sudo mount /dev/mint-vg/root /mnt
sudo mount /dev/sda2 /mnt/boot
for i in /dev /dev/pts /proc /sys /run ; do sudo mount -B $i /mnt$i ; done
sudo mount -o bind /etc/resolv.conf /mnt/etc/resolv.conf
sudo mount /dev/sda1 /mnt/boot/efi/

Make sure you add the /mnt/boot/efi, otherwise grub will complain grub-install: “cannot find EFI directory”. It is not included in your boot partition, but a separate partition.

3. Enter the chroot environment

sudo chroot /mnt /bin/bash

4. Install GRUB

sudo grub-install /dev/sda

Just a reboot and the system should work as before.

Advertisements