Intro : First, GRUB was erased. After fixing it, XP did not boot from GRUB owing to ‘ERROR 12’. Lastly, How I could fix both, rather discovered work-around for some part.
Recently I faced the first battle arising from the conflict between Windows and Linux. Thanks to Linux, I won it 🙂 .Let me give you a brief history of the problem.
I had to format my friend’s hard disk for some reason and connected it to my comp. Here, the sane me should have relied upon Ubuntu Live CD and formatted the whole thing. But the insane me chose to rely upon Windows. So, I used Partition Magic ver 7.0 and tried to do the job, but failed miserably. After a few more futile attempts, the Insane me decided to rely upon Windows again. I used the WinXP Pro installer CD and wished to format the slave drive through DOS. Voila! It worked. My friend was too happy and left my place cheerfully!
Now, I switched ON my PC after sometime and to my horror, didn’t find the GRUB. (GRUB – GRand Unified Bootloader; somewhat similar in concept to the OS-selection menu in Windows) WTF!!! What did Windows do to my GRUB? Being a newbie to Ubuntu, I was clueless. I tried hopelessly to somehow fix it up by using the live CD. FUCK! No success. Then, I browsed through the web from the Live CD itself and found this link which was very helpful. (Plz go through the link to understand what is written further)
Assuming that u’ve gone through the link I’ve given above, I’ll use a few terms without any explanation. I created the GRUB diskette as described in the above link. After leaving the diskette in the floppy drive, I rebooted the PC.
Run the system BIOS. Make sure you’ve specified the boot device priority in this order : 1st – Floppy drive, 2nd/3rd – CD Drive/Hard disk. Save changes and exit. Now, the PC reboots again and something like this appears.
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
First, I specified the root drive where GRUB has to be installed, by this command
grub> root (hd0,4)
hd0 – My 1st hard disk.
4 – the partition number on the first hard disk where GRUB is to be installed.
Generally speaking, the ‘n’th partition of the ‘m’the hard disk is written as (hd[m-1],[n-1]).
Next, I’d to setup the GRUB, and this command did the job.
grub> setup (hd0)
This command sets up the GRUB on the root drive specified. Simple enough right? 😉 Now, remove the floppy diskette, change the 1st boot device priority to hard disk and reboot. A round of applause ladies and gentlemen, a novice just meddled successfully with GRUB, MBR (Master Boot Register) and a few alien things, of whose importance I know little about! 😀
But my sigh of relief was shortened when booting into XP was not possible 😦 . Ubuntu could not mount the XP drive even at startup and I was left clueless again. Fuck! 😦 I thought about it for a while and tried out something which would turn out successful. Here is what I did.
- Make the 1st boot device as CD-ROM by following the procedure mentioned earlier.
- Insert XP installation Disc into the tray.
- Let it do all the pre-install-setup-bullshit.
- When it asks if you wish to install XP or repair using Recovery console, press ‘R’ which means the latter option.
- It scans your hard disk for available XP installation and asks you to select the one you choose to repair.
- Enter the Number specified against the Installation you wish to repair and press ‘Enter/Return’ key.
- Type this command and press ‘Enter’ key.
- This thing checks the apparently inconsistent FAT/FAT32/NTFS/NTFS-3g disk drive for volume errors and fixes them.
- Now boot into Ubuntu or any other distro and go to the drive where you’ve an installation of XP.
- Copy the files “AUTOEXEC.BAT”, “boot.ini”, “CONFIG.SYS”, “IO.SYS”, and “MSDOS.SYS” into some other drive. Congrats! You’ve just made an alternate “boot sector” for WinXP 😀 . Please note the partition number of the destination drive.
- Now, to edit the GRUB menu : open the all powerful ‘Terminal’ and type the following command
sudo gedit /boot/grub/menu.lst
- Provide your password. The window opening now is the ‘menu.lst’ file which determines which OS boots from which partition. scroll down to last to find something like this :
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian
title Other operating systems:
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title MS WinXP Pro
- I’ve ‘bold’ed the parameter to be changed in the above sequence.
- Primarily, my XP partition was (hd0,0). But, in the above visual, it shows (hd0,1). That means, I’ve changed the drive, which XP seacrhes for the boot sector to exist.
- In your case, If the files you’ve to move are in the 1st partition of your first hard disk then it should be as (hd0,0) in the GRUB menu file, initially. If you are copying the files to the 2nd partition of the first hard disk, then change the ‘bold’ part to (hd0,1) as in my case. As said earlier, the ‘n’th partition of the ‘m’the hard disk is written as (hd[m-1],[n-1]). Save the file and close.
- That said, make the change only in the ‘bold’ed part and NOT anywhere else, because, I CANNOT help you with the problems arising out from that.
- Reboot your PC and you should be able to boot int XP. (Atleast, I could do it in my case, and so, since there is nothing much to meddle with the hardware, your problem should be solved too.)
Important part : Disclaimer : I’m a novice and did many things (esp the latter half) according to my instinct/intuition and was not guided by any tutorial either on the WEB or on paper. So, it is up to you to believe in me and perform all these, the proof of whose working is the successful re-birth of my PC without any damage, and through which I’ve written this post 😛 .
I do not know the persom whose link I’ve provided here. Whoever you are, thank you very much, man. You revived my hopes 🙂 .
If anyone else faced the same problem and solved it in a different way, Please let me know. If any pro’s or Ubuntu/Linux Gurus find this stupid, please educate me further.
And so ended my first adventure in Ubuntu 🙂 . Hope I see much more and learn much much more! 😀 Thank you for being here.
23 thoughts on “[How To:] Fix the problem when XP doesn’t boot from GRUB”
The HOW TO is nice. But it does lack description. The first thing being what exactly was the problem you encountered. Because Error 12 turns up in many hard disk related problems. As you don’t know EXACTLY what happened with your installations, the how to applies only to your PC temporarily. Even if someone has a different problem and searches for these keywords to help him out, he might actually be screwing his PC even further. So you need to be PERFECTLY sure what was the problem, why the error was shown and what exactly you did in order to write a proper HOW TO. I hope you don’t mind the criticism. That too in the first comment itself.
Very good how to post. U can share with Digital Inspirations 🙂
All is greek and latin to me!! 😦
I think I understand your concern. But, at the end of the day, my PC was fixed and the method isn’t machine-dependent or vague. so, i suppose it’ll pass off your criticism, although with a li’l rough ride 😀
Thnx a lot! 🙂 I hope it helps someone I’ll see DI asap. 🙂
Neva mind! next post should interest you. be here on monday at 9 am. 🙂 (WP time 😛 )
my grub is perfect 🙂 but xp has crashed ,goes to disk check and hangs !
i believe i have to format c drive and reinstall xp 😦 but i cant get the CD ..so happy using ubuntu for now 🙂
lol…a geek in making !
there is no ntfs-3g filesystem, its just a driver to access ntfs filesystem from linux.
You could have restored grub using Ubuntu live cd or knoppix (its the best linux live cd). Alas…I dont have floppy drive connected to my system.
Choose what is right! but be careful while installing XP. Windows over writes the MBR-Master Boot Register and hence disables GRUB. U may have to restore GRUB like I did. 😛
Thnx a lot for the correction dude 🙂 I dunno anything about Knoppix yet. ‘l see wht it is asap.
“A geek in the making!” – At the end of the day, i would be more happy if i won over Windows. It can drive me crazy sometimes 😀 😆
[…] : Who is GOD? , [How to:] , 7th Semester Nostalgia! , Interview, Awards and the ‘Su’ Secret , Ubuntu […]
Merry Christmas to you harsha 🙂
Wow…good you came out of that unscathed! I also upgraded to Intrepid Ibex recently and had to tweak some stuff to be able to do a clean install….
Adventure mode eh? 😉 its so good to play with the comp and learn things! 🙂
MBR stands for Master Boot Record !!!
There is something called Hiren’s Boot Disk. You might find that more interesting and useful too.
thnx a lot for the correction. 🙂 i guess it happens with newbies. Could u give me a link to reach Hiren’s Bot Disk, just in case i dont get good result by googling it up. 🙂
If you don’t get it by googling how can I help you out !!! 🙂
I googled for it and could find it 🙂 thnx a lot!
I Arif a Software Engg from Bangalore, I have developed a tinty utility for Windows OS, which help you perform your day to day task quickly and makes them easier.
I am requesting you to use it for sometime, do blog about it, only after you like it.
Thanking in advance for your consideration.
Sorry about posting it here, but i could not find your personnel email Id to send this email.
Why all Indian authors starts their articles with some great lies.
well… enlighten me!
u have to logge in su?
San Antonio Computer Repair
You have to log in as an admin or use it as a sudo user wit admin previleges…