5

I have a system running Ubuntu 9 and would like to install Windows 7 RC on it in a dual-boot configuration. Is there a way to make Windows play nice with grub or am I going to have to install Ubuntu again just to have its boot loader keep control.

Ferruccio
  • 2,583
  • 2
  • 19
  • 10

4 Answers4

5

The best course of action would probably be to just let Windows 7 install it's own boot-loader since it won't play nice with grub, then boot from the Ubuntu cd and fix grub afterwards.

Stefan Thyberg
  • 704
  • 8
  • 15
5

Have a look at this documentation. i have done this before and it's not hard, just requires a bit of patience.

PixelSmack
  • 530
  • 4
  • 8
2

Unfortunately, installing Windows after installing Linux will blow away the bit of code in the Master Boot Record (MBR) that fires up grub on launch. However, it's not really that hard to restore. Here's how I've done it in the past.

Before installing windows I make a copy of the master boot record

dd if=/dev/sda of=original.mbr bs=512 count=1

(replace /dev/sda with the actual device ID for your drive) I then copy this off to some other medium just to have a copy. Once that is done, do the windows installation and make sure that all works. Once that is done, I boot back into Linux using a LiveCD (in the old days I'd use my boot floppy but I don't even have a computer with a floppy drive any more :-) ). Once I am booted into Linux I restore the original MBR with

dd if=original.mbr of=/dev/sda bs=512 count=1

(again use the actual path to the original.mbr file). You can reboot or not at this point This will restore your Linux OS but you won't be able to boot windows until you add it into the grub.conf (or menu.txt depending on your OS). On my system I just added the following lines:

title Windows XP Pro
        rootnoverify (hd0,1)
        chainloader +1

You will need to replace the (hd0,1) with the appropriate id for the partition that you have Windows installed on (in my case the second partition on the first hard drive). If you are still in the LiveCD OS be sure to edit the grub.conf on your hard drive not the running one from the LiveCD :-). Once you've made that change, you should be able to reboot and have both OS's available via grub.

dagorym
  • 396
  • 1
  • 4
  • 8
0

Yes, Windows most likely will erase MBR with grub. You'd have to load from boot CD and run grub-install afterward.

But if you experiment with installing Windows often, you can install grub into Linux partition, not into MBR. Then just setting active bit on the Linux partition with whatever disk utility you prefer will make Windows MBR code load grub that would be able to load anything else. It also quite useful if you have special MBR like ThinkPads do.

vava
  • 161
  • 2
  • 7