Reinstall GRUB bootloader after windos wipes it out

abhishek_a01

OSNN Addict
Joined
4 May 2008
Messages
89
If you run a dual-boot system with Linux and Windows, this has happened to you. You had to do your monthly reinstall of Windows, and now you don't see the linux bootloader anymore, so you can't boot into Ubuntu or whatever flavor of linux you prefer.
Here's the quick and easy way to re-enable Grub.
1) Boot off the LiveCD
2) Open a Terminal and type in the following commands, noting that the first command will put you into the grub "prompt", and the next 3 commands will be executed there. Also note that hd0,0 implies the first hard drive and the first partition on that drive, which is where you probably installed grub to during installation. If not, then adjust accordingly.

sudo grub
> root (hd0,0)
> setup (hd0)
> exit

Reboot (removing the livecd), and your boot menu should be back.

Only read below if Windows is now missing from the boot menu
If you installed Ubuntu before you installed Windows, then Ubuntu will not have anything in the grub configuration for Windows. This is where you'll have to do a bit of manual editing to the grub boot menu file.
If you open the file /boot/grub/menu.lst with the following command:
sudo gedit /boot/grub/menu.lst
You'll see a sample section for Windows, which you'll want to uncomment and add to the boot menu list in whatever position you want it in. (uncomment by removing the #'s)

# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1

Note that you should also verify that hd0,0 is the correct location for Windows. If you had installed Windows on the 4th partition on the drive, then you should change it to (hd0,3)
 
i guess because linux people think person will shift from windows to linux not from linux to window. So if anyone first installed linux then there is lot more chance he won't go for window. But this is vice versa if person install window first :)
 
Monthly reinstall of windows? Whatever for? Both are stable enough for me that I have not reinstalled anything.

What if you are using the LiLo bootloader?
 
i guess because linux people think person will shift from windows to linux not from linux to window. So if anyone first installed linux then there is lot more chance he won't go for window. But this is vice versa if person install window first :)
I thought Carpo was making a statement or a lament, but you seem to be answering him like it was a question.

Windows is almost always installed first anyway, because almost all PCs are sold with Windows installed. And the few people that buy a PC without Windows are usually savvy enough to want something better. :p

But if you are installing everything from scratch, there is a very good reason to install Windows first. Windows assumes it owns the machine. It is not designed to play well with competitors. So for best results, install Windows first and then install any other OS you want, which will surely behave like a gentleman and not try to take over the MBR unless you ask it to.
 
I thought Carpo was making a statement or a lament, but you seem to be answering him like it was a question.

Windows is almost always installed first anyway, because almost all PCs are sold with Windows installed. And the few people that buy a PC without Windows are usually savvy enough to want something better. :p

But if you are installing everything from scratch, there is a very good reason to install Windows first. Windows assumes it owns the machine. It is not designed to play well with competitors. So for best results, install Windows first and then install any other OS you want, which will surely behave like a gentleman and not try to take over the MBR unless you ask it to.

oh i thought it was question. nways thanks...
 
Monthly reinstall of windows? Whatever for? Both are stable enough for me that I have not reinstalled anything.

What if you are using the LiLo bootloader?

just type liloconfig and remake it, and yes the above reply was a statement and not a question, because if it was a question it would have had a ? at the end of it :p
 
Useful info. I've done this while already dual-booting XP/Linux then installing Vista.
 
...which will surely behave like a gentleman and not try to take over the MBR unless you ask it to.

Having just had the unfortunate experience of installing XP and then UBUNTU intrepid Ibex twice each I can confirm that the Ibex is no "gentleman"! So the moral of the story is always expect the unexpected - the partitioner in Ibex has issues and royally screwed me (partly my fault, should have planned ahead and done a little googling research, but easy to be wise after the event!).

Always expect the unexpected! :D
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back