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.
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 
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
    Signature=”$Windows NT$”[PEBuilder]
    Name=”# DriverPacks.net – MassStorage – Recovery Console”



  • 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


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, , , , , , , ,

MySQL root password recovery under linux

MySQL root password recovery:

  1. As Linux system root user stop the database process: /etc/init.d/mysql stop
    (or: service mysql stop)
  2. Start MySQL in safe mode and skip the use of the “grant tables”: /usr/bin/mysqld_safe --user=mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --datadir=/var/lib/mysql --skip-grant-tables --skip-networking &
  3. Reset the MySQL root password: mysqladmin -u root flush-privileges password newpassword
  4. Stop MySQL running in safe mode: kill `cat /var/run/mysqld/mysqld.pid`
  5. Start MySQL: /etc/init.d/mysql start
  6. The new MySQL root password can now be used: mysql -u root -p 
    Respond withthe password: newpassword

Find other, information about MySQL under linux, go here.    

Filed under: Linux, , , , , ,

How to log in syslog-ng when the message does not have the hostname field

Depending of you syslog-ng configuration, you may have configured your logging system to write a different at different place (folder created by year and month for ex) and for each different hosts that contact your syslog server.

I will not detail here all the configuration needed for that (or maybe later if you are nice) but I will explain a trick that can help you when the syslog-ng server does not want to create a file for a host and put its messages in the Fallback file. 

Usually, all is working fine with simple filters, like this one :

filter my_filter { host("myserver");};

Here, ‘myserver‘ is in fact the hostname in the message header (should be in third position after the date and the hour/timestamp). Some device may send their messages without the hostname field in the message resulting the log written in the fallback file.

In this case, you can use netmask intead of host, like this:

filter my_filter { netmask("<ip address of the server>/<netmask>");};

for ex : filter my_filter { netmask(““);};

Which should this time make your redirection to work well and the file created for this host correctly.

Note: using /32 does not work at all, use the entire netmask instead.

Filed under: Linux, , , , ,

Recover root password in linux

I will post some comments later but here are some interesting links.

Filed under: Linux, , , ,

bash and time calculation

I could be fun to have a little time calculation when executing a script within a crontab job, so here is a small one:

#!/bin/ksh# At script beginning, get day of month.
BDAY=$(date +%e)
# Get time in seconds.
((BTIME=($(date +%H)*3600)+($(date +%M)*60)+$(date +%S)))

# script

# At script end, get the end day of month.
EDAY=$(date +%e)
# Add 24hrs in seconds, if days don't match.
# It assumes run time is not over 48 hours.
[[ $BDAY == $EDAY ]] && DAY=0 || DAY=86400
# Get the end time in seconds.
((ETIME=$DAY+($(date +%H)*3600)+($(date +%M)*60)+$(date +%S)))

# Calculate and print the time elapsed.
print "Elasped Time: \c"
((HOURS=TOTAL / 3600))
((TOTAL=TOTAL - (HOURS*3600)))
print "$HOURS hours, $((TOTAL / 60)) minutes, $((TOTAL % 60)) seconds."

Ref : link

Filed under: Bash, Linux, , , ,

rsync and ssh

I am currently working on a project that involve doing an rsync session to a server using ssh to secure the transfer. I have found very interesting articles to do this and I post them here in case someone want to read them too:

I will try to post my recipe has soon as I can but I hope those informations and link above can help.

Filed under: Linux, , , ,

Catalyst 7.12 Windows XP and OpenSuse 10.3

As an Sapphire X1950 pro 512 AGP video card owner, I always try to install the latest drivers from ATI to have an up to date system to work and play with. The past 4 months have been quite frustrating for me because since the 7.7 version, Catalyst drivers on Windows, even if they install fine, does not seems to work at all and fail every DirectX tests.

This seems to be a common issue for the NForce2 chipset owner. I have an ASUS A7N8X-E Deluxe.

Here is my setup

  • ASUS A7n8X-E Deluxe, latest BIOS 1013
  • 2 Gb Ram (Dual Channel)
  • Athlon XP 3000+ (core Barton)
  • Sapphire X1950 Pro 512 AGP
  • NVidia Nforce drivers version 5.11
  • AGP Texture Size : 128
  • Other BIOS settings are ‘regular’, no overclocking, no custom timings.

Right now, only the 7.7 drivers have been working fine with my system.

I have decided to compile here some searches I have made to solve this issue and I hope they will work also for me.

  • They are some issues with Catalyst 7.9 and maybe 7.10 so, try those tricks with the latest versions 7.12
  • If you have an NVIDIA NForce 2 chipset and have the latest 5.11 chipset drivers installed, try uninstall them and install the previous one (the 5.10 I guess) instead. Some user recommand to not install IDE and/or GART drivers. Then install the 7.12 and see if DirectX diags work this time
  • Some users have reported that replacing some files may also help:
    – Install the 7.7 working drivers
    – Locate and copy somewhere the file ati3duag.dll (and also the ati3d1ag.dll) somewhere on your disk
    – Remove the 7.7 drivers
    – Install the 7.12 drivers
    – Go in Safe Mode, then overwrite the existing file with the one that you have just get from previous 7.7 drivers installation
    – Restart and see if DXDiag works this time
  • Some users have reported that settings the AGP Texture Size from 128 to 256 seems to have resolved the issue.

Also, you can test alertnate ATI drivers like the one provided by Omega, see here for download.

I have not tested myself those tricks but I will and I will post the result here.

Ref : link, link2, link3

And for Linux now?

Well I have tested the 7.12 on my OpenSuse 10.3 installation and do a very basic installation. I even deleted the existing xorg.conf in case of, ran a sax2 -a to have a blank, working xorg.conf file, runs then sax2 -r -m 0=fglrx and … they do not work right now: sax2 display a black screen after starting a X server and I need to reboot to have access to my system.

Ok, I will test again and spend more time on the 7.12 driver installation on Linux and I soon as I have a working solution, I will post it here.

Stay tuned.

Update (24.12.2007)

Well, the trick to install previous nforce chipset drivers was not working (at last) for me… I will test the AGP Texture Size and the file replacement trick soon and let you know about the result.

Filed under: Linux, Windows, , , , ,

Catalyst 7.11 (8.433) on OpenSuse 10.3

I haven’t posted yet the procedure to install the latest fglrx drivers on OpenSuse 10.3 simply because I haven’t tested yet.

For those you are looking for some informations about the installation process, you can check this web site.

On my side, I will test them as soon as I can and post here the results.


Filed under: Linux, , ,

Simple guide to recover your various boot loader

Update : See there for some other way to recover your grub-xp-vista bootloader

I have previously posted some tips about boot loaders and I think that I have to right a new post with some steps that you can try to recover your various boot loaders, from Grub, XP or Vista. This is not a complete guide since I cannot guarantee to 100% that it will work in all scenario but maybe it can help. I will take my own configuration as an example:

  • OpenSuse Linux 10.3
  • XP
  • Vista

All installed on the primary disk.

Also, the install order is :

  • XP
  • Vista
  • OpenSuse 10.3

As you already read in a previous post, after OpenSuse 10.3 was installed, all boot entries should works and be available in Grub at this time.

Recover your Grub bootloader

  • See my previous post
    Just remember that there is a bug in OpenSuse 10.3 repair option so I have to use another tool

Your XP entry does not work after installing Vista

  • After installing Vista, your old XP entry is correctly listed in the Vista boot loader but a message appear when you try to boot XP : Can’t find file ntldr
  • Boot on Vista, copy the file from your XP partition boot.ini. ntldr and ntdetect.com to your root Vista partition, that should resolve the issue (just remember that those files may be hidden)

The Vista boot loader no longer work

  • First, use the Vista DVD to boot your system and try the repair options. At least, you should have a recovered Vista boot loader.
  • Sometimes, even if the repair was successful and that you can boot Vista, you XP entry does not work. In this case, check the XP entry for the driver letter. (I will post soon what I have on my machine to make things clearer)
  • To ease the troubleshooting, once in Vista, download and use (make a backup of your bootloader first!) a tool like EasyBCD (link) so you can change some settings more easily.

Error in partition table, unable to repair Vista, XP or Grub boot loader

  • In this case, I had the best results by writing a new and clean MBR to the disk using a tool like TestDisk. You can find this tool with the SystemRescueCD (link). Just select your disk and select the option to reset MRB to zero and install a clean MBR.
  • Once done, try again the Vista repair option and other tips in this post.

Just a note : Sometimes, after writing a clean MBR to the disk, it may be necessary to use first the recovery option from the XP cd to install the XP boot loader first. Just boot using the XP cd, then access the recovery console. From here, use the fixboot and fixmbr options. Please check also the command to find, list an recover your XP boot entry. Once you have done that, you should be able to boot at least XP. Then you should proceed with the Vista repair tips.

That’s pretty all for now. I will try to update this post with more details soon.

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

Recover your Grub boot loader

On my system I have Vista, OpenSuse 10.3 and XP installed. I have recently lost my grub boot loader and because of a bug in the last OpenSuse 10.3 repair option in Yast, I could not repair my system anymore using the DVD or the LiveCD.

I will try a new tool called Super Grub Disk and see if it can recover my Grub bootloader. I will update this post with the result. Of course, if you have some tips and tricks that you want to share with others, feel free to post some comments.

Super Grub Disk


Well, the repair process was a real success and I was able to recover by grub menu in few simple steps! I highly recommend this tool and put it in your Linux Swiss army’s toolkit.

Just download the ISO file from the web site and burn it on a CD or you can even put it on an USB key. There is an img file also for those who want to use a floppy.

For the documentation, just check their web site, the process is really simple:

  • Boot the CD
  • Select in the boot menu the default option
  • Select your language
  • A few key press (some informations about Grub, the use of the tool and some warnings about the fact that Super Grub Disk is not perfect).
  • Select the OS,  ‘Gnu/Linux’
  • Choose the option to repair depending how your knowledge. I have selected ‘Fix Boot of Gnu/Linux’
  • Select your Linux partition
  • The system will then perform some checks and will try to repair the Gub boot loader
  • Reboot and check if your Grub is back.

Really a life saver. Maybe this tool could not resolve all the problems that you can have with Grub and your boot loaders but it’s the kind of tool that you should remember the name if you have this kind of problem in the future.

Please also check this post for simple guide to recover your OS boot with various scenario.

Filed under: Linux, , , ,