Linux – How to restore GRUB after windows XP installation

arch linuxdual-bootgrubmbrwindows

After I've installed windows xp for dual booting, I need to restore grub of my archlinux installation. I did it a lot of times with windows 7, but this time heavens decided to torture me.
I have opensuse liveKDE usb drive inserted into my laptop. My currect drive is /dev/sda with /dev/sda1 -> archlinux /; /dev/sda2 -> /home; /dev/sda3 -> windows xp.

In liveKDE konsole I mount my /dev/sda1 to /mnt/arch, chroot /mnt/arch /bin/bash and run grub.
Trying root (hdX,Y) I get "selected disk does not exist". So I try grub-install /dev/sda, which gives me "Not found or not a block device". I have tried other variants like grub-install.unsupported /dev/sda, which gave me "/dev/loop0 does not have any corresponding BIOS drive", arrrr!

I'm out of options here, does anybody have an idea of some competent liveCD to start with. I tried Super Grub Disk, didn't work cause it froze all the time. Tried Rescatux but it does not have grub available in terminal.

Best Answer

Finally, I did it. from liveCD (Archbang in my case) under root:

  1. mkdir /mnt/root
  2. mount -t ext4 /dev/sdaX /mnt/root
  3. mount -t proc none /mnt/root/proc
  4. mount -o bind /dev /mnt/root/dev
  5. chroot /mnt/root /bin/bash
  6. grub
  7. find /boot/grub/stage1
  8. root (hdX,Y)
  9. setup (hdX)
  10. quit
  11. reboot

This should work. Archlinux wiki has an article which explains the process in more detail.

Related Question