Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had my laptop's HDD separated in 3 partitions:

  1. NTFS - Win XP install (primary)
  2. NTFS - common space (extended)
  3. ext4 - Ubuntu 10.10 (extended)

Running out of space, I deleted my 2nd partition, and formated it to ext4, planning to merge it to my 3rd partition.
The problem is that after restart I realized that grub was installed on partition #2.

Using grub (GNU GRUB 0.97) an Ubuntu 11.04 live CD, I tried:

grub> root (hd0,4)

grub> setup (hd0,4)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... no

Error 15: File not found


Also, for setup (hd0) I get the same result.

Right now I have:

  1. /dev/sda1 aka (hd0,0) - Win XP (NTFS)
  2. /dev/sda7 aka (hd0,6) - the free space (ext4)
  3. /dev/sda5 aka (hd0,4) - my previous install of Ubuntu (ext4)

How can I repair it?

share|improve this question
up vote 4 down vote accepted

This page documents installing GRUB from the live CD:

share|improve this answer

Ubuntu has moved to grub2 since 9.10, so you need to reinstall grub2, not grub-legacy. Boot from the livecd and:

sudo -s
mount -t ext4 /dev/sda5 /mnt
grub-install --root=directory=/mnt /dev/sda

Also you can't have an sda7 without an sda6, so check your partition numbers there. Since you want to merge that space into the other partition, then you should use gparted to delete the unused partition and expand the other one to use that space first, THEN reinstall grub.

share|improve this answer
It's better to chroot rather than using --root-directory (this guarantees that all the versions of GRUB code match up). – Colin Watson May 11 '11 at 16:01
@Colin Watson since your remark worked flawlessly, if you turn your comment into an answer I'd be more than happy to set it as the accepted one! – Marius Butuc May 11 '11 at 18:18
Fair enough. Done, thanks :-) – Colin Watson May 13 '11 at 12:37

Your Answer


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.