OK. Documenting this here for the next time I have to do this.
I’m working on setting up a computer that dual-boots into Linux and XP.
Rule 1: Always put Windows on the first primary partition on the drive. Linux can go pretty much anywhere else.
Rule 2: Always install Windows first, then Linux, so the boot loader will get set up properly. I knew this, but chose to do things the other way around anyhow (yep, I’m stupid that way). And of course, the XP install hosed the Linux boot loader, so I had to manually restore it, which was a big pain.
Here’s how I reinstalled the boot loader, for the next time I ignore my own advice…
- Boot into the Debian netinst CD, or Knoppix, or Tom’s Root Boot, or whatever flavor of standalone Linux you prefer.
With netinst, you’ll need to walk through the install process until it gets to the disk partitioning part (this ensures that the disk devices are loaded). Then, hit ALT-F2 to get a shell.
- Create a mount point, say
/disk
, and mount your root filesystem there. Example:mount /dev/hda5 /disk
chroot /disk
- Mount any additional filesystems you might need, like
/boot
, etc. grub-install /dev/hda
That’s all I needed to do, but it took several unsuccessful attempts to arrive at this.
1 thought on “Reinstalling ‘grub’ boot loader”
Comments are closed.