LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Grub problem after windows reinstall (https://www.linuxquestions.org/questions/linux-newbie-8/grub-problem-after-windows-reinstall-608188/)

edencraze 12-20-2007 01:49 PM

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... :-@

hasanatizaz 12-20-2007 02:12 PM

i am another victim.

b0uncer 12-20-2007 02:27 PM

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

mrrangerman 12-20-2007 02:35 PM

Not to worry Here is a good Grub Howto look at B4-5.

rickh 12-20-2007 03:54 PM

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.

mashish 03-23-2008 09:53 AM

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?

Duck2006 03-23-2008 10:06 AM

Some light reading on installing grub from the live ubuntu cd.

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


All times are GMT -5. The time now is 05:06 PM.