Re-installing GRUB2

On occasion, it may be necessary to re-install grub. This is especially true if, like me, you keep mucking around with disk drives – and partitions – until the computer will no longer boot! It’s then time to drag out a live-CD and repair the boot system. Sometimes this can be done with a couple of Linux commands with which grub can be both re-installed and updated, but the trick is that you need to know on which device it is to be installed. However, various commands and utilities will provide relevant information.

For example, the blkid command will show various device attributes such as UUID and file system type.


While we obtain considerable information about the available disks and partitions by using blkid, the location of the master boot record is not one of the items displayed. Instead, we can use the fdisk command with the -l switch to list the partition tables. Note that this command needs root authority (sudo) otherwise it will not return any partition listings.


Now, we can see that, on this particular machine, the boot record is associated with /dev/sda1.

Boot Info Script
Boot Info Script is a useful utility which provides similar information about disk partitions, in addition to considerable detail on the associated boot files (such as a listing of grub.cfg). As an executable script, the file requires to have permission to be run as a program (Properties – Permissions – Allow executing as a program) and needs to be run as root using a bash command (sudo bash bootinfoscript). The script produces a file named RESULTS.txt (in the same directory as the script) that contains the script’s output:


The above listing is truncated to show just the listings for the Windows and Ubuntu 12.04 partitions. Note that the initial text indicates that “Grub 2 is installed in the MBR of /dev/sda”.


The final method that we might adopt is to use a live-CD of Gparted (assuming that this utility hasn’t been installed in Ubuntu). This will provide yet another listing of the partitions on sda and flag /dev/sda1 as the boot partition as shown in the following screenshot:


Re-installing grub

Now that we are certain that the boot record is associated with the sda device (the first hard drive), the commands to re-install GRUB2, ensure that the boot system is up to date and, hopefully bring the boot system back to life, are:

sudo grub-install /dev/sda
sudo update-grub


Boot Info Script

Gnome Partition Editor


Grub 2 Basics

This entry was posted in Applications, Commands, GRUB and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s