4

I found few threads that explain how to reinstall grub2 by the mean of chroot but none of them explain how to proceed if my / is encrypted and if there is a plain /boot partition. Thing is I installed Debian in EFI mode and it made an unbootable entry (Japanese character) in the UEFI boot menu.

I tried to make a new entry using efibootmgr from Ubuntu liveUSB but it is still unbootable. I'd like to reinstall grub from Ubuntu liveUSB but I don't know to chroot the encrypted / partition and how the separate /boot partition blends in.

Thomas W.
  • 540

2 Answers2

3
  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
    
kyodake
  • 17,808
0

Took me a while getting lost doing this. I have the same setup (non-encrypted /boot in ADDITION to a vfat /boot/efi). The following debian guide nails it. Missing pieces from all other guides were mounting the efivars and just comprehensive steps for grub re-installing etc. Hope this helps!

https://wiki.debian.org/GrubEFIReinstall

Details on the specific parts that were missing from other answers here:

  • include the efivars in the chroot whole installing grub

    for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done

  • don't forget to mount /boot and then also /boot/efi in the chroot

  • run *all the grub commands

    apt-get install --reinstall grub-efi

    grub-install /dev/disk

    update-grub

Thank you debian!!