/home

Icon

Informations, tips and technics.

Recover grub bootloader with Vista, Xp and Linux (new)

If you have already see my blog, you have already noticed that I have written an how-to several months ago about recovering grub bootloader with Vista and XP. Well, I have recently have to play a little more with this and I want to share with you about the way I have finally manager to get it working (back). Of course, fell free to comment this post if you have any question or suggestions.

I have to tell you about my recent issue with grub and the way I have manager to get it back as long as my different entries for my different OS. The issue happened to me several days ago and took me 1 week to solve.
For for information I have 2 sata controllers on my pc and 3 disks

  • Controller 1 : a Promise SATA TX2PLUS controller
    • Disk 1 : 3 OS (XP, Vista and OpenSuse)
      • Default boot loader is grub from where I have one entry for each OS
      • Partition 1 : XP
      • Partition 2 : Vista
      • Partition 3 : Extended
        • 1 partition for the swap
        • 1 partition for /
    • Disk 2 : some data
  • Controller 2 : Internal Silicom Image SATA Controller
    • Disk 3 : some data

All was working like a charm for several months now since I had to burn some data on a cdrw. I don’t remember the brand of de CDRW.
One inserted, I have the surprise to see that my brand new cdrw was not clean nor empty but have some data in it!! I had then open it in Explorer (I was working with XP at this time) and found an application called InCD Easywrite.

I do not really now what was that. The text displayed tell me that I have to install the InCD application so my DVD/CDRW burner can manager the CD MRW format… See here  for more information about this format.

I hadn’t take the time to google what was that application nor what the CD MRW format was.

Supidly, I  clicked on the setup file and install the program. At the end of the setup, it prompted me to reboot which I have agreed and…

Got this:

bootmgr is missing

I have immediatly try to find some fix about this issue with this application on the Internet with no luck. At that time, maybe because it was late in the evening, I started to play with different solutions found on the internet and some tool that I have in my admin kit (like SuperGrubDisk or other tool to recover the MBR of my disk). I have to confess that I have not took the most professional way to solve this issue.

For what I remember, I have tried the following:

  • Boot the OpenSuse DVD and use the repair tool
    • The operation was successfull but after the reboot, Grub has no color at all and all the entries seems not functionnal at all
  • Try some advanced options with SuperGrubDisk with no luck
  • Try to reset the MBR with a clean one and try again the OpenSuse repair tool, no luck
  • At one point, even if Linux could be booted from Grub, Vista and XP entries gave me those errors.
  • I remember that I have played with the testdisk utility and cleaned my MBR several times.
  • I remember also that I have tested different combination of howto with supergrubdisk and its brug repair tool.
  • I have also played several times with OpenSuse repair option to try to reinstall my grub bootloaded.
  • At one point, I have tried to reinstall Grub but after a reboot, it did not appear anyway

The best that I can have is a bad grub that can’t boot anything.

I have finally take several minute to think about the situation and try to find a logical way to solve my issue.

What I know for sure is that I hadn’t lost any data: I have booted with some linux and xp live cd (yes there are some! see below) and all my partitions are there with their data. So I know that only the MBR and the boot part of the parition are lost.
Ok. I remembered that several years ago I have used the repair tool of XP and Vista to restore there bootloader (the repair console in XP and the startup repair tool when you boot the Vista DVD).

I decided to give a chance to the Vista repair tool to, at least, have one OS that I can boot.

I have tested the automatic repair and also some manual commands like those : http://support.microsoft.com/kb/927392

But I still have some major issues like those boot messages:

BOOTMGR is missing. Press Ctrl+Alt+Del to restart.

I have try several repair attemps with vista and have those different errors:

  • Status: 0xc000000e; \Windows\System\winload.exe “could not be loaded because the application is missing or corrupt:.” – status: 0xc000000e.
  • Some errors when I choose the XP options in Vista boot menu :
    File: \Boot\BCD
    Status: 0xc000000e
    Info: An error occurred while attempting to read the boot configuration data
  • For what I remember, I had also the Status: 0xc000000f error

Ok… At this point I am thinking about using XP repair console to repair my MBR and have at least one OS that can boot.

Unfortunatly, when I booted the XP cd to have the recovery console the install does not show the option at all and ask me instead if I want to install a fresh copy.
But…
One thing that I have noted is that the display order or the C:, D:, E: drives is bad, like the C: drive is listed not as the first drive in the list but in the second choice.
Also, When I have tested my OpenSuse repair grub option, I have see that in the advanced options, the system offer me to install the grub not on the primary disk (sda) but on the other disk (sdb) which make me think that the different OS that I have try to repair all thinks that my default disk (so the disk where the mbr should be repaired) is not the primary but another of my 3 disks! So the disk/partition sequence/order is not good at all.
Instead of playing with the different combination of disk and controller, I have decided to plug only the correct hard drive, meaning, the one with my 3 OS and unplug the others. But just before this, I have make sure that my disk is really bootable, so:

  • Step 0 : Boot with systemrescuecd and check with gparted tool that my disk have the flag boot set.
  • Step 1 : Unplug any other disks that you may have and have only the disk with your different OS

Now, I have only my controller 1 and my disk 1 with all my OS on it.

Fine. now let’s recover XP boot.

 

I have booted with my XP cd, give the drivers and … no recovery console option! Well, I don’t know why the option was not there but I know that I have no really an easy way to get it back.

But, I have found UBCD4WIN (Ultimate Boot Cd 4 Windows). Based on BartPe, you can create an XP live cd with different tool very usefull on it. For me, the most important part was to have a recovery console to play with and have access to my XP partition.

To create it, you will need to have access to an original XP CD (but there is not need of the insall key). Just have you XP CD, a blank CD and just follow the wizard (note : see below to have the mass storage drivers loaded with the recovery console).

  • Step 2 : Check if you can you can use the XP CD recovery console recovery option or use UBCD4WIN. then recover the XP boot

Once booted, choose the recovery console option. From there, you will have to choose which windows you want to access (in my case I have 2 windows, one is xp and the other one is vista) and then enter for admin password (forgot it? ubcd4win have a tool to change it)
then you can use fixboot and fixmbr and reboot

  • Step 3 : Use fixmbr and fixboot to recover your XP boot

At this point you should have an xp running. cool.
But what about vista and linux?
Well we know that now the only MBR that need to be fixed or updated is the disk currently plugged.
So i have booted my opensuse dvd and use the repair option. I told it to re read the configurtion from disk and save all the stuff.
After a reboot, my grub is there! and I can boot xp!.

  • Step 4 : Recover your GRUB bootloader with OpenSuse (or tool with your Linux distro)

Ok, but about Vista?

Well, if the MBR is correct then the only thing needed for vista is to repair the boot partition.
Let boot the Vista DVD and use the command prompt in the recovery option.
from there use bootrec /fixboot, reboot and then grub should be able to boot linux, xp and vista

  • Step 5 : Boot your Vista DVD, access the command prompt of Vista repair option and use bootrec /fixboot

Tada! Now I can plug my other hard drives. But …

  • Additional step : Fix Vista issue with swtiched drive letters

I have noticed that when Vista booted, some strange errors appears at login time and also I saw that Vista think that my C: drive is actually E:!
For some reasons, Vista seems to be confused about the fact that I have unplug some drive and now it was completely lost about the different drive letters order (I really have to check how Vista can switch from his boot driver lettre to C when it has finsihed to boot…).
I have followed those steps 
http://leghumped.com/blog/2007/01/09/change-drive-letter-on-a-boot-device/
Then reboot Vista 1 or 2 times and all show be fine for this OS.

  • Additional step : Finalize your Grub options

Here, I have only modified the name of the entry (Windows XP, Vista) and add also the option 0x317 to the Opensuse boot option to be sure that I boot in a ‘graphical’ environement like it was before.

Here is a list a tools that I have used:
– UBCD4WIN (http://www.ubcd4win.com/). See note below for recovery console mass storage drivers in UBCD$WIN 3.20.
– Your Windows XP CD (sp2)
– Your Vista DVD
Systemrescuecd (http://www.sysresccd.org/) for its gparted tool
Opensuse 11.x (or any livecd distro used to install grub)

Other tools that can be usefull:
– SuperGrubDisk (http://www.supergrubdisk.org/)
– Fedora or Ubuntu Live CD (fedora.org, ubuntu.com)

I will post some update as soon as I can found more detail informations about the different tools involve like the bootsect option in the Vista repair option.

 Note about UBCD4WIN and mass storage drivers in recovery console:

From a post in the UBCD4WIN forum:

MassStorage drivers plugin dosn’t support Recovery Console yet. You may create a plugin yourself.

  • First copy file (UBCD4Win)\plugin\DriverPacks.net\MassStorage.inf to MassStorageCMDC.inf
  • Edit file MassStorageCMDC.inf, use header section
    [Version]
    Signature=”$Windows NT$”[PEBuilder]
    Name=”# DriverPacks.net – MassStorage – Recovery Console”
    Enable=1[WinntDirectories]
    a=”CMDC”,2[SourceDisksFolders]
    MassStorage\wnt5=a

    [SourceDisksFolders.2600]
    MassStorage\wxp=a

    [SourceDisksFolders.3790]
    MassStorage\w2k3=a

  • Next replace all “txtsetup.sif” with “cmdc\txtsetup.sif”
    Example line :
    “cmdc\txtsetup.sif”,”SourceDisksFiles”,”VMSCSI.SY_”, “1,,,,,,4_,4,1,,,1,4”


If you update MassStorage.inf in future, then update MassStorageCMDC.inf too.

Ref : here

Update:

You may encounter the following issue. From Grub, you can boot XP and Linux but Vista display the error message below:

File: \Boot\BCD
Status: 0xc0000034 (0xc00000e or 0xc00000f)
Info: The Windows Boot Configuration Data file is missing required information

And, when you try to repair your Vista installation using the Vista DVD repair options use the rool bootrec/scanos :

Total identified Windows installations: 0

Here is the steps that I have followed to fix this issue.

  • First ve sure to have the bootsec utility on your Vista, XP drive or on an USB drive (it supposed to come with the Vista DVD but you can find it with some tools like EasyBCD, anyway be sure to have it somewhere accessible from the Vista Repair Console)
  • Boot with the Vista DVD
  • Open the Repair Console, then the Command Prompt
  • Identify your Vista drive letter and your XP driver letter (if you have it installed)
    For me Vista is on the E: drive and XP on the C: drive
  • On the XP partition be sure that you have no C:\Boot folder. if you have one, make a backup and then remove it
  • On the Vista partition, be sure that you have a backup of the E:\Boot folder and then delete it
  • Using Bootrec, do 
    • bootsect /nt52 c: (so the XP partition will only boot XP)
    • bootsect /nt60 e: (so Vista partition can boot Vista)
    • bootrec /fixboot
    • You may have to reboot and go again in the Vista Repair Console
  • Now, bootrec /scanos should tell you that it has found 1 Vista installation
  • Try bootrec /rebuildbcd
  • Now for some reasons, the BCD file is located on the C:\ so if I reboot now, the Vista bootloader will again says ‘The Windows Boot Configuration Data file is missing required information’. So, move the file C:\Boot\BCD to E:\Boot\ (move C:\Boot\BCD E:\Boot\) and reboot
  • Vista should boot now.

Filed under: Linux, Windows, , , , , , , ,