Fedora Linux Support Community & Resources Center
  #1  
Old 27th May 2004, 07:00 PM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
Reinstalling windows, how do I keep grub?

Hi guys,

I think I'm going to put windows back on my system soon and in doing so I'm inevitably going to lose the grub boot loader from the mbr.

What's the best way to reinstall grub after I've reinstalled windows?
Reply With Quote
  #2  
Old 28th May 2004, 05:30 AM
SuperNu's Avatar
SuperNu Offline
Registered User
 
Join Date: Mar 2004
Posts: 617
If you have a boot disk, or Knoppix, as root, you can mount and then chroot to your Fedora install, type grub-install <device> and you should be fine.

--SN
Reply With Quote
  #3  
Old 28th May 2004, 06:02 AM
manny Offline
Registered User
 
Join Date: Nov 2003
Location: Mexico
Age: 43
Posts: 4
This works for me in FC1:
1 boot from the 1st install cd
2 type: linux rescue (at the prompt)
3 choose read-write (when asked)
4 type: chroot /mnt/sysimage
Now, if you're not sure about your partitions type: fdisk -l (this will remind you about them)
5 ok, now type: grub-install /dev/hda (you have to check where, since i have another hd sometimes it is /dev/hdb1)
Hope it helps and sorry about my english. After that just ctrl d or type exit or reboot, remove cd and that's all. Good luck!

Last edited by manny; 28th May 2004 at 06:06 AM.
Reply With Quote
  #4  
Old 28th May 2004, 04:19 PM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
thanks guys. I don't have a boot floppy, only the CD-Roms so I guess I'll try Manny's approach. No probs with the english; it seems very good to me.
Reply With Quote
  #5  
Old 2nd June 2004, 08:17 AM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
need a little more help...

well thanks again for the help, it got me to point but now I'm stuck.

I did as instructed and loaded grub to the partition on my primary hard disk. I should probably explain my setup a little better at this stage:

I have two hard disks. hda1 is where I just installed windows and grub. There are 3 partitions in total, a primary partition and an exended + logical partition after that. hdd1 is where linux resides.

When I rebooted after reinstalling grub I got the same menu I used to have, giving me the options to load a number of linux kernels and windows (default) exactly like before. I selected windows but it didn't take me anywhere so it obviously didn't find the windows boot loader. What did I do wrong? How do I get grub to locate the new windows loader? Did I install grub to the correct partition - did I just write over the windows boot loader?

Edit: Here's the grub.conf, incase it's of any use:

Quote:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd1,0)
# kernel /boot/vmlinuz-version ro root=/dev/hdd1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=4
timeout=10
splashimage=(hd1,0)/boot/grub/splash.xpm.gz
title Fedora Core (2.4.22-1.2188.nptl)
root (hd1,0)
kernel /boot/vmlinuz-2.4.22-1.2188.nptl ro root=LABEL=/ hdb=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2188.nptl.img
title Fedora Core (2.4.22-1.2179.nptl)
root (hd1,0)
kernel /boot/vmlinuz-2.4.22-1.2179.nptl ro root=LABEL=/ hdb=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2179.nptl.img
title Fedora Core (2.4.22-1.2174.nptl)
root (hd1,0)
kernel /boot/vmlinuz-2.4.22-1.2174.nptl ro root=LABEL=/ hdb=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2174.nptl.img
title Fedora Core (2.4.22-1.2115.nptl)
root (hd1,0)
kernel /boot/vmlinuz-2.4.22-1.2115.nptl ro root=LABEL=/ hdb=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2115.nptl.img
title MS Windows XP Pro
rootnoverify (hd0,0)
chainloader +1

Last edited by David; 2nd June 2004 at 09:51 AM.
Reply With Quote
  #6  
Old 2nd June 2004, 05:02 PM
manny Offline
Registered User
 
Join Date: Nov 2003
Location: Mexico
Age: 43
Posts: 4
hmmm.... i think i had this issue before, maybe try again with hda only instead of hda1.
Hope it helps, let us know if it works and maybe post fdisk -l output . Can you boot linux as it is now?
Reply With Quote
  #7  
Old 2nd June 2004, 10:54 PM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
yeah, I'm posting this from linux now. It's the windows bit that's broken.

I'll try what you suggested although I wonder if I'll have to fix the windows bootloader now as well.

fdisk -l says:

Quote:
Disk /dev/hdd: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdd1 * 1 10159 5120104+ 83 Linux
/dev/hdd2 10160 12240 1048824 82 Linux swap
/dev/hdd3 12241 42717 15360408 f Win95 Ext'd (LBA)
/dev/hdd5 12241 42717 15360376+ 83 Linux

Disk /dev/hda: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1913 15366141 7 HPFS/NTFS
/dev/hda2 1914 9964 64669657+ f Win95 Ext'd (LBA)
/dev/hda5 1914 9963 64661593+ 7 HPFS/NTFS
Reply With Quote
  #8  
Old 3rd June 2004, 10:55 PM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
is there any more info I can give, or anything else I can try? I'm rapidly running out of time here and really need to get this working asap.

Update: I think I know what the problem is. When I type the command find /boot/grub/stage1 it locates the device hd(1,0) which I'm pretty sure is the wrong device. The mbr is on hd(0,0) isn't it? If I try to type setup (hd0) I get the message that it can't mount (or find? - I can't remember exactly) that partition.

So I reckon my active partition must be the first one on my secondary disk, hdd. I'm trying to work out how to change the active partition to hda, but so far I'm not having much success.

Last edited by David; 3rd June 2004 at 11:57 PM.
Reply With Quote
  #9  
Old 4th June 2004, 04:04 PM
manny Offline
Registered User
 
Join Date: Nov 2003
Location: Mexico
Age: 43
Posts: 4
Sorry, i don't know , hope somebody else can help. This is a silly idea but as a last option i'd try installing on every hdX till i find the one that works
If you get it right please post. gl
Reply With Quote
  #10  
Old 5th June 2004, 03:59 AM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
Well, thanks anyway manny. Naturally I'll post back if I have success.

I think I need to switch off hdd1 as my active partition. From what I can gather both that partition and hda1 are active. I didn't think this was possible but I guess I don't fully understand how it all works. But I think what's happening is that grub is loading from hdd1, can't mount hda1 and therefore the path to windows boot loader doesn't work. I tried running both fdisk and parted but couldn't work out how to reset the flag with either of them.

I noticed someone else was trying to use the windows bootloader to run linux. Perhaps I should try and do this instead. It's a pain though.

It's frustrating though; half of the reason I installed linux in the first place was to leave windows clean and optimised just for work. I don't really relish the prospect of moving all my files back over to windows again and reinstalling all the junk, especially since I prefer working with this system anyway.
Reply With Quote
  #11  
Old 12th June 2004, 08:29 AM
David Offline
Registered User
 
Join Date: May 2004
Location: Newcastle Upon Tyne
Posts: 90
New World Record for Downloading Virus...

Well, I gave this another try today and this time I succeeded in getting it to work. I was right that it was the active partition that was the problem. I didn't realise before but I can make partitions active by using grub. I discovered this snippet after re-reading one of the threads on here.

First I loaded grub then performed the command makeactive (hd0,0);
then I restarted to see if anything had changed in grub by selecting windows again. This time it came up with an error message instead of returning to the original screen so, thinking that the correct partition must now be active, I used fixboot and fixmbr commands in windows repair prompt (accessed from the insallation cd-rom);
then I reinstalled grub to hda as per Manny's instructions.

Thankfully this did the trick and I gleefully installed my modem, activated windows and promptly caught the new sasser worm, all within the blink of an eye. Thankfully I think I've got the little blighter off my system now so I hope it's clean. I also hope it didn't leave any instabilities behind. We shall see... At least I have to reinstall I know I can do it now. The only thing I worry about is how many times I can reactivate windows. I guess it must somehow know whether or not I'm re-installing on the same pc.

I think keeping a second os strictly for personal use was a good idea. It should help keep windows light and stable for music.
Reply With Quote
Reply

Tags
grub, reinstalling, windows

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
reinstalling windows, wondering how grub/boot will be affected Cigaboo Using Fedora 2 8th April 2007 08:31 PM
Reinstalling Grub - The Right Way carney1979 Installation and Live Media 3 3rd August 2006 03:14 PM
Reinstalling GRUB simonsez Installation and Live Media 2 29th June 2005 09:25 AM
Reinstalling GRUB in the MBR? hfthomp Using Fedora 12 21st June 2005 12:34 PM


Current GMT-time: 01:32 (Tuesday, 21-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat