a long story here, but basically I had windows xp on sda1 aka (hd0,0) and ubuntu on sdb5 aka (hd1,4) and they were booting fine. Something messed up with ubuntu, I reinstalled, and tried to fix grub.. in the course of it all I believe I accidentally ran 'setup (hd0,0)' instead of 'setup(hd0)' to copy grub over.

I've tried fixing the MBR with ms-sys but to no avail.

At this point the GRUB boot menu lets me boot into linux, but if I try to boot into winXP, it quickly flashes "GRUB loading stage2..." and then puts me right back into the GRUB boot menu again.

Is there anything I can try to fix this or am i screwed?

The winxp grub menu entry is:

title winxp
rootnoverify (hd0,0)
chainloader +1

The output of fdisk -l is:

/dev/sda1 * 1 8338 7879403 c W95 FAT32 (LBA)

/dev/sdb1 * 1 2224 17864248+ 83 Linux
/dev/sdb2 2551 3924 11036655 b W95 FAT32
/dev/sdb3 2225 2550 2618595 5 Extended
/dev/sdb5 2225 2528 2441848+ 83 Linux
/dev/sdb6 2529 2550 176683+ 82 Linux swap / Solaris



5 Answers 5


I think you'll need to redo the Windows boot install process, since when you did setup (hd0,0), you probably overwrote the Windows boot manager. Using a Windows XP disk, boot to the recovery console (press R on the first screen), then log in to your Windows installation.

Once logged in, use the fixmbr and fixboot commands to restore Windows' boot process. Verify that you can boot into Windows, then restore GRUB as normal.

  • Does fixmbr + fixboot perform tasks which ms-sys cannot, or would this be sufficient? ms-sys.sourceforge.net
    – Gegtik
    Jun 2, 2009 at 1:23
  • From the description at that page, and what I understand of fixboot, there is a difference.
    – Tim
    Jun 2, 2009 at 2:17
  • Well I managed to totally hose my windows install, but it's my fault :P Recommendation - use the 'map' command to make sure you're targetting the correct drive!
    – Gegtik
    Jun 2, 2009 at 15:32

I've seen this before. Upon running "setup (hd0,0)", you wrote over part of your Windows partition. Fundamentally, you need to perform three steps to fix this. The steps are lengthy and may require further research depending on your experience/skill level, but they are the only way to fix this issue properly. With a little patience you will get things working again; I promise.

  • First, boot the Windows CD and at the first prompt press "R" and enter the recovery console. Once at the command prompt, run chkdsk /R
  • Once chkdsk has completed, restart the machine and boot the Windows CD again. This time, at the first prompt, press "Enter" to install Windows. It should see your previous installation and ask you if you'd like to repair it. (If you do not see this STOP! It means your windows partition is totally borked and you should back up what you can from it before doing anything else!)
  • Once the repair process is completed and Windows boots up normally, GRUB will have been overwritten. You will need to boot SuperGRUB disk or a Live CD of your fav distro and install GRUB to the MBR.

Wouldn't sdb3 be hd1,2 since there's no sdb0?

  • Sorry, I've corrected that detail above -- linux is on sdb5 not 3. find /sbin/init under grub returns (hd1,4)
    – Gegtik
    Jun 2, 2009 at 0:39
  • Ah, ok! I was confused, and thinking "that might be the problem..." Jun 2, 2009 at 2:22

The built-in grub utilities in Ubuntu and Debian might be able to get you out of this. I have done this for various reasons with Knoppix, which is great, but should work in the Ubuntu live cd if you can figure out how to get root access. In Knoppix:

  • boot from cd
  • open terminal and execute su or sudo su
  • mount your hard disk under /media ; # mount /dev/sda0 /media/some-mountpoint
  • chroot to the disk where you want grub; chroot /media/some-mountpoint
  • run grub-install

This basically leaves you with the fresh-from-install setup, with the grub installer finding bootable images and ordering them.

I have done this once or twice -- google around and make sure you are comfortable and well backed-up -- start with some of the above keywords or check out this: http://www.linuxdevcenter.com/pub/a/linux/2004/12/02/knpxhks_1.html for more background.


If you have an XP boot disk or equivalent you may try "fdisk /mbr"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .