This page is a variation of GrubEFIReinstall explaining the procedure for the case that you encrypted the / partition of your system with LUKS. Follow the original guide if you didn't. Also, this guide doesn't contain any reference to repairing through rEFInd as the original guide should be independent of encryption of the root partition.

Starting with Windows 8 most Desktop PC have EFI as firmware instead of the legacy BIOS. If your EFI based PC is not booting Debian, here are some ways to reinstall grub-efi, the bootloader used by Debian on these PCs.

At this time, this guide does not take LVM drives into account!

To reinstall grub, you need either a live CD or USB to access your current system.

(The following procedure has been gathered and put together from various sources. Use at your own risk!)

  1. Boot (using UEFI) into a live system, such as a DebianLive CD/USB or the Debian installer in rescue mode. You can verify that the system has booted using UEFI by checking for the existence of the directory /sys/firmware/efi or by running efibootmgr.

  2. If the directory /sys/firmware/efi/efivars is empty, you need to boot the rescue system including the kernel option "efi=runtime" and mount the EFI variables before proceeding:
    # mount -t efivarfs none /sys/firmware/efi/efivars
  3. Mount the broken system somewhere into the running filesystem. The exact details of how to do this depend on the particulars of your installation.

    For this example, the system has an EFI partition on /dev/sdb1, an unencrypted /boot partition on /dev/sdb2, and a LUKS-encrypted / partition on /dev/sdb3. To make sure not to break the system, the LUKS partitions need to be mounted under the same name listed in /etc/crypttab. This name is usually luks-<UUID>. If booted into a live system, this UUID can easily be obtained e.g. from the gnome-disk-utility after selecting the partition. From shell the UUID can be obtained through

    # cryptsetup luksUUID /dev/sdb3
    With the UUID obtained, continue with
    # cryptsetup luksOpen /dev/sdb3 luks-<UUID>
    # mount /dev/mapper/luks-<UUID> /mnt
    # mount /dev/sdb2 /mnt/boot
    # mount /dev/sdb1 /mnt/boot/efi

    If there is no separate /boot partition and thus the / partition is on /dev/sdb2, this simplifies to:

    # cryptsetup luksOpen /dev/sdb2 luks-<UUID>
    # mount /dev/mapper/luks-<UUID> /mnt
    # mount /dev/sdb1 /mnt/boot/efi
  4. Bind mount various virtual file systems:
    # for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done
    The mount executable supplied with busybox does not support the -B option, use "mount -o bind" in this case.
  5. Chroot into the broken system:
    # chroot /mnt
  6. Reinstall GRUB to the appropriate disk (without partition number):
    # grub-install /dev/sdb
  7. Generate the GRUB configuration file:
    # update-grub
  8. Exit the chroot environment (<CTRL>-D).

  9. If everything worked, reboot.


CategoryBootProcess RescueLive


CategoryBootProcess