LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-20-2007, 01:49 PM   #1
edencraze
LQ Newbie
 
Registered: Dec 2007
Posts: 17

Rep: Reputation: 0
Unhappy Grub problem after windows reinstall


I have a situation here where i am unable to load linux after i reinstalled windows xp. Before the windows reinstall i had the grub multi-bootloader and using this i chose which operating system to load. Now after reinstalling windows xp, i completely lost the grub os selection interface. This has disconnected me completely from linux (Ubuntu distro). Please find me a solution to get grub fixed (from windows) without reinstalling linux (Ubuntu distro).



Windows sucks!! It thinks it is the BOSS... :-@
 
Old 12-20-2007, 02:12 PM   #2
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat and Debian
Posts: 302
Blog Entries: 1

Rep: Reputation: 34
i am another victim.
 
Old 12-20-2007, 02:27 PM   #3
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
The reason to the situation is this: Grub is installed (unless you manually made it different) to the MBR (master boot record) of the harddisk, the place where BIOS looks for bootloaders. Actually in Grub's case there's a part of it (stage1) and part of it is stored into the /boot partition of your Linux distribution (stage2). Mainly the necessary parts are in MBR, configuration files are read from the disk (compared to LILO, which is completely in MBR, but is not as dynamic to configure, for example). Now when you reinstalled your Windows, it didn't ask you if you want to install a bootloader, it did it without asking - installed the Windows bootloader, which is also installed to MBR. That means it overwrote that part of Grub that was in MBR. Your Linux installation is perfectly safe, you just can't boot into it without a boot disk

Well, have you got the Ubuntu Desktop disc still somewhere? If yes, then that does. It's a live-cd you can use to boot. After you boot, you can mount your harddisk-Linux-partitions and use chroot to change the working root directory to be "in the harddisk" rather than in the virtual filesystem created to RAM when running the live-cd. There are detailed instructions about this procedure on the web, so read those. After that you can reinstall Grub (using 'sudo grub-install /dev/sda' if /dev/sda was the harddisk whose MBR you want to write Grub to - primary SATA drive, for example), and add your Windows boot section to /boot/grub/menu.lst (or just run 'grub-update' to have it search it automatically), reboot and enjoy your life again.

The "tricky" part in that is, after booting the live/Desktop cd, to change the environment so that the Grub installation is made to the disk, working in the harddisk's filesystem, and not in the virtual filesystem of the live-cd. But like I said there are good detailed instructions on how to reinstall Grub using a live-cd on the net.

Reinstalling whole Ubuntu is a bit overkill..all you need to do is get the MBR "fixed", the first 512 bytes of your harddisk. Actually it's a good idea to make a backup of your MBR when you have it still working; create an image file, which you can later easily push back if you happen to mess up your MBR. Provided that partition information has not changed after the MBR mess-up (you haven't deleted/resized any partitions) you can just copy the small image back and reboot. Using 'dd' command in any Linux live-cd and maybe a USB media to save the image file on this is a real lifesaver..
 
Old 12-20-2007, 02:35 PM   #4
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 50
Not to worry Here is a good Grub Howto look at B4-5.
 
Old 12-20-2007, 03:54 PM   #5
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 60
What you really should have done is clicked the button that said, "Look for similar posts," before you submitted this one. You can still get the help you need by looking at the "Similar Posts" section at the bottom of this page.
 
Old 03-23-2008, 09:53 AM   #6
mashish
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Unhappy how does it work properly

Hi Techies,

I hv FC3 installed, and now got to re-install winXP, so after that i tried to reload grub using a live CD, ubuntu as told by many forums

# sudo grub
grub> find /boot/grub/stage1
grub> root (hd0,7)
grub> setup (hd0)
grub> quit
# reboot

but all got messed up, and got to reinstall windows again,
can anyone show the correct way?
 
Old 03-23-2008, 10:06 AM   #7
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
Some light reading on installing grub from the live ubuntu cd.

http://users.bigpond.net.au/hermanzo...b_with_Live_CD
 
  


Reply

Tags
reinstall, windows


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to fix GRUB after reinstall windows xp dual boot ctdarksilver Ubuntu 2 05-06-2007 10:35 PM
How to reinstall GRUB after WIndows installation Oracbase Linux - Software 9 11-18-2005 08:43 PM
reinstall windows, reinstall GRUB too? leupi Linux - Software 1 05-07-2005 10:50 AM
What will happen to GRUB if i reinstall windows? ksoma Linux - Software 7 02-04-2004 02:53 PM
Can't get rid of LILO or GRUB bootloaders to reinstall Windows on Laptop CorpChAoS Linux - Newbie 5 11-25-2003 01:23 AM


All times are GMT -5. The time now is 07:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration