LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-18-2008, 03:55 AM   #1
Mohit_taneja
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 0
Unable to load Linux after re-installing windows


Hi everyone,

I had a dual boot on my system with Windows XP(sp-2) and ubuntu 7.04. But due to some reasons windows crashed and I had to re-install windows.Now when i start, my computer instead of loading Grub loads windows without detecting the already present linux installation. Now do i need to re-install Grub (If yes, then how) or something else. I also read about using something like a rescue disk, but the live cd that I have for ubuntu 7.04 does not have any such feature.

So, it would be great if someone could help me out with this.
I just hope that I don't have to re-install ubuntu.

Thanks in advance,
Mohit
 
Old 06-18-2008, 04:20 AM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 54
Quote:
the live cd that I have for ubuntu 7.04 does not have any such feature.
but you can use it to boot the machine...

Then mount the linux partition if this is not done automatically.
Check if the contents in /boot/grub/menu.lst are still correct (if you just reinstalled windows they will be and you can as well skip this step).
issue:
grub-install --no-floppy /dev/hdx (hdx being the drive you boot from)
and you are good.
This will reinstall grub as it where - windows always overwrites the bootloader with its own when you install it and I know of no way to prevent it from doing that - so reinstalling grub after a windows install is "standard procedure".
[edit]
I think that works - but it might not...I did not test.

But this will: (change "yourharddisk")
Code:
mkdir /mnt/ubuntu
mount /dev/yourharddisk /mnt/ubuntu
mount -t proc none /mnt/ubuntu
mount -o bind /dev /mnt/ubuntu
chroot /mnt/ubuntu /bin/bash --login
source /etc/profile
grep -v rootfs /proc/mounts > /etc/mtab
grub-install --no-floppy /dev/yourharddisk

Last edited by jomen; 06-18-2008 at 04:32 AM.
 
Old 06-18-2008, 04:41 AM   #3
mamboze
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
I had exactly the same problem about 6 months ago with dual boot Feisty Ubuntu and WinXP. Reinstalling Windows wipes out info on the MBR (or so I understand, I'm a newbie in this stuff too).

At any rate, the solution is pretty straightforward. First of all, get a Super Grub Recovery disk. You can download an iso file here:

http://forjamari.linex.org/frs/?grou...ase_id=620#620

and there's some stuff on Super Grub here:

http://www.linux.com/articles/57240 and elsewhere

Boot from the disk and then follow the menu to get to the MBR repair menu. As I said I went thru all this stuff about six months ago and I don't remember all the details. But the Super Grub menu system has a good help section and is not that hard to follow.

Anyhow, after fixing the MBR, Ubuntu booted perfectly, exactly as before, as you would expect .

Hope this helps

Roy
 
Old 06-18-2008, 04:58 AM   #4
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 54
This recovery disk will probably work - but one has to download and burn it.
Mohit_taneja already has a suitable disk - the Ubuntu live-cd.
With the approach I described the version of grub present on the Ubuntu installation will be used - the potential for version mismatches between grub and its files in /boot/grub is eliminated.
With "chroot" you are using the system itself to do the job.
I have done this lots of times and it seemed the natural and easy solution...the gentoo way
 
Old 06-19-2008, 12:40 AM   #5
Mohit_taneja
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Well, I have fixed the problem.I found that one
needs to re-install Grub in such a case as windows overwrites the MBR
(master boot record).
I booted from the live cd from which i could run grub from terminal " sudo grub"
In grub one can find the location for the root and re assign it and
overwrite the MBR.
"grub> find /boot/grub/stage1"
to find the root this will print the hard disk number and the
partition number for root, you can reassign the root as follows
"grub> root (hd0,2)"
in case the previous command gave this out put which means that the
root or linux is present at the first hard disk and third partition
and then
"grub> setup (hd0)"
to install grub in that hard disk
and then quit
"grub> quit"
now on rebooting the system, my system loaded grub to choose which os
do i need to boot from instead of directly booting Windows.

Thanks,
Mohit Taneja
 
  


Reply


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
unable to load linux kernel praveen22m Linux - Software 2 06-30-2007 10:44 AM
Unable to load Linux (Dual booting with windows) in HP Pavilion w5030 Desktop yatheesh Linux - Hardware 4 07-12-2005 05:26 AM
Unable to load Windows XP using GRUB TheDevo Fedora - Installation 11 11-04-2004 11:16 PM
ipw2200 - Unable to load ucode, unable to load firmware blizinsk Linux - Wireless Networking 2 10-10-2004 09:28 AM
Linux unable to load KDE stpopoola Linux - Newbie 1 09-27-2004 02:39 PM


All times are GMT -5. The time now is 10:47 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration