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)
 

abhishek_a01

OSNN Addict
Joined
4 May 2008
Messages
89
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 :)
 

falconguard

Carbon based lifeform
Political Access
Joined
11 Feb 2004
Messages
3,406
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?
 

KenJackson

Linux Guy
Political Access
Joined
8 Mar 2007
Messages
11
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.
 

abhishek_a01

OSNN Addict
Joined
4 May 2008
Messages
89
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...
 

Dark Atheist

OSNN Veteran Addict
Political Access
Joined
8 Apr 2003
Messages
6,376
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
 

vern

Dominus
Political Access
Joined
2 Mar 2002
Messages
1,572
Useful info. I've done this while already dual-booting XP/Linux then installing Vista.
 

Mainframeguy

Debiant by way of Ubuntu
Joined
29 Aug 2002
Messages
3,763
...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

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.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!

Forum statistics

Threads
62,000
Messages
673,425
Members
5,593
Latest member
moussa021