How do I permanently fix a GRUB partition off by one error?

5,794

Grub is probably dropping to the console because the partition layout has changed since grub was first installed. Now that you have updated grub.cfg, re-installing grub should fix it. Boot into your ubuntu system the same way you did in order to run update-grub. From there, do a grub-install:

grub-install /dev/sdX

(Replacing X with your device, in your case it looks like it is probably /dev/sda.)

Share:
5,794

Related videos on Youtube

CheeZe5
Author by

CheeZe5

Updated on September 18, 2022

Comments

  • CheeZe5
    CheeZe5 over 1 year

    I have a MacBook Pro set up to triple boot with rEFIt and GRUB. (I had to go through GRUB to get Windows 7 to boot, but that's tolerable.) I upgraded to Lion which added a new partition for the recovery feature. This also causes GRUB to boot to a rescue prompt. Running set shows:

    prefix=(hd0,gpt5)/boot/grub
    root=hd0,gpt5
    

    If I run the following commands:

    set prefix=(hd0,gpt6)/boot/grub
    set root=(hd0,gpt6)
    insmod normal
    normal
    

    the usual GRUB menu shows up and I can boot into whichever OS I want. I got into the Ubuntu partition and checked out the grub.cfg file and it was setting the root to gpt5. I ran the sudo update-grub command. This changed the value in the cfg file to gpt6. However GRUB still boots into the rescue prompt and set still shows the initial root and prefix values. How do I make this permanent?

    • DOS
      DOS over 12 years
      I am facing the same problem? Anyone could solve it?
    • Jjames
      Jjames over 12 years
      As a sidenote. You're not supposed to edit grub.cfg by hand, it gets regenerated everytime you run update-grub. Can we also get the the layout of the disk (fdisk -l)?
  • DOS
    DOS over 12 years
    Hey! I want to award the bounty to this answer. But it seems there was on expiry on awarding it too. How can I award the bouty to this answer?
  • CheeZe5
    CheeZe5 over 12 years
    I did that in a sort of round about way. I upgraded to 11.10 and all is well.
  • becko
    becko about 6 years
    How do I know what is the device I should use (the X)?
  • Admin
    Admin almost 2 years
    @becko, you can run $ lsblk to see your /dev/sdX (SSD should be something like /dev/nvme0n1). The grub-install command should point to the disk, not the partition!