Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

4 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.