Skip to content

Instantly share code, notes, and snippets.

@kokoye2007
Last active March 10, 2019 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kokoye2007/7c7b3c54eea2cdf44650ad675dc92295 to your computer and use it in GitHub Desktop.
Save kokoye2007/7c7b3c54eea2cdf44650ad675dc92295 to your computer and use it in GitHub Desktop.
How to reinstall grub2 efi bootloader on ubuntu
#hd-efi=/dev/sda1
#hd-root=/dev/sda2
#hd-hdd=/dev/sda
[ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
sudo mount $hd-root /mnt
#if UEFi
sudo mount $hd-efi /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/sda
update-grub
#grub-install error
#Installing for i386-pc platform.
#grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
#grub-install: error: embedding is not possible, but this is required for cross-disk install.
#try on live boot
parted $hd-hdd set 1 bios_grub on
parted $hd-hdd print
#retry in chroot
grub-install /dev/sda
update-grub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment