Ubuntu – How to reinstall GRUB to the EFI partition

bootdual-bootgrub2partitioninguefi

I want to reinstall GRUB 2 and I found these instructions:
How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB.
In my case, the boot loader is installed in the EFI partition. If I use the commands provided in this guide, will GRUB be reinstalled to the EFI partition automatically, or will it be installed into the root partition where Ubuntu is installed ? Obviously, I do not want this to happen.

Best Answer

  • Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...

    Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
    (Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)

    Once you are on the Live desktop, open a terminal and execute these commands :

    sudo mount /dev/sdXY /mnt
    sudo mount /dev/sdXX /mnt/boot/efi
    for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
    sudo chroot /mnt
    grub-install /dev/sdX
    update-grub  
    

    Note : sdX = disk | sdXX = efi partition | sdXY = system partition

    To identify the partitions use GParted, the tool is included in the installation medium.
    After having run the commands GRUB will be installed in the separate EFI partition.

  • Related Question