Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I have a system with dual boot for Windows 7 and Ubuntu 12.04.
The system uses Grub as its boot loader.
But, today by mistake, i shrank the Windows Volume and created a new Volume and all worked fine, except when i restarted to discover that boot-loader has gone wrong.
It displays:

error: no such partition  
grub rescue>  

I ran through google and several forums to finally discover many things.
Such as:

grub rescue> ls
(hd0) (hd0,msdos5) (hd0,msdos4) (hd0,msdos3) (hd0,msdos1)  

Now, i can load back to grub-menu and boot into Ubuntu as well as Windows normally, but by fighting with grub-rescue as:

grub rescue> set root=(hd0,3)/boot/grub  
grub rescue> set prefix=(hd0,3)/boot/grub  
grub rescue> insmod normal  
grub rescue> normal  

Although, this takes to Grub-menu for choosing OS, but i want to get away with this.
How, can i fix the Grub to get back the screen as earlier? Probably, it requires some resetting in grub, which i can't figure out.
Please provide any method.
PS: try to suggest a method, that uses normal user account, as i have to go more for getting sudo password.
Thanks.

share|improve this question

marked as duplicate by RolandiXor Nov 1 '13 at 23:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Thanks @Pieter. I wasn't able to find that already asked question through search. –  Vikas Raturi Oct 30 '13 at 17:04

1 Answer 1

You may need to reinstall GRUB using a Live system. Since you do not provide the ls (hd0,X) output, you should modify as you see fit:

  1. In a live session, open the terminal, then type sudo blkid. You will get a output similar to this:

    /dev/sda1: UUID="bf554a2f-a035-4c22-bca8-162def35a03c" TYPE="ext4" 
    /dev/sda2: UUID="3962db06-3776-4f38-8ab9-eab6feeccc1d" TYPE="ext4" 
    /dev/sdb1: UUID="AA64B45A64B42AC9" TYPE="ntfs" 
    /dev/sdb2: UUID="F66E431C6E42D551" TYPE="ntfs" 
    /dev/sdb3: UUID="75a0854b-8b6b-453f-8aec-2a081a1f19e3" TYPE="swap" 
    /dev/sdb5: UUID="279a18da-130b-46dd-8b54-84da48eb445f" TYPE="ext4" 
    /dev/sdg1: UUID="393cd35e-b827-4dea-acb5-2a66f2369dce" TYPE="ext4"
  2. Here you can see that my Hard Drive is in the sda and my pendrive is sdg. We are interested in sda. Now lest look at the descriptions of the partitions. We want the partitions that are ext4. In my case I have two ext4 partitions. This is because I have my /boot separated (which seems to be your case too), I will take note about that, but lets assume that you don't have /boot separated for now and that your / (root) is sda1. Now we will mount sda1.

    sudo mount /dev/sda1 /mnt
    sudo mount -o bind /proc /mnt/proc
    sudo mount -o bind /dev /mnt/dev
    sudo mount -o bind /dev/pts /mnt/dev/pts
    sudo mount -o bind /sys /mnt/sys
    

    Tecnical note: This is the minimum. If you have a /boot partition (or any other) separated just mount it the same way, in my case sudo mount /dev/sda2 /mnt/boot. Please take note that I used /mnt/boot, you should change it if using other mount points.

  3. Now we will proceed to CHROOTING the partition:

    sudo chroot /mnt /bin/bash
    
  4. Now we will proceed to install grub:

    sudo grub-install /dev/sda
    
  5. Done. Now reboot in your system. This should add the entries for Windows and Ubuntu.

share|improve this answer
    
thanks for answer @Braiam. But, i felt using Boot-rapair much easier, although it might be doing same steps in the box! –  Vikas Raturi Nov 4 '13 at 7:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.