Sunday, April 13, 2008

FreeBSD and Windows Vista - Bootloader Problems


Taken from http://www.clearchain.com/wiki/FreeBSD_&_Windows_Vista



The Problem

After installing Windows Vista Enterprise Edition, I very quickly wanted to get back to FreeBSD. As per previous versions of Windows, Vista does a great job of overwriting the Master boot record (MBR). Unlike previous versions of windows, you cannot just install a different boot loader in the MBR - so I found out the hard way. (It used to be sooo easy fdisk /mbr would fix any broken boot sectors, then just install your favourite boot loader).

Vista writes a unique disk id in the MBR. This unique id (UID) is used by Vista to determine what disk is what. It does make some sense, Hardware can shift around, but the UID should always be the same. This allows Vista to always know where it's files are and to appropriate label drive C: as the correct drive.

Installing another boot loader, however (ie Grub, lilo, the FreeBSD boot0 / boot loader /boot manager) will overwrites the UID in the MBR and Vista fails to load with an error:

"unable to access \windows\winload.exe"

The error message is semi appropriate but very misleading. What it really should say is "I can't work out which of my the drives has my files on it hence I can't find winload.exe".


Existing Solutions

Out on the web there is many solutions to the dreaded winload.exe. Many of them are misleading, some I believe are not even tested. Also many apply to Vista Release Candidate 1 (rc1) which I believe didn't required the UID to be present in order to successfully boot. Below is some of the solutions that people say work (but Ifound didn't).

Using Grub


Some say grub loading windows with something like:

Title Vista
root (hd0,0)
makeactive
chainloader +1

will work - but grub still over writes the MBR hence the same issue will occur - though you may be lucky as the grub MBR is really small (and might leave the UID) untouched.

Using gag

There's reports on a FreeBSD mailing list that gag will work, thought I'm running FreeBSD/amd64 which gag or grub for that matter won't compile on. I know I could always install the lib32 compatability distribution to use it but I wanted the default FreeBSD boot loader.

Using the Vista Boot Loader

Many people have given up on trying to use a normal boot loader, and instead use the Vista boot loader.


The WinXP/NT bootloader (ntldr & config file boot.ini) have been replaced with files winboot.exe and bcedit.exe for configuration.

Theses commands could be setup to boot other operating systems though your milege may vary.

Commercial Software

Many people have decided it's all too hard and gone and purchased software to handle it for them - there's lots out there

Utilities

There is many utilities that claim to fix the issue. One such util is MBRFix.exe, this fixes the fact that vista won't boot but it will clobber any boot loader you have got installed.

The Fix (That Worked)


The simple fix is to tell Vista that the drive it boots off of will always be the drive it can find its files on. This way you can clobber the UID in the MBR as much as you want and Vista won't care. To do this you run:

BCDEDIT /set {bootmgr} device boot
BCDEDIT /set {default} device boot
BCDEDIT /set {default} osdevice boot

This can be run from either the Vista repair cd, from within Vista, or from something like http://www.ultimatebootcd.com (For Windows).

Conclusion

Hence it IS possible to run Vista with any boot loader that you like - in my case the FreeBSD boot loader is the one of choice.

No comments:

Post a Comment