Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 4th August 2010, 05:15 AM
farmkid Offline
Registered User
 
Join Date: Jul 2009
Posts: 28
linuxfedorafirefox
[SOLVED] need help restoring grub after reinstalling Windows

My Windows installation had a problem and I had to reinstall Windows. The problem now is that I need to get grub back so that I can boot into Fedora. I've tried following this thread, but my system is a little different and I need a little help. I'm using a Fedora 11 LiveCD I had sitting around. Here are the results of the command most of the way down the first page:

Quote:
Disk /dev/sda: 250.0 GB, 250059350016 bytes
240 heads, 63 sectors/track, 32301 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0x000f09ab

Device Boot Start End Blocks Id System
/dev/sda1 * 1 8127 61440088+ 7 HPFS/NTFS
/dev/sda2 8128 8195 512000 83 Linux
/dev/sda3 8195 14899 50682880 5 Extended
/dev/sda4 14900 32301 131559120 7 HPFS/NTFS
/dev/sda5 8195 14899 50681856 8e Linux LVM
I can see the existing partitions using Nautilus, but I can't get to grub.conf from there. And, I can't seem to get to the existing filesystem at all in Terminal, so I'm afraid I can't post the contents of grub.conf.

The problem I have is that I can't mount the existing Linux partitions because mount complains about filesystem type.

Near the end of the thread, three commands are quoted:
Quote:
umount /mnt
mount /dev/sda5 /mnt
grub-install --root-directory=/mnt /dev/sda
I'm tempted to try the grub-install command quoted near the end of the thread, but I don't want to do anything that will hose the system.

So what do I here from here? I'm hoping someone who knows more about this than me (of which I'm sure there are plenty) can help me out here.

Last edited by farmkid; 5th August 2010 at 04:16 AM. Reason: to mark as solved
Reply With Quote
  #2  
Old 4th August 2010, 05:57 AM
oxala Offline
Registered User
 
Join Date: Jul 2010
Posts: 258
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Hello,

It sounds as if you just have a small mounting problem.

First, you do need to know what devices map to which file-systems on your target disk. If you do not know from memory, the easiest way to discover the information is to use the "Disk Utility" from the System Tools menu under applications ... assuming that this existed in FC11.

If this is not available, you can use gparted, or if that is also lacking, parted, which is a command line utility.

So, let's PRETEND you have a boot partition /dev/sda1 and a root partition /dev/sda2. Bring up a command prompt in your livecd system.

mkdir /myOldRoot

## The next 4 commands needed ONLY if you have a separate boot partition
mount /dev/sda2 /myOldRoot
mkdir /myOldBoot
mount /dev/sda1 /myOldBoot
mount -o bind /myOldBoot /myOldRoot/boot

chroot /myOldRoot

At this point, you are in your old root system with a boot under /boot as if you have booted into the system, but a couple of more things before you can re-install grub.

mount sysfs
mount proc
mount tmpfs
mount devpts

If you get this far without error, you can successfully use the grub-install program.

BTW ... On my own system, I use the OpenSUSE bootloader. The OpenSUSE live cd has a really nice graphical utility to reinstall grub ... but you still have to use the steps I have just outlined to make that tool usable and run it from the chrooted environment. And if you choose the SuSE way, you will probably need to manually configure the right boot flags for Fedora in /boot/grub/menu.lst ... I don't know that I really gain much ... but it's what I am accustomed to using ... allows me to configure various grub options without re-reading a man page ... Anyway, I won't write anything about grub-install because I don't actually use it.

Best of luck!


cwight

---------- Post added at 11:57 PM CDT ---------- Previous post was at 11:52 PM CDT ----------

Quote:
Originally Posted by oxala View Post
Hello,

It sounds as if you just have a small mounting problem.

First, you do need to know what devices map to which file-systems on your target disk. If you do not know from memory, the easiest way to discover the information is to use the "Disk Utility" from the System Tools menu under applications ... assuming that this existed in FC11.

If this is not available, you can use gparted, or if that is also lacking, parted, which is a command line utility.

So, let's PRETEND you have a boot partition /dev/sda1 and a root partition /dev/sda2. Bring up a command prompt in your livecd system.

mkdir /myOldRoot
mount /dev/sda2 /myOldRoot

## The next (three ... not 4) commands needed ONLY if you have a separate boot partition
mkdir /myOldBoot
mount /dev/sda1 /myOldBoot
mount -o bind /myOldBoot /myOldRoot/boot

chroot /myOldRoot

At this point, you are in your old root system with a boot under /boot as if you have booted into the system, but a couple of more things before you can re-install grub.

mount sysfs
mount proc
mount tmpfs
mount devpts

If you get this far without error, you can successfully use the grub-install program.

BTW ... On my own system, I use the OpenSUSE bootloader. The OpenSUSE live cd has a really nice graphical utility to reinstall grub ... but you still have to use the steps I have just outlined to make that tool usable and run it from the chrooted environment. And if you choose the SuSE way, you will probably need to manually configure the right boot flags for Fedora in /boot/grub/menu.lst ... I don't know that I really gain much ... but it's what I am accustomed to using ... allows me to configure various grub options without re-reading a man page ... Anyway, I won't write anything about grub-install because I don't actually use it.

Best of luck!


cwight

oops ... see above for corrected mistake ...
Reply With Quote
  #3  
Old 4th August 2010, 06:33 AM
farmkid Offline
Registered User
 
Join Date: Jul 2009
Posts: 28
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

^sda1 is my Windows partition. If I remember right, sda2 is my /boot partition (500MB). Does that sound right? I just used the default partition layout that F13 suggested. sda3 is the extended partition, in which sda5 is a logical volume on which the Linux system resides (again, the default layout that F13 suggested). sda4 is a separate partition which stores data accessible from both Windows and Linux.

I don't have time to try what you suggested right now, so I'll give it a shot tomorrow.
Reply With Quote
  #4  
Old 4th August 2010, 06:42 AM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,551
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Quote:
Originally Posted by farmkid

The problem I have is that I can't mount the existing Linux partitions because mount complains about filesystem type.
That happened because the partition you attempted to mount is an LVM physical volume. You don't mount LVM physical volumes. You mount the logical volumes inside of them. But if you are using a LiveCD to do this repair, then another way to re-install GRUB in the master boot record without having to mount anything is with the GRUB shell. Boot with the LiveCD, open a terminal, and start the GRUB shell...
Code:
su
grub
Now see the grub> prompt of the GRUB shell. Enter these commands at the grub> prompt...
Code:
grub> root (hd0,1)
grub> setup (hd0)
That will re-install GRUB in the master boot record and make GRUB boot directly from BIOS.
Reply With Quote
  #5  
Old 4th August 2010, 08:19 PM
farmkid Offline
Registered User
 
Join Date: Jul 2009
Posts: 28
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Quote:
Originally Posted by stoat View Post
That happened because the partition you attempted to mount is an LVM physical volume. You don't mount LVM physical volumes. You mount the logical volumes inside of them. But if you are using a LiveCD to do this repair, then another way to re-install GRUB in the master boot record without having to mount anything is with the GRUB shell. Boot with the LiveCD, open a terminal, and start the GRUB shell...
Code:
su
grub
Now see the grub> prompt of the GRUB shell. Enter these commands at the grub> prompt...
Code:
grub> root (hd0,1)
grub> setup (hd0)
That will re-install GRUB in the master boot record and make GRUB boot directly from BIOS.
I tried what you suggested, but I received an error. Here's what happened:
Quote:
grub> root (hd0,1)
root (hd0,1)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15t: File not found
Did I do something wrong? Or, should I have used "sd0" instead of "hd0" since it's a SATA drive?

---------- Post added at 01:19 PM CDT ---------- Previous post was at 08:58 AM CDT ----------

Quote:
Originally Posted by oxala View Post
Hello,

It sounds as if you just have a small mounting problem.

First, you do need to know what devices map to which file-systems on your target disk. If you do not know from memory, the easiest way to discover the information is to use the "Disk Utility" from the System Tools menu under applications ... assuming that this existed in FC11.

If this is not available, you can use gparted, or if that is also lacking, parted, which is a command line utility.

So, let's PRETEND you have a boot partition /dev/sda1 and a root partition /dev/sda2. Bring up a command prompt in your livecd system.

mkdir /myOldRoot

## The next 4 commands needed ONLY if you have a separate boot partition
mount /dev/sda2 /myOldRoot
mkdir /myOldBoot
mount /dev/sda1 /myOldBoot
mount -o bind /myOldBoot /myOldRoot/boot

chroot /myOldRoot

At this point, you are in your old root system with a boot under /boot as if you have booted into the system, but a couple of more things before you can re-install grub.

mount sysfs
mount proc
mount tmpfs
mount devpts

If you get this far without error, you can successfully use the grub-install program.

BTW ... On my own system, I use the OpenSUSE bootloader. The OpenSUSE live cd has a really nice graphical utility to reinstall grub ... but you still have to use the steps I have just outlined to make that tool usable and run it from the chrooted environment. And if you choose the SuSE way, you will probably need to manually configure the right boot flags for Fedora in /boot/grub/menu.lst ... I don't know that I really gain much ... but it's what I am accustomed to using ... allows me to configure various grub options without re-reading a man page ... Anyway, I won't write anything about grub-install because I don't actually use it.

Best of luck!


cwight

---------- Post added at 11:57 PM CDT ---------- Previous post was at 11:52 PM CDT ----------




oops ... see above for corrected mistake ...
Okay, so I tried this, but it didn't quite work. The root partition is sda5 and the boot partition is sda2. Here's what I did:
Code:
[root@localhost liveuser]# mkdir /myOldRoot
[root@localhost liveuser]# mount /dev/sda5 /myOldRoot
mount: unknown filesystem type 'lvm2pv'
[root@localhost liveuser]# mount -t ext4 /dev/sda5 /myOldRoot
mount: /dev/sda5 already mounted or /myOldRoot busy
[root@localhost liveuser]# umount /dev/sda5
umount: /dev/sda5: not mounted
I tried going on anyway, but here's what happened:
Code:
[root@localhost liveuser]# mkdir /myOldRoot
[root@localhost liveuser]# mount /dev/sda5 /myOldRoot
mount: unknown filesystem type 'lvm2pv'
[root@localhost liveuser]# mount -t ext4 /dev/sda5 /myOldRoot
mount: /dev/sda5 already mounted or /myOldRoot busy
[root@localhost liveuser]# umount /dev/sda5
umount: /dev/sda5: not mounted
I think this is because I wasn't able to successfully mount sda5. Any ideas?
Reply With Quote
  #6  
Old 4th August 2010, 08:34 PM
oxala Offline
Registered User
 
Join Date: Jul 2010
Posts: 258
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Hello again farmkid,

The correct grub syntax is (hd0,1), (hd0,2) .... hd(42,2) .... I just love how my system magically gets more disks each time I post ...


You still need to go through the somewhat tedious mounting exercise I described. The error message is saying ... "dude, I can't find the stuff your asking me to shove into mbr"

Only 2 ways to guarentee the right stuff:

1. run grub from the boot directory of the running system you are building an mbr image from ... somewhat difficult if you don't have a working gurb

2. create a chroot environment for the actual system you want to create a boot image from ...

Also, if the following output is from YOUR system (yep, I'm a little confused):

Device Boot Start End Blocks Id System
/dev/sda1 * 1 8127 61440088+ 7 HPFS/NTFS
/dev/sda2 8128 8195 512000 83 Linux
/dev/sda3 8195 14899 50682880 5 Extended
/dev/sda4 14900 32301 131559120 7 HPFS/NTFS
/dev/sda5 8195 14899 50681856 8e Linux LVM

Then stoat correctly observed that your root in on an LVM. The partition info above tells me that "boot" is PROBABLY on the partition /dev/sda2. The system root is on LVM, on /dev/sda5 ... but not directly accessible as /dev/sda5 ... it will need to be mounted along the lines "mount /dev/<LVM_NAME>/<PARTITION_NAME> <mount_point>" or possibly "mount /dev/mapper/<LVM_NAME> <MOUNT_POINT>".

Sorry if you find this a little confusing ... quick illustration from my box:
[root@dolphin]# ls /dev/dolphin/
root1 root2 root3 swap
[root@dolphin]#

The lvm name dolphin just happens to be the name of my box, that is how I created it ... but it could be anything on your box ... /dev/MaryLouThelmaLiz ... an unlikely choice for all but the most committed jerry jeff walker fans out there ...

I hope stoat posts again ... I can't think of a way to identify the right device with certainty ... I'll certainly let you know if something comes loose in my memory ...

Have fun!


cwight
Reply With Quote
  #7  
Old 4th August 2010, 08:54 PM
farmkid Offline
Registered User
 
Join Date: Jul 2009
Posts: 28
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Quote:
Originally Posted by oxala View Post
Hello again farmkid,

The correct grub syntax is (hd0,1), (hd0,2) .... hd(42,2) .... I just love how my system magically gets more disks each time I post ...


You still need to go through the somewhat tedious mounting exercise I described. The error message is saying ... "dude, I can't find the stuff your asking me to shove into mbr"

Only 2 ways to guarentee the right stuff:

1. run grub from the boot directory of the running system you are building an mbr image from ... somewhat difficult if you don't have a working gurb

2. create a chroot environment for the actual system you want to create a boot image from ...

Also, if the following output is from YOUR system (yep, I'm a little confused):

Device Boot Start End Blocks Id System
/dev/sda1 * 1 8127 61440088+ 7 HPFS/NTFS
/dev/sda2 8128 8195 512000 83 Linux
/dev/sda3 8195 14899 50682880 5 Extended
/dev/sda4 14900 32301 131559120 7 HPFS/NTFS
/dev/sda5 8195 14899 50681856 8e Linux LVM

Then stoat correctly observed that your root in on an LVM. The partition info above tells me that "boot" is PROBABLY on the partition /dev/sda2. The system root is on LVM, on /dev/sda5 ... but not directly accessible as /dev/sda5 ... it will need to be mounted along the lines "mount /dev/<LVM_NAME>/<PARTITION_NAME> <mount_point>" or possibly "mount /dev/mapper/<LVM_NAME> <MOUNT_POINT>".
Thanks. I'm still rather new to Linux and I have a lot to learn. I appreciate you explaining that to me.

Yes, sda2 is the boot partition and root is on sda5. I think I understand what you said about how to mount it, but I'm not sure what the LVM_NAME or PARTITION_NAME would be. I don't recall assigning any name at all during the setup process, so whatever name they have is probably whatever default name Fedora assigns. Any idea how to find out those names?

Quote:
Sorry if you find this a little confusing ... quick illustration from my box:
[root@dolphin]# ls /dev/dolphin/
root1 root2 root3 swap
[root@dolphin]#

The lvm name dolphin just happens to be the name of my box, that is how I created it ... but it could be anything on your box ... /dev/MaryLouThelmaLiz ... an unlikely choice for all but the most committed jerry jeff walker fans out there ...

I hope stoat posts again ... I can't think of a way to identify the right device with certainty ... I'll certainly let you know if something comes loose in my memory ...

Have fun!


cwight
As I've researched how to do this, I've seen a "Super Grub Disk" mentioned a couple of times that is supposed to be able to fix this. Is that worth trying, or is it just another good way to screw up something else?
Reply With Quote
  #8  
Old 4th August 2010, 11:58 PM
oxala Offline
Registered User
 
Join Date: Jul 2010
Posts: 258
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

"a good way to srew up something else" ... all I need is 1 finger and 1 clever idea ...

I've never used "Super Grub Disk" nor do I know anything about it. If you are careful ... it's certainly worth loading up. If it works for you, please let us know. I think boot loader maintenance is one of the most neglected areas in gnu/linux distributions; an easier way is needed.

Actually, I'm going to download it myself ... I don't really want to work anyway and I am VERY interested in finding a tool that is easy to use ... easy to recommend as a general solution.

Cheers!

---------- Post added at 03:37 PM CDT ---------- Previous post was at 03:28 PM CDT ----------

"I don't recall assigning any name at all during the setup process, so whatever name they have is probably whatever default name Fedora assigns. Any idea how to find out those names?"

I don't know the Fedora defaults ... but I'm SURE someone reading this will .... PLEASE POST!

---------- Post added at 05:58 PM CDT ---------- Previous post was at 03:37 PM CDT ----------

Hello again,

I can now write with complete confidence and certainty that "Super GRUB Disk" is not going to help you .... I would have said so an hour ago ... but .... ummmm .... let's just say I had "1 clever idea" .... and leave it that ....
Reply With Quote
  #9  
Old 5th August 2010, 12:05 AM
farmkid Offline
Registered User
 
Join Date: Jul 2009
Posts: 28
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

I've made some progress, but I'm stuck again. I tried the Super Grub Disk, but it didn't work. It couldn't detect my Linux system at all. I think it may have something to do with the logical volume issue, but I'm not sure. Even when I enabled LVM support, it still couldn't detect any OS other than Windows. It could not find the grub.conf file either. However, I did learn the name of the logical volume from the Super Grub Disk. It's called "vg_at-lv_root". Actually, the Volume Group is "vg_at" and the Logical Volume is "lv_root", but using "vg_at-lv_root" worked.

So, here's the progress so far:
Code:
[root@localhost /]# mkdir myOldRoot
[root@localhost /]# mount /dev/mapper/vg_at-lv_root /myOldRoot
[root@localhost /]# mkdir /myOldBoot
[root@localhost /]# mount /dev/sda2 /myOldBoot
[root@localhost /]# mount -o bind /myOldBoot /myOldRoot/boot
[root@localhost /]# chroot /myOldRoot
[root@localhost /]# mount sysfs
[root@localhost /]# mount proc
[root@localhost /]# mount tmpfs
ls: cannot access /dev/shm: No such file or directory
mount: mount point /dev/shm does not exist
[root@localhost /]# mount devpts
mount: mount point /dev/pts does not exist
After the error with the second to last command, I went ahead and tried the last one, with the same result. So, now what? How do I resolve these errors?

By the way, here's a little tidbit for any future readers looking through this for help: in the meantime, I made a liveUSB using F13 (32-bit version). What I'm trying to rescue is F13 (64-bit). When I tried the above using that, the chroot command didn't work. I got the following error "chroot: cannot run command `/bin/bash': Exec format error" After looking around a little, I found that the the problem might be that I was in a 32-bit environment and trying to chroot to a 64-bit environment. Sure enough, when I rebooted using my F11 LiveCD (64-bit version), it worked fine.
Reply With Quote
  #10  
Old 5th August 2010, 12:31 AM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,551
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Quote:
Originally Posted by oxala

I can now write with complete confidence and certainty that "Super GRUB Disk" is not going to help you.
Well, I'm not sure now that anything is going to help since the GRUB shell commands in post #5 could not find stage1 in the apparent boot partition.
Quote:
Originally Posted by farmkid in post #5

grub> root (hd0,1)
root (hd0,1)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Anyway, the Super Grub Disk is a free and popular utility that can do several useful things. For example, it can...
  1. Emergency boot Fedora when something minor is wrong with the boot loader (!LINUX! in the Quick Menu)
  2. Emergency boot Fedora by directly booting the kernel when something really awful is wrong with the boot loader or if it doesn't exist (Advanced menus).
  3. Emergency boot Windows (!WIN! in the Quick Menu)
  4. Re-install GRUB in the master boot record (GRUB => MBR & !LINUX! in the Quick Menu)
  5. Restore the Windows boot loader by writing a syslinux boot loader to the master boot record to boot the active partition (WIN => MBR & !WIN! in the Quick Menu)
  6. Re-install GRUB in a boot sector (Advanced menus)
  7. Some other things
True, the Super Grub Disk is not a beautiful point and click GUI app. It's a clunky menu-driven text-based app with a maze of menus that can be intimidating on the first encounter. But when the thing is learned, it becomes a very useful thing to have around. I keep the floppy and CD versions handy at all times.

Last edited by stoat; 5th August 2010 at 01:29 AM.
Reply With Quote
  #11  
Old 5th August 2010, 12:36 AM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,551
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Quote:
Originally Posted by farmkid

So, here's the progress so far:
Code:
[root@localhost /]# mkdir myOldRoot
[root@localhost /]# mount /dev/mapper/vg_at-lv_root /myOldRoot
[root@localhost /]# mkdir /myOldBoot
[root@localhost /]# mount /dev/sda2 /myOldBoot
[root@localhost /]# mount -o bind /myOldBoot /myOldRoot/boot
[root@localhost /]# chroot /myOldRoot
[root@localhost /]# mount sysfs
[root@localhost /]# mount proc
[root@localhost /]# mount tmpfs
ls: cannot access /dev/shm: No such file or directory
mount: mount point /dev/shm does not exist
[root@localhost /]# mount devpts
mount: mount point /dev/pts does not exist
I'm not sure what good it's going to do, but these are the steps to mount a logical volume in linux rescue...
Code:
vgchange -a y
lvdisplay
mkdir /mnt/temp
mount /dev/[volume-group]/[logical-volume] /mnt/temp
The vgchange step makes the logical volumes available for input/output. The lvdisplay step will identify the names of the logical volumes and help a little to figure out which one is which. Use the names of the volume group and logical volume from lvdisplay in the mount command. The filesystem of the logical volume will then be accessible in /mnt/temp.

Last edited by stoat; 5th August 2010 at 12:45 AM.
Reply With Quote
  #12  
Old 5th August 2010, 01:06 AM
oxala Offline
Registered User
 
Join Date: Jul 2010
Posts: 258
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Quote:
Originally Posted by stoat View Post
Well, I'm not sure anymore that anything is going to help now since the GRUB shell commands in post #5 could not find stage1 in the apparent boot partition. Anyway, the Super Grub Disk is a free and popular utility that can do several useful things. For example, it can...
  1. Emergency boot Fedora when something minor is wrong with the boot loader (!LINUX! in the Quick Menu)
  2. Emergency boot Fedora by directly booting the kernel when something really awful is wrong with the boot loader or if it doesn't exist (Advanced menus).
  3. Emergency boot Windows (!WIN! in the Quick Menu)
  4. Re-install GRUB in the master boot record (GRUB => MBR & !LINUX! in the Quick Menu)
  5. Restore the Windows boot loader by writing a syslinux boot loader to the master boot record to boot the active partition (WIN => MBR & !WIN! in the Quick Menu)
  6. Re-install GRUB in a boot sector (Advanced menus)
  7. Some other things
True, the Super Grub Disk is not a beautiful point and click GUI app. It's a clunky menu-driven text-based app with a maze of menus that can be intimidating on the first encounter. But when the thing is learned, it becomes a very useful thing to have around. I keep the floppy and CD versions handy at all times.
I think I grabbed the wrong version of the tool ... which seemed to support only grub2 ... it did seem to have some nice stuff in it ... but something of a learning curve also ... I was hoping to find something squarely in the easy to learn / easy to use category

---------- Post added at 07:06 PM CDT ---------- Previous post was at 07:00 PM CDT ----------

[root@localhost /]# mount tmpfs
ls: cannot access /dev/shm: No such file or directory
mount: mount point /dev/shm does not exist
[root@localhost /]# mount devpts
mount: mount point /dev/pts does not exist

I am not certain that these two failures are important .... if sysfs mounted ... that's good.

I would try the grub-install at this point ... it can't make the mbr worse ...
Reply With Quote
  #13  
Old 5th August 2010, 02:43 AM
farmkid Offline
Registered User
 
Join Date: Jul 2009
Posts: 28
windows_xp_2003chrome
Re: need help restoring grub after reinstalling Windows

I tried grub-install after getting the errors, and it didn't work. I don't remember now what the error was, but it seems that it couldn't find something. So, I tried stoat's suggestion from his (her?) first post:
[code]su
grub

grub> root (hd0,1)
grub> setup (hd0)
[/quote]
When using the F11 LiveCD, it gave the same errors I reported before, but when I tried it using the F13 LiveUSB, it installed grub just fine. Or so I thought. When I tried to boot, the grub menu came up with the usual options (three entries for Fedora with different kernels, and Windows), except it was just a black background and white text, instead of the usual blue patterned background and colored text. When I tried to boot Fedora, it came back with "Error 17: Cannot mount selected partition". So, that didn't work. Does this have something to do with the logical volume? That arrangement seems to be causing lots of problems for me.

Also, stoat, when talking about the Super Grub Disk, you mentioned a quick menu and advanced menus. I only have one menu, and the items on it aren't anything like what you say. I downloaded the SG2D v1.98 from here. Is that the wrong thing?

So, what do you think, am I just hosed at this point and it's time to start over fresh with Fedora? If so, is there a way to rescue at least some of my system without having to redo everything?
Reply With Quote
  #14  
Old 5th August 2010, 02:51 AM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,551
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

I think you can forget about re-installing GRUB now. If you're making it to the menu again, then that's working. Something else is wrong, like maybe a change to the partition layout somehow. Do you think such a thing may have occurred when you re-installed Windows? It would explain why the splash image can't be found and why the menu entries are busted. Re-installing GRUB will not fix a misconfigured grub.conf file. Such a thing has to be fixed by hand.

Anyway, you can try to unravel it by stopping GRUB at the Fedora boot menu by pressing the "c" key. That produces the grub> command prompt. This command at the grub> command prompt will identify the boot partition...
Code:
grub> find /grub/grub.conf
Use that result in this next one to see the grub.conf file...
Code:
grub> cat (hdx,y)/grub/grub.conf
Study that result to see if the drive and partition numbers in the splashimage and root command lines are wrong. They should be the same as (hdx,y) learned in that find command.

Last edited by stoat; 5th August 2010 at 03:23 AM.
Reply With Quote
  #15  
Old 5th August 2010, 03:59 AM
oxala Offline
Registered User
 
Join Date: Jul 2010
Posts: 258
linuxfedorafirefox
Re: need help restoring grub after reinstalling Windows

Hello farmkid,

You are ALMOST there ... as stoat just said, "If you're making it to the menu again, then that's working."

Congrats ... you succeeded in writing grub back into the mbr! And no shock ... the boot partition is a little hosed ... but this is much easier to fix than mbr magic blah blah stuff ....

The grub.conf that stoat is referring to is /etc/grub.conf and is used by grub or some other program to generate /boot/grub/menu.lst. As I have mentioned before, I don't use Fedora's grub ... I maintain everything under /boot manually! Honestly, I find that is it's easier ... and it is ALWAYS done exactly the way I want it done.

Your system is not radically different from mine at this point:

My "/boot/grub/men.lst":

default 0
timeout 8
gfxmenu (hd1,0)/message
##YaST - activate

##CWight
title Fedora (2.6.33.6-147.2.4.fc13.i686)
root (hd1,0)
kernel /vmlinuz-2.6.33.6-147.2.4.fc13.i686 ro root=/dev/mapper/dolphin-root2 rd_LVM_LV=dolphin/root2 rd_MD_UUID=224aa24a:8d2b2d73:4fa6bae4:438fc5b1 rd_LVM_LV=dolphin/swap rd_NO_LUKS rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us showopts rhgb quiet
initrd /initramfs-2.6.33.6-147.2.4.fc13.i686.img

... openSuSE stuff removed ...

title M$ WindoZe XP
rootnoverify (hd0,0)
chainloader +1



1st line: default 0 ... this means that the first entry found will be the default os to be booted
2nd line: timeout 8 ... show boot chsoices for 8 seconds before booting the default entry
3rd line: ... use gfxmenu as a graphical menu program ... DO NOT USE THIS ENTRY ... it's not available in stock Fedora ... change it to read "splashimage=(hdX,Y)/grub/fc13splash.xpm.gz" where the values of X and Y are the numbers appropriate for your box ... i think (hd0,1)

Please verify that the file /boot/grub/fc13spalash.xpm.gz is still there ... if not, just comment out the line and you can re-obtain the file later ... it's just eyecandy ... not functionally important

4th line: title Fedora (2.6.33.6-147.2.4.fc13.i686) ... this is just a title ... not functionally important ... impress your friend and family with your braveness, change it to read "DANGER: SELF DESTRUCT in 0.2 SECONDS"

5th line: root (hd1,0) .... VERY IMPORTANT .... get the correct numbers ... mine says 1,0 ... second drive, first partition ... since you boot on /dev/sda2 ... i think yours should be (hd0,1) ... first drive, second partition ...

The rest of line 5 ... make sure you have the correct file listed for the kernel ... each of the files are under the /boot directory ... change the path after root to point to your root /dev/<LVM_NAME>/<ROOT> ... each entry rd_LVM_LV just means ... a logical volume sitting on top of raid ... ALL you really need to get up and running are "root" and "swap" ... so you don't need every entry I have ... and remove the word "showopts" ... it is only for the gfxmenu program that you don't have

6th line: make sure it lists the correct file ... located under boot ... the revnumber of this file MUST match that of the kernel you are loading ... listed in the previous line

Lines 7-9 ... windows boot ... this should work for you exactly as it is ... if you have trouble booting to windoZe ... remove the last line "chainloader +1"

And that's it! Just make sure you plug-in the right file names .... and BANG ... you're a penguin guru!



and .... don't forget to have fun!
Reply With Quote
Reply

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
Restoring LILO after Reinstalling Windows nomezip Installation and Live Media 1 14th May 2006 12:15 AM
restoring GRUB vazel Installation and Live Media 7 27th January 2006 09:56 PM
Reinstalling windows, how do I keep grub? David Installation and Live Media 10 12th June 2004 08:29 AM


Current GMT-time: 21:58 (Wednesday, 22-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