Install Grub2 From Live CD

If you have installed Windows after Linux, or you may have somehow lost the Grub at the startup, and are unable to load your Linux, then this article may be helpful.

Firstly, boot from your Linux or Ubuntu CD, and choose the option of trying Ubuntu without installation.

After Ubuntu gets loaded from the Live CD, you have to find out that which of the drive or partition was the one, containing your previously installed Linux. For checking out the partitions, goto the terminal ( Applications -> Accessories -> Terminal ), and write:

sudo fdisk -l
fdisk -l

This will show you the list of partitions you have in your system.

After you get to know the partition where your Ubuntu was installed, write the following commands. For example, if the partition is /dev/sda1, you have to write the following commands (you have to replace the sda1 from your partition name):

sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc

Now write:

sudo chroot /mnt

and then install Grub by the following command:

grub-install /dev/sda

If any errors found after entering the above line, then try this one:

grub-install --recheck /dev/sda

This is it.

Now you can reboot your system, and enjoy using your previously installed Ubuntu, after un-mounting the system by:

sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt

and simply reboot:

sudo reboot

Hope this will help you installing or recovering your Linux.

  1. I could nowere else on the Net find proper guide how to reinstall grub2 out of ‘chroot’ enviroment and a live-CD.
    Thank you for this excellent article regarding reactivate lost grub2 and revive unbootable system.

  2. If you need to change your GRUB config (/etc/default/grub on ubuntu 12.04) you’ll also need to:

    mount –bind /sys /mnt/sys

    before chroot. Then:

    chroot /mnt
    cd /etc/default
    edit grub # or whatever editor works, vi is installed by default

    then exit the chroot (‘exit’) unmount stuff as above and reboot.

    If you don’t see the boot menu then try editing /etc/default/grub and uncommenting the line specifying low res video or the one saying GRUB_CONSOLE=text (or something close to that).

  3. First thanks for complete guide i m try at last 5 others before this one and allways fail to restore boot of mine Ubuntu 12.04..

    just for others if u copy-paste next lines directly into terminal

    sudo mount –bind /dev /mnt/dev
    sudo mount –bind /proc /mnt/proc

    sometime they not work! so retype it and watch
    –bind is actualy:
    –blind TWO “-”

    without this step u can get error when try to instal grub with message “ ‘/dev’ mounted”.

  4. I followed this instruction because after install UBUNTU alongside my windows xp, I could not see any boot menu and my computuer started with windows all the time. well after did all the steps above when I reboot my computer there is no boot menu, there is only a screen with the grub name waiting for a command, something like this

    GNU GRUB version 1.99~rc1-13ubuntu3

    Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TA


    Please help, what should I do?

  5. Excellent guide! Thank you! These are the best instructions I have found to re-install GRUB after installing Windows. I even used it to recover GRUB on a dual boot CentOS 5.5 / Windows 7 machine. Yes, that’s right booting to the Ubuntu 11.04 live CD to recover CentOS!!

  6. Good guide, although you miss an exit command to exit the chroot session. Only then can you unmount the /mnt muntpoints.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>