How to install GRUB bootloader on master boot record on Ubuntu or Mint

Last updated on September 24, 2020 by Dan Nanni

Question: My Ubuntu fails to boot from disk after a clean installation. I suspect GRUB bootloader was not properly installed during Ubuntu installation for some reason. I would like to repair GRUB bootloader. How can I re-install GRUB bootloader on my Ubuntu?

In Linux, master boot record (or MBR) is a reserved space in disk storage which stores an OS bootloader as well as disk partition table. If GRUB bootloader is not loaded properly, you can try re-installing GRUB bootloader on MBR. Here is how to install GRUB bootloader on MBR on Ubuntu or other Ubuntu-derivatives such as Linux Mint.

In this tutorial, it is assumed that /dev/sda is the disk which contains a boot partition.

First, using fdisk command, verify that the boot partition (typically the first partition) in /dev/sda is tagged as bootable. If the partition is bootable, it should show * under Boot column in the fdisk output.

$ fdisk /dev/sda

If the boot partition is not bootable, mark it as bootable. You can press a on fdisk to toggle a bootable flag. After changing a bootable flag, make sure to press w to write the change to disk.

After this, use the following commands to install GRUB bootloader.

$ sudo grub-install --boot-directory=/boot /dev/sda
$ sudo update-grub

Finally, reboot and check if it can boot from disk.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean