Suppose Grub 2 is broken and you can no longer boot into Ubuntu Mate. No need to panic, you can repair Grub 2 from a live DVD, or Live USB session.
Insert your Live DVD, or Live USB, and reboot your system. Select the live media, and boot from it.
Once the Live media is booted select the option to "Try Ubuntu Mate" and wait for it to finish loading.
From the live session open a terminal and run
sudo fdisk -l
This should return a output similar to this
ubuntu-mate@ubuntu-mate:~$ sudo fdisk -l
Disk /dev/loop0: 1.6 GiB, 1656864768 bytes, 3236064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier:
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 15728639 15726592 7.5G 83 Linux
/dev/sda2 15730686 16775167 1044482 510M 5 Extended
/dev/sda5 15730688 16775167 1044480 510M 82 Linux swap / Solaris
ubuntu-mate@ubuntu-mate:~$
In the example above /dev/sda is the hard drive of the machine that the live DVD, or Live USB booted from.
Now find the Linux partition. In the example above it would be /dev/sda1 which is labled as Linux
Next, you need to mount the Linux partition.
From the terminal run
sudo mount /dev/sda1 /mnt
This will temporarily mount the Linux partition so there is access to the Grub configuration files that are necessary to reinstall Grub on your system.
Next, to reinstall Grub run the following in the terminal
sudo grub-install --boot-directory=/mnt/boot /dev/sda
This command is going to tell Grub to install the configuration located in the Linux partition /boot directory, which is mounted at /mnt, and install to the MBR of the hard drive on your system represented here as /dev/sda
This should return a output similar to the following if everything worked correctly
Installing for i386-pc platform.
Installation finished. No error reported.
At this point Grub should be repaired, and you should be able to boot into your system normally once again.
Notes:
This tutorial assumes you can no longer boot into your system because Grub is broken. The instructions given will repair Grub if you enter each command correctly. However, I do not recommend that you try this on a working system because if you do something incorrectly, you could cause your system to not boot.
There are many variables you may encounter. For example, if you have more than one hard drive you may see both /dev/sda and /dev/sdb listed. It's up to you to determine which one your Linux partition resides on, and which one you need to install Grub to. Or if you have more than one Linux installation, you will see Linux listed more than once. It's up to you to determine which Linux partition you need to repair Grub from. If you get stuck on any variables that you may encounter, a quick google search should shed some light on the subject.
I keep a condensed version of these instructions in my home folder. That way it can be accessed from a live session, this will allow me to copy and paste the commands, which I find to be safer and quicker than typing them. You may wish to do the same if you find these instructions useful.
My systems are somewhat dated, If there are other variables that I am unaware of related to newer hardware, please feel free to add them in a reply.