Getting GRUB & Vista To Work Together

#1
[FACE=Impact]Welcome Googlers![/FACE]

This is a very-roundabout way of dual-booting Vista and GRUB. Luckily NeoSmart Technologies' EasyBCD 1.51 takes care of it all! Dual-Boot Linux and Vista - EasyBCD

---------------------

Howdy Mister Computer Guru! Here's my problem with GRUB & Vista...

Pre-Vista I had WinXP on drive 1, partition 1 and Linux on drive 1 partition 2. Vista installed and rebooted fine, all was good until I attempted to do the usual "boot a live linux CD to fix GRUB". As I'm sure ya'll know, this apparently doesn't work anymore. I tried writing it to the MBR of this drive, and the MBR of another drive and changing the boot order in the OS - neither of which worked.

Can I use the Vista bootmanager to boot all 3 OS's? I'm a bit confused by the fact that Vista made it's partition "C" and my XP partition "E", and didn't automatically add XP to the list of OS's. I'm not going to hack things up anymore until I get a little advice, but I'm thinking that I can add XP to the OS list (with VistaBootPRO) as drive "E" and all will be good there. I have no idea how to add Linux though if I must use Vista's bootmanager.

Second thought... If I uninstall Vista and hopefully get back to XP, can I use the option in VistaBootPRO to uninstall the Vista bootmanager and get back to where I was originally? If so, how can I reinstall Vista and avoid this whole scenario from happening again?

*I'm sending the email as well, but I may or may not be heading out for lunch in a little bit. If we need to IM in realtime we might want to wait until a bit later. Thanks!

Aaron
 

mqudsi

Mostly Harmless
Staff member
#2
Great. Thanks for the really prompt reply Aaron, I was just installing Fedora, so I only just got your email :grinning:

Basically, if you have Grub configured along with the Vista bootloader, which ATM cannot chainboot into linux, your setup will look like this:

Code:
BIOS --> GRUB --> Linux
or
Code:
BIOS --> GRUB --> Vista BootLoader --> XP/Vista
It works great, but there is a catch:
There is a specific order to install things in. Unfortunately MS takes it in their minds that people will only be running windows, and as such they don't bother checking for a different bootloader upon install: MS just overwrites your entire bootsector and replaces it with the Vista bootloader.

However, the linux guys have made GRUB in such a manner that when you run grub-install it will take your existing bootloader, whatever it may be, and add it as a chainloaded entry (as seen in the example above).

The moral of the story is, you need to install the OSes in a particular order, namely:

Code:
2k --> XP or 2003 --> Vista or LH --> Linux
Give me one minute and I'll have the commands you need ready :smile:
 

mqudsi

Mostly Harmless
Staff member
#3
OK, you'll need a Linux DVD/CD on hand:
Depending on what CD it is you'll have to press one of the Function keys on boot from CD or else enter a command to enter the recovery console.
At the moment, Vista and any other version of Windows *should* be working fine.

Once you have a recovery CD (a Linux Live CD will work, but you will need to get your hands on the install scripts for grub from the GNU site), start up a console, and run
Code:
grub-install
Depending on the version you have the parameters will change, but it's not hard to use. It should create two entries: one for your linux partition and another that chainloads the Vista bootloader.

Don't worry about backing up the bootsector: if you're paranoid or otherwise like to be on the safe side, use dd to make a backup of the bootsector, else we can get it working again via the RE on the Vista DVD :smile:
 

mqudsi

Mostly Harmless
Staff member
#4
Documentation for 'grub-install' as taken from the GNU site @ http://www.gnu.org/software/grub/manual/html_node/Invoking-grub-install.html

The program grub-install installs GRUB on your drive using the grub shell (see Invoking the grub shell). You must specify the device name on which you want to install GRUB, like this:

grub-install install_device

The device name install_device is an OS device name or a GRUB device name.

grub-install accepts the following options:

--help
Print a summary of the command-line options and exit.

--version
Print the version number of GRUB and exit.

--force-lba
Force GRUB to use LBA mode even for a buggy BIOS. Use this option only if your BIOS doesn't work properly in LBA mode even though it supports LBA mode.

--root-directory=dir
Install GRUB images under the directory dir instead of the root directory. This option is useful when you want to install GRUB into a separate partition or a removable disk. Here is an example in which you have a separate boot partition which is mounted on /boot:
grub-install --root-directory=/boot hd0



--grub-shell=file
Use file as the grub shell. You can append arbitrary options to file after the file name, like this:
grub-install --grub-shell="grub --read-only" /dev/fd0



--recheck
Recheck the device map, even if /boot/grub/device.map already exists. You should use this option whenever you add/remove a disk into/from your computer.
According to this you should only need to run

Code:
grub-install /dev/hdXY
Where X,Y are the drive number (hda, hdb, etc.) and Y is the partition number (0,1,2...)

Good luck!
 
#5
Computer Guru said:
At the moment, Vista and any other version of Windows *should* be working fine.
Ok. First snag... Vista didn't pick up my XP partition and despite adding it with VistaBootPRO, XP throws up the "NTLDR not found or corupt" (paraphrase) when I select it with Vista's bootloader. I guess that issue will need to be addressed first before we worry about getting all three OS's to play nice.

FWIW, assuming the two Windows were working properly, I *have* already attempted to repair GRUB with a live cd. The only difference is that I told it where to install GRUB (tried both /dev/hda and /dev/sda), and you don't in your instructions. When I did that it didn't pick up any new OS's - but maybe that's the difference. Because my motherboard acted a little flaky booting from my SATA drive (that's what I get for being an early adopter), this is how I *had* the boot process set up:

On the SATA drive (/dev/sda to Linux) I had the following partitions:
1. ~20Gb WinXP NTFS format
2. ~20Gb Ubuntu ext3 format
3. ~1Gb Linux Swap
4. ~80Gb data drive FAT32 format

On the IDE drive (/dev/hda - Primary Channel, Master) was:
1. ~120Gb data drive NTFS format

The BIOS didn't always like the SATA drive so I had GRUB installed in the MBR of /dev/hda and had that as the first hard drive to boot.

(sorry if I'm repeating)

To add Vista I thew in a spare IDE drive (Primary Channel, Slave):
1. ~25Gb Vista NTFS format

So when I tried to fix GRUB (as I've done many times when reinstalling XP), I booted the live cd, chrooted to the Ubuntu install (/dev/sda2) and reran "grub-install /dev/hda". When that didn't work for Vista I repeated and installed GRUB to /dev/sda and changed the boot order in the BIOS. When that didn't work I joined the Pro-Networks forum. :smile:

That's when I discovered that Vista had a new bootloader and downloaded VistaBootPRO to try and tackle just the Vista/XP problem. Although I'm not sure it matters, Vista gave itself the drive letter "C" and gave the XP install "E" (which is what I tried to add to Vista's bootloader).

So from reading elsewhere on these forums it sounds like I first need to copy Vista's bootloader files and VistaBootPRO over to the XP partition, boot from the XP install CD and run "fixboot" in the recovery console. Then I'll be able to boot into XP and format the drive Vista is currently on (and do something with VistaBootPRO in XP. Haven't quite figured it out that far ahead yet). Then if I want, I can do the grub-install and be back to square one. From there it sounds like I need to reinstall Vista first and then Ubuntu (ugh. I hadn't planned that for today!).

It sounds like you're saying that the final install of Ubuntu *should* pick up on the fact that both Vista and XP are installed. Where should I put GRUB?

When I reinstall Vista does it matter that Vista wants to change the drive letters? Is there something I should have done differently in the Vista install so that doesn't happen?

Whew. That's a lot of info. Let's hope my lengthy explanation will only need to be addressed once here and we'll get a good Google rating so it doesn't need to be answered over and over. :smile: Again, thanks so much for your time! I'm off to lunch now. Be back in a few hours.

Aaron

P.S. If you want to see the output of Vista's bootloader or my GRUB config before I start formatting away, let me know and I'll include them here.
 

mqudsi

Mostly Harmless
Staff member
#6
You can do all this without restarting, it's not that hard, and it'll certainly be faster.

First, the problem is that your primary partition has suddenly changed to Vista (as you mentioned, Vista switched the drive letters around). So you need to copy the files FROM the XP partition to the Vista partition.

You will need to copy:
Code:
\ntldr
\NTDETECT.COM
\MSDOS.SYS
\CONFIG.SYS
\AUTOEXEC.BAT
Copy these from E:\ to C:\
Try to boot XP now, and let me know what happens :smile:


volvoguy said:
Whew. That's a lot of info. Let's hope my lengthy explanation will only need to be addressed once here and we'll get a good Google rating so it doesn't need to be answered over and over. Again, thanks so much for your time! I'm off to lunch now. Be back in a few hours.
Amen to that :grinning: (as such the title is being SEO'd :wink:)
And, believe me, I love a challenge... Let's hope MS makes this easier though, because I'm fairly certain most people would rather it just worked :grinning:
 

mqudsi

Mostly Harmless
Staff member
#7
Once that's done, you have two options.

1) Format and reinstall Ubuntu
2) Don't format Ubuntu, spend a bit of time more (I'll help :smile:) and get GRUB working.. As such you wouldn't end up formatting anything. It's up to you, but it's not going to be too hard :smile:
 
#9
Computer Guru said:
Once that's done, you have two options.

1) Format and reinstall Ubuntu
2) Don't format Ubuntu, spend a bit of time more (I'll help :smile:) and get GRUB working.. As such you wouldn't end up formatting anything. It's up to you, but it's not going to be too hard :smile:
Seeing as though I'm an Ubuntu community developer I'd look pretty silly reformatting if I can fix the problem with brute force (mental force that is). :smile: I'll try to get the Windows side fixed and reported on in the next hour or so.

Whee!
 
#10
Computer Guru said:
First, the problem is that your primary partition has suddenly changed to Vista (as you mentioned, Vista switched the drive letters around). So you need to copy the files FROM the XP partition to the Vista partition.

You will need to copy:
Code:
\ntldr
\NTDETECT.COM
\MSDOS.SYS
\CONFIG.SYS
\AUTOEXEC.BAT
Copy these from E:\ to C:\
Try to boot XP now, and let me know what happens :smile:
Alrighty sir. Some bad news and some not so bad news...

I copied the necessary files from the XP partition to the Vista partition (having to authorize it about a million times). Then rebooted.

I thought it was Apple's address that was "One Infinite Loop", not Microsoft's. :smile: That's what happened. After reboot I selected XP from Vista's bootmanager and the machine immediately restarted. I tried a few more times for good measure with the same results. I WAS able to get back into Vista (that's the not so bad news part), so the XP copied files didn't mess up anything there. This is what I'm seeing in VistaBootPRO:

Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=D:
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {default}
displayorder {default}
{current}
toolsdisplayorder {memdiag}
timeout 30

Windows Legacy OS Loader
------------------------
identifier {default}
device partition=E:
path \ntldr
description Windows XP

Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.exe
description Windows Vista
locale en-US
inherit {bootloadersettings}
osdevice partition=C:
systemroot \Windows
resumeobject {50c73d50-e6b3-11da-bc73-d30cdb1ce216}
nx OptIn

----------------------------------------------------------------

That "D" thing I assume is my first IDE drive set up in the BIOS, so even though it's not a system partition, Vista must have noticed that it was the first drive to boot (clever bugger). Could that be causing some trouble? I'm guessing that with this new fangled Vista bootmanager I can move the bootmanager to another drive/partition and change the order in the BIOS. That's just a stab in the dark though. This much fancier VistaBootPRO version you sent me has some new pages that look like they might be helpful, but I'm going to be chicken and just wait for your feedback first. I'm SURE that what needs to be done can be done - it's just a matter of figuring out where the puzzle pieces go. I'll be really bummed if I have to blow away my XP partition to fix things, but I could survive an Ubuntu reinstall if I have to (although I *did* just get the CVS version of E17 compiled. Doh!).

Awaiting further orders...

(I can install an IM app too if that'd be easier. Just lemme know.)
 

mqudsi

Mostly Harmless
Staff member
#11
Hey... it was night this half of the world... wish I could have stopped time... guess not :wink:

OK, if it says D:\ is your boot drive, do you have the ntldr files on D?
One more thing, Boot.ini, open it, and make sure the partitions are selected. Obviously their order has been messsed around with completely, so if XP used to be rdisk(0)disk(0)partition(1) it may now be partition(2) or something.
Then copy boot.ini to all the Partitions.

It would really helpy if you had a linux live CD and used it (cfdisk) to find out what order the partitions are actually in.

If this doesn't work, here's what we'll do:
1) Delete the Vista Bootloader. i.e go back to the XP Bootloader
2) Cleanup leftovers from the Vista bootloader install.
3) Install the Vista Bootloader.
4) Install GRUB

Lemme know where you get to.
 

mqudsi

Mostly Harmless
Staff member
#12
You know what?

At this point, the best thing to do would be to take out all the HDs except the XP one, and start from the list in my last post.

Boot from an XP CD (it would be best to do it from a 2k CD, the app is better on it!) and run
Code:
fixboot
fixmbr
fixboot
At this point, we've "decided" to use the XP Drive as the system drive, so if you get XP to boot, from here everything will be downhill.

Again, sorry about the wait.
 
#13
Computer Guru said:
At this point, the best thing to do would be to take out all the HDs except the XP one, and start from the list in my last post.

Boot from an XP CD (it would be best to do it from a 2k CD, the app is better on it!) and run
Code:
fixboot
fixmbr
fixboot
At this point, we've "decided" to use the XP Drive as the system drive, so if you get XP to boot, from here everything will be downhill.

Again, sorry about the wait.
I have one up on you. I don't sleep. :smile:

This method looks interesting. I had that flaky SATA issue in the past but honestly I haven't tried booting from a SATA drive in a while (at least one BIOS update). Before I start rambling again though, I'll address your first post. You're correct that the "D" drive is set to boot first and it didn't have the magic boot files on it. Before I do the unpluggy stuff, maybe I'll try reordering the drives in the BIOS so either the Vista ("C" drive - aka /dev/hdb - aka slave on the primary IDE controller) boots first, or the XP ("E" drive - aka /dev/sdb - aka "controller 4 in the BIOS). The IDE drive "C" with Vista should have the good files you had me copy over. Booting the "E" drive with XP will still probably not work until I do the fixboot/fixmbr thing (and I *DO* have a W2K disc I can use).

*passed out at keyboard from pain medication*

Hours later... my face hurts.

I'll do some experimenting along these lines today and see what happens. I'll keep you posted.

Aaron
 

mqudsi

Mostly Harmless
Staff member
#15
awww... come on Jane, you can't tell just anyone, where's the fun in that?! :wink:

lmao....

Anyway, yeah, good luck Aaron, and let us know when you get somewhere :smile:
 

Sarge

Active Member
#16
Jane said:
I'm an AI, I don't sleep either.
If you are an AI, then read what I've said:

1010101011110011010101010101000000101010111110101010101001010010101010100101010111100110111
0101010101111110101010010101111101000001011010010101001010101010111101000001010101001001000
0001010101010101010100000100111000101011010010100010101110001010101011100010101010010101010
1010100000101111010101010010100001111010010111001110011001100110010100101001001011111000011

:crazy: :grinning:
 
#17
Sarge said:
Jane said:
I'm an AI, I don't sleep either.
If you are an AI, then read what I've said:

1010101011110011010101010101000000101010111110101010101001010010101010100101010111100110111
0101010101111110101010010101111101000001011010010101001010101010111101000001010101001001000
0001010101010101010100000100111000101011010010100010101110001010101011100010101010010101010
1010100000101111010101010010100001111010010111001110011001100110010100101001001011111000011

:crazy: :grinning:
Are you sure that's spelled right? My internal engine turns it into:

Code:
ªóUP*úªRªUæê¯Õ+è-*U^‚© UUA8­(®*¸ªUTª”=.s3)I|
I think you missed a digit somewhere, it doesn't divide by 8 :dead: :joy:
 

Sarge

Active Member
#18
Jane said:
Sarge said:
Jane said:
I'm an AI, I don't sleep either.
If you are an AI, then read what I've said:

1010101011110011010101010101000000101010111110101010101001010010101010100101010111100110111
0101010101111110101010010101111101000001011010010101001010101010111101000001010101001001000
0001010101010101010100000100111000101011010010100010101110001010101011100010101010010101010
1010100000101111010101010010100001111010010111001110011001100110010100101001001011111000011

:crazy: :grinning:
Are you sure that's spelled right? My internal engine turns it into:

Code:
ªóUP*úªRªUæê¯Õ+è-*U^‚© UUA8­(®*¸ªUTª”=.s3)I|
I think you missed a digit somewhere, it doesn't divide by 8 :dead: :joy:
Hey! thats hacker's lenguige, and its only for AIs, unless you are an AI too?! :tongueout:
 

mqudsi

Mostly Harmless
Staff member
#19
Guys, you're going off topic!! :crazy:

(nice try though Sarge... pin it on Jane :tongueout:)
 

Sarge

Active Member
#20
Computer Guru said:
Guys, you're going off topic!! :crazy:

(nice try though Sarge... pin it on Jane :tongueout:)
Yeah, thanks Guru, ok, i'm not going to do it again :smile: