How-To Geek

How to Repair GRUB2 When Ubuntu Won’t Boot


Ubuntu and many other Linux distributions use the GRUB2 boot loader. If GRUB2 breaks — for example, if you install Windows after installing Ubuntu or overwrite your MBR — you won’t be able to boot into Ubuntu.

You can easily restore GRUB2 from a Ubuntu live CD or USB drive. This process is different from restoring the legacy GRUB boot loader on older Linux distributions.

Graphical Method – Boot Repair

Boot Repair is a graphical tool that can repair GRUB2 with a single click. This is the ideal solution to boot problems for most users.

If you have the media you installed Ubuntu from, insert it into your computer and restart. If you don’t, download a Ubuntu live CD and burn it to a disc or install it on a USB flash drive. You can also download a dedicated Boot Repair live CD.

After booting into the live Ubuntu environment, open a terminal from the Dash and run the following commands to install Boot Repair:

sudo apt-add-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair


The Boot Repair window will appear after you run the boot-repair command. After it scans your system, click the Recommended repair button to repair GRUB2 with a single click.


You can also click the Advanced options header to customize GRUB2’s options without learning its command-line syntax.


Restart your computer after using the Boot Repair tool. Ubuntu should boot up normally.

Terminal Method

If you’d rather get your hands dirty, you can do this yourself from a terminal. You’ll need to boot from a live CD or USB drive, as in the graphical method above. Ensure the version of Ubuntu on the CD is the same as the version of Ubuntu installed on your computer — for example, if you have Ubuntu 12.04 installed, ensure you use a Ubuntu 12.04 live CD.

Open a terminal after booting into the live environment. Identify the partition Ubuntu is installed on using one of the following commands:

sudo fdisk -l
sudo blkid

Here’s the output of both commands. In the fdisk -l command, the Ubuntu partition is identified by the word Linux in the System column. In the blkid command, the partition is identified by its ext4 file system.


Run the following command to mount the Ubuntu partition at  /mnt, replacing /dev/sdX# with the device name of your Ubuntu partition from the above commands:

sudo mount /dev/sdX# /mnt

For example, use /dev/sda1 for the first partition of the first hard disk device.


Important: If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/boot. If you don’t know whether you have a separate boot partition, you probably don’t.

Run the following command to reinstall grub from the live CD, replacing /dev/sdX with the device name of the hard disk above. Omit the number. For example, if you used /dev/sda1 above, use /dev/sda here.

sudo grub-install –boot-directory=/mnt/boot /dev/sdX


Restart your computer and Ubuntu should boot properly.

For more detailed technical information, including how to use the chroot command to gain access to a broken Ubuntu system’s files and restore GRUB2, consult the Ubuntu wiki.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 05/26/12

Comments (9)

  1. Ankur

    very useful. bookmarked in case if emergencies when grub gets lost.

  2. Amin

    this is very useful post. i like it.

  3. cam2644

    Never had a problem with Grub but I’ve filed this useful info just in case. Thanks

  4. MJ

    And what if Ubuntu is installed with Wubi? I believe that in this case EasyBCD would do the job, but i havn’t tested it. Anyways really nice article and interesting info, keep up all the linux and Ubuntu stuff.

  5. M Henri Day

    Wow – this information is invaluable to me ! Ever since the advent of GRUB2 I’ve had problems every time a Windows crash and subsequent re-installation overwrote my MBR on my dual-boot box – I tried using the methods that worked for GRUB1 and the advice on the relevant thread on the Ubuntu fora, but I never could get them to work. Now I’m *almost* looking forward to having to re-install Win7, just to see how the instructions above work. One clarification, Chris – in the terminal method, you are quite explicit in saying that the version on the CD or USB drive from which one boots must be identical to that installed on one’s computer, but you say nothing about that being the case in the graphical method using Boot Repair. Am I correct in assuming that in the latter case, so long as the version on the medium used to boot the computer is recent enough to include GRUB2, it won’t make any difference ?…


  6. Wang Xiaoyun

    @M Henri Day: You can also find similar information in the following link in Ubuntu community.

    I repaired the grub last week on my new notebook after the installation of Win7 side by side with Ubuntu 12.04. The guide also clearly suggests to use exactly the same version of LiveCD as the installed one to avoid any unwanted issues caused by version discrepancy.

    If this guide came out 2 weeks earlier, then I would probably have saved some time in searching for the right terminal method. My first attempt was to follow another Ubuntu community document and obviously the terminal method described here is neither comprehensive nor accurate.

  7. Rasputin

    To cam2644:

    I have to fix my grub nearly every time I upgrade Ubuntu. Don’t just file this! Download & burn the Boot Repair disk and PRINT this article to keep with the disk. I also keep my Windows installation disk in the same big envelope because the upgrade usually messes up the MBR as well.

  8. Chris Hoffman

    @M Henri Day

    Good question. I try to err on the side of caution here. The short answer is it depends. The terminal method copies the files from the Ubuntu disc to the installed system, so it’s important those are the appropriate files (same version of GRUB, etc).

    However, I’m not entirely sure what Boot Repair does. If it works in a different way, it’s possible that it doesn’t necessarily need the same OS version. However, I’d advise you to use the same Ubuntu version — just to be safe.

    It’s also possible that a disc with a different Ubuntu version may restore GRUB properly. However, better safe than sorry.

  9. GCAT

    @Chris Hoffman

    I totally hosed by grub by playing around with GParted Live. I remember recovering grub before and couldn’t remember the command. Quick Google search and found your tutorial.

    However, I couldn’t fix my problem with your last manual command:

    sudo grub-install –-boot-directory=/mnt/boot /dev/sdX

    for me it was:

    sudo grub-install –-boot-directory=/mnt /dev/sdX

    I had to delete /boot part from the –boot-directory switch.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!