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.

My partition setup is:

[Win7] [Ubuntu] [extended [logical partition]] (in that exact order)

The bootloader installed in the MBR is a non-standard one that allows you to chainload a secondary bootloader on another partition. I use the this option alternatively boot Ubuntu via GRUB installed on /dev/sda1. This setup has always worked for me, but after upgrading my hard drive, I can't seem to restore GRUB to a working state. I upgraded by restoring recent backup images to the drive (this has worked for me in the past)

But, this time, I just get:

Error: no such partition. Grub rescue>

I can boot the Ubuntu installation with this at the rescue prompt:

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

But it's pretty silly to type that in every time.

This is my disk layout according to fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1       122896725   146336084    11719680   83  Linux
/dev/sda2       178053120   976773119   399360000    5  Extended
/dev/sda3   *         929   122881184    61440128    7  HPFS/NTFS/exFAT
/dev/sda5       178055168   976773119   399358976    7  HPFS/NTFS/exFAT

Partition table entries are not in disk order

I've tried grub-setup, grub-install, boot-repair (which doesn't work because it only offers the option to install to MBR), none have worked.

I have a USB thumbdrive with GRUB installed (which works when I use it to boot to the Ubuntu installation on the laptop at /dev/sda1) and its grub.cfg file is identical to the one on /dev/sda1.

If I had to guess, does the fact that the order of the partitions listed in fdisk -l doesn't match the order they're arranged on the disk have effect on this?

When I type set at the grub prompt I get

prefix=(hd0,msdos2)/boot/grub
root=hd0,msdos2
share|improve this question
    
Did you try update-grub? –  Danatela Jul 9 '13 at 2:27
    
If you just type set by itself, what are the current values of root and prefix? –  psusi Jul 9 '13 at 2:32
    
@Danatela: yes, I tried that. No effect. –  user1940006 Jul 9 '13 at 15:05
    
@psusi: I'll try that and report back –  user1940006 Jul 9 '13 at 15:05
    
You must have restored the image wrong and changed the order of the partitions. A grub-install should pick up the new partition number. –  psusi Jul 9 '13 at 15:31
show 2 more comments

1 Answer

up vote 4 down vote accepted

Problem solved with the command:

sudo grub-install /dev/sda1 --force

--force was the critical missing piece of the puzzle.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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