How to chroot Ubuntu using Live CD to fix GRUB rescue prompt

Recently I messed up GRUB boot loader in my laptop installed with Ubuntu which resulted in grub rescue prompt. So I had to boot Ubuntu Live CD to get it fixed. Thought of blogging it, may be useful for some one.

This fix involves two steps. First one is to chroot into Ubuntu installation partition. Second one is to install the grub MBR (Master Boot Record). I am using Ubuntu Lucid 10.04 and Live CD also of same.

Step-1: Boot your machine with Ubuntu Live CD and select Trying Ubuntu without installation option when it is prompted (Live CD mode)

Step-2: Be patient till you get complete desktop ready.

Step-3: Ubuntu main menu -> Places -> Home Folder -> Look for other partitions listed on left hand side pane. Mount one by one and identify your Ubuntu root partition. When you are in your root partition, press Ctrl+L to view the complete mount path. Press Ctrl+C to copy this path. This path is normally /media/xx..xx kind of long path, where xx..xx denotes your hard disk partition unique id.

If you know your Ubuntu root partition you can replace the above GUI step-3 with simple mount command like this (Applications -> Accessories -> Terminal):

$ sudo mount /dev/sdax /mnt/myroot (where sdax is your root partition)

Let’s say you have mounted root partition at /media/xx..xx.

Step-4: $ Run the terminal through Applications -> Accessories -> Terminal.

Step-5: Run the following commands to export the pesudo file system of Live CD to your would be root file system soon.

$ sudo mount ‐‐bind /dev /media/xx..xx/dev

$ sudo mount ‐‐bind /proc /media/xx..xx/proc

$ sudo mount ‐‐bind /sys /media/xx..xx/sys

Step-6: Changing the root file system of live system to your hard disk installed root file system.

$ sudo chroot /media/xx..xx

Step-7: Installing GRUB Boot record in Master Boot record of your hard disk. My hard disk is sda. Replace your hard disk device node in the following command.

$ sudo grub-install /dev/sda

Step-8: Reboot the Live Ubuntu. Eject the CD.

Now you should get boot menu for your Ubuntu installation back. Enjoy the Ubuntu!

Note: How to get it done without Live CD which includes GRUB2 rescue prompt

Share this post

77 comments

  1. anne..karuppchami nnei! ennanka annei oru samacharavum kekala ungale patri? 🙂 (tamil movies often have this dialogue I observed)

    on topic: you can alternatively use, “mount -o bind /proc~sys~etc /mnt/path/proc

    ok nnei…

  2. Awsome. Got the grub rescue prompt after repartitioning and couldn’t find anything else that worked. Thanks for saving my life.

  3. My problem is I got Grub Rescue> after I clone Xubuntu 10.10 to a larger hard disk and boot from this larger hard disk using Paragon Backup LiveCD. Can I use your instruction to make it bootable into Xubuntu 10.10?

  4. Pingback: Grub
  5. thanks for this guide, saved my butt… couldn’t figure out the missing step to bind /dev, my system would only ever get to the initramfs prompt and i couldn’t get into livecd’s

  6. if all anyone had to do all day was play with Ubuntu it would be one fine operating system… don’t have time for all the BS and multitude of different explanations of any trouble that occurs

  7. Thanks. The mount /sys was the detail that was missing from other instructions.
    What I was doing: editing the grub config to add nomodedetect because my fresh install of Ubu 10.04.2 x64 caused the video card to stop during the boot process resulting in the monitor going to sleep.

  8. The following method is the way I’ve been doing it for years. Is there anything wrong with it? I’m a figure it out kind of guy, and sometimes my methods have consequences that aren’t immediately seen, if ever.

    From Livecd:

    mount /dev/sdax /mnt/myroot
    grub-install –root-directory=/mnt/myroot /dev/sda

  9. Pingback: Where do i start?
  10. Following your very helpful instructions I could boot my old w 2k and a new ubuntu10.4 LT.

    I can even read all but the root and lost-and-found files on my yet not bootable old ubuntu 10.10

    Many thanks to all my helpers!

  11. Great Help Thanks!

    I got busted at Step 5 .3 system though.

    Pls tell what might be the mistake:

    ubuntu@ubuntu:/$ sudo mount –bind /dev /media/eecb4cab-5220-464e-80ba-8342085e7315/dev
    ubuntu@ubuntu:/$ sudo mount –bind proc //media/eecb4cab-5220-464e-80ba-8342085e7315/proc
    ubuntu@ubuntu:/$ -rw-r–r– 1 root root 1192 2010-09-20 02:01 vmcoreinfo-2.6.35-22-generic
    -rw-r–r–: command not found
    ubuntu@ubuntu:/$ sudo mount –bind /proc /media/eecb4cab-5220-464e-80ba-8342085e7315
    ubuntu@ubuntu:/$ sudo mount –bind /sys /media/eecb4cab-5220-464e-80ba-8342085e7315
    ubuntu@ubuntu:/$ sudo chroot
    chroot: failed to run command `/bin/bash’: No such file or directory
    ubuntu@ubuntu:/$ sudo chroot /media/eecb4cab-5220-464e-80ba-8342085e7315
    chroot: failed to run command `/bin/bash’: No such file or directory
    ubuntu@ubuntu:/$ sudo chroot /media/eecb4cab-5220-464e-80ba-8342085e7315
    chroot: failed to run command `/bin/bash’: No such file or directory
    ubuntu@ubuntu:/$

    re Step-5.3 the system mount point stymies me again:

    7315 mount –bind /sys /media/eecb4cab-5220-464e-80ba-8342085e
    ubuntu@ubuntu:/$ sudo mount –bind /sys /media/eecb4cab-5220-464e-80ba-8342085e7315/sys
    mount: mount point /media/eecb4cab-5220-464e-80ba-8342085e7315/sys does not exist
    ubuntu@ubuntu:/$ -rw-r–r– 1 root root 167264 2010-09-24 17:14 memtest86+_multiboot.bin
    -rw-r–r–: command not found
    ubuntu@ubuntu:/$ sudo mount –bind /sys /media/eecb4cab-5220-464e-80ba-8342085e7315/sys
    mount: mount point /media/eecb4cab-5220-464e-80ba-8342085e7315/sys does not exist
    ubuntu@ubuntu:/$

    What did I do wrong? THIS CLOSE!!!!

  12. Pingback: appreciation
  13. Pingback: grub rescue
  14. Thanks! Helped me a lot in getting back a debian system that somehow GRUB had failed to install properly during installation.

  15. thanks for this…i cannot find the partition i installed my ubuntu o/s though i deleted it from windows 7 environment and thus the grub rescue issue…pls hw do i go about this…thanks.

  16. Hi,
    I’ve the same issue, but running Ubuntu 10.04 from within Windows 7 by means of wubi utility.
    During the update process, I’ve been asked to update grub and at the first reboot after finishing all the updates, my PC didn’t come up and stopped with a “grup rescue>” prompt….
    I tried the procedure above,running ubuntu from an usb key.
    But I cannot perform “mount –bin /dev /media/0C9C89219C890704/dev” as /media/0C9C89219C890704 it is not a root partition.
    It’s the Windows partition containing the ubuntu directory.
    The ubuntu directory contains:
    disks install Ubuntu.ico uninstall-wubi.exe winboot

    How can I fix?

    At worst I’d prefer disinstall ubuntu leaving windows 7 and then reinstall ubuntu without grub.

    Regards,
    Giovanni

  17. Hi Pivi,
    It is not specific to Ubuntu 9.10. I have used double hyphen character in prefixing “bind” in mount command. But my wordpress editor truncates it into one. Thanks for pointing out. Now I have managed to correct it with special codes. 🙂

  18. Hi,
    It was really helpful for me in recovering my boot loader after upgrading Ubuntu 9.10 to 10.04.
    For ubuntu 9.10 the above commands for mounting in step were the following
    $ sudo mount -–bind /dev /media/xx..xx/dev

    $ sudo mount –-bind /proc /media/xx..xx/proc

    $ sudo mount –-bind /sys /media/xx..xx/sys

Leave a Reply

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