How to reinstall grub from a liveUSB if the / partition is encrypted and there is a separate /boot partition?

Solution 1:

  1. Boot from an Ubuntu Live USB with a working internet connection.

  2. Open a Terminal window (ApplicationsAccessoriesTerminal).

  3. Type the following commands (pay attention to the comments, starting with #, after some commands):

    sudo -i
    apt-get update
    apt-get install cryptsetup lvm2
    fdisk -l
    cryptsetup luksOpen /dev/sda? TAG           # sda? is your root partition
    vgchange -ay
    vgscan
    vgchange -ay [VOLUME GROUP NAME]           # From the above command
    lvscan
    mount /dev/[VOLUME GROUP NAME]/[LOGICAL VOLUME NAME] /mnt          # LOGICAL VOLUME NAME from above command
    modprobe efivars
    mount /dev/sda? /mnt/boot/efi          # sda? is your efi partition
    mount --bind /dev /mnt/dev 
    mount --bind /dev/pts /mnt/dev/pts
    mount --bind /proc /mnt/proc
    mount --bind /sys /mnt/sys
    cp /etc/resolv.conf /mnt/etc/
    chroot /mnt
    

    then do

    apt-get install --reinstall grub-efi-amd64
    

    or

    apt-get install --reinstall grub-efi
    

    and continue with

    update-grub
    umount /mnt
    vgchange -an
    cryptsetup luksClose TAG