PDA

View Full Version : Restroing grub boot menu?



leonardevens
15th November 2008, 08:49 PM
I am running Fedora 7 on a double boot machine with two disks. hd0 has Windows and hd1 has Linux. I wanted to be sure I could boot windows when I was done, so I tried to remember how to make a grub boot floppy or CD, but I was having trouble figuing out how to do it. I downloaded something that claimed to be a generic grub CD I could use for recovery, but in the process of using it I set the MBR to boot only windows. (I should say this was aall a big mistake because I've never lost the ability to boot windows in a Fedora installation!) I have been trying to reset it the way it was with only partial success.

I used the Fedora 7 installation DVD in rescue mode. In grub, I tried

grub> root (hd1,0)

which is where /boot is mounted on my second disk.

I then did

grub> setup (hd0)

This did in fact put grub in the MBR of the first disk and when I boot I get the grub shell. But it doesn't have my normal choices. I have to enter everything by hand, and then I can boot my Linux partition.

What have I done wrong?

I also tried running grub while setting the config option and doing the same thing, but I still don't get the menu of choices for booting. It is possible I mistyped something.

My config.conf is unchanged from the original, as are all the files in /boot/grub, so I don't understand why grub is ignoring the choices..

leonardevens
15th November 2008, 09:27 PM
When I boot, I get the grub text based boot shell. It seems to be ignoring everything in grub.conf.

phe
15th November 2008, 09:29 PM
Where is your grub.config? ((hdx,y)/boot/grub/grub.conf)
Where is stage1? find /boot/stage1 or find /boot/grub/stage1 ? ?

Can you try at the grub> prompt : configfile (hdx,y)/ path to /grub.conf

I had something similar.

leonardevens
15th November 2008, 10:53 PM
Where is your grub.config? ((hdx,y)/boot/grub/grub.conf)
Where is stage1? find /boot/stage1 or find /boot/grub/stage1 ? ?

Can you try at the grub> prompt : configfile (hdx,y)/ path to /grub.conf

I had something similar.

I had some trouble figuring out how to use find in grub, but I understand it now. But I don't understd the results

If I do a find on anything, it gives me a list of a whole bunch of devices, inclduing the one with the file I asked it to find, but it also includes others that as best I can tell don't. But in any event I'm pretty sure the relevant files are where they should be which is (hd1,0)/grub. If I get that wrong, it responds "file not found".


When I boot, if i use (as you suggested)

grub> configfile (hd1,0)/grub/grub.conf

then I do get the appropriate grub selection screen and I can boot the desired OS.

So I assume that the program I ran from the CD I downloaded may have screwed something up, or else there is a bug in my current version of grub. Of, of course, there is something else I may have to do., but
I can't think of what it might be.

At one time I understood grub pretty well. As I remember, setup should put a small tag in the MBR which
tells the system to go to (hd1,0)/grub/stage1. That in turn should tell it to use stage2, which should then
use the configuration data. As best I can tell, those files have not changed. If you change grub.config,
grub should use the new file. Nothing else should be needed.

leonardevens
15th November 2008, 11:50 PM
I've now managed to make a boot CD which brings us grub. But it perfroms differently from my previous
version on the disk which immediately brings up the menu of choices. Now, I have to press a key to get
that.

To construct this CD I followed instructions in the grub manual, and instead of using stage2, I used a
special version. I got it from the original grub files in the package. These are different from those in
/boot/grub. I have no idea why.

stoat
16th November 2008, 12:15 AM
grub> configfile (hd1,0)/grub/grub.conf

then I do get the appropriate grub selection screen and I can boot the desired OS.Hello leonardevens,

If you can boot into the Fedora system that way, then I recommend re-installing the GRUB boot loader with the grub-install command from a terminal in the running Fedora system. That is the best place of all (IMO) from which to run the grub-install command. If you want to try it, then boot the system like you did before with your boot disk, open a terminal, and do this to re-install GRUB in the master boot record...
su
/sbin/grub-install /dev/sdaAnd if you get a "no corresponding drive in BIOS" error message, then do it again like this...
/sbin/grub-install --recheck /dev/sda

P.S.:


At one time I understood grub pretty well. As I remember, setup should put a small tag in the MBR which
tells the system to go to (hd1,0)/grub/stage1. That in turn should tell it to use stage2, which should then
use the configuration data.You've got that wrong. Stage1 is actually what is in the master boot record. The stage1 file in /boot is just an image file that GRUB uses when it installs stage1 somewhere such as the MBR or a boot sector (so are all of those stage1_5 files). However the stage2 file in /boot is the actual file involved in the chain of events during booting.

grub.conf
|
BIOS ---> GRUB Stage1 ---> GRUB Stage1.5 ---> GRUB Stage2 ---> Linux
Master DOS /boot/grub kernel
Boot Compatibility
Record Area

leonardevens
16th November 2008, 12:40 AM
Hello leonardevens,

If you can boot into the Fedora system that way, then I recommend re-installing the GRUB boot loader with the grub-install command from a terminal in the running Fedora system. That is the best place of all (IMO) from which to run the grub-install command. If you want to try it, then boot the system like you did before with your boot disk, open a terminal, and do this to re-install GRUB in the master boot record...
su
/sbin/grub-install /dev/sdaAnd if you get a "no corresponding drive in BIOS" error message, then do it again like this...
/sbin/grub-install --recheck /dev/sda

P.S.:You've got that wrong. Stage1 is actually what is in the master boot record. The stage1 file in /boot is just an image file that GRUB uses when it installs stage1 somewhere such as the MBR or a boot sector (so are all of those stage1_5 files). However the stage2 file in /boot is the actual file involved in the chain of events during booting.

grub.conf
|
BIOS ---> GRUB Stage1 ---> GRUB Stage1.5 ---> GRUB Stage2 ---> Linux
Master DOS /boot/grub kernel
Boot Compatibility
Record Area

Your recommendation worked, but I'm not sure some of my previous steps didn't fix it.

It turned out that I was trying to make a grub boot floppy, and didn't think it had worked, but I left it in the floppy drive, and forgot about it So everytime I rebooted, I was booting from the floppy, not the hard drive. Once I figured that out, it worked more or less as usual. I still don't by default get the list of choices of what to boot, which I did before. Instead I have to press a key. I don't understad why because grub.conf hasn't changed in any of this.

By the way, I realized shortly after I posted that I was wrong about the boot sequence as you correctly point out.

I used to manage our department network, and I had to deal with such things on a regular basis,
But it is easy to forget these things when you don't use them regularly. Today was mostly a waste
of time, but the silver lining is that I relearned a lot about grub.

stoat
16th November 2008, 12:58 AM
I still don't by default get the list of choices of what to boot, which I did before. Instead I have to press a key.That right there sounds like you are talking about (and don't like) the hiddenmenu command in the grub.conf. Try opening the grub.conf for editing and "comment out" (with the # character) the hiddenmenu command. Reboot and see if that is what you want.




Your recommendation worked, but I'm not sure some of my previous steps didn't fix it.That may be so. We will never know now. But here's the thing. The grub-install command still worked and did not break anything. That grub-install command re-wrote everything that you accomplished with the GRUB shell. Everything and some more. The GRUB shell command setup that you used installed GRUB stage1 in the master boot record and stage1.5 in the DOS Compatibility Region between the MBR and the first partition, but it does not also re-write all of those stage files in /boot like the grub-install command does (check their timestamps now and see what I mean). That usually does not matter, but sometimes it can such as when stage2 is corrupt for some reason. That is what I was thinking about from all of your previous posts. And any time the GRUB shell does not work, I always recommend trying the grub-install command (and vice-versa). There are many interesting and almost paradoxical differences in how the GRUB shell setup command and the GRUB shell's front-end script, grub-install, work.

lcruz007
16th November 2008, 06:31 PM
After installing Fedora, I had some problems with GRUB. I fixed some of the problems downloading the latest GRUB and using it on a CD...
Well, the OS is unable to boot automatically without editing a file...? From root(hd,0) to root(hd1,0).

I'm unable to boot from Windows neither, unless I use the GRUB CD to boot it manually.


What I can do to solve this issue?



Thanks in advance

leigh123linux
16th November 2008, 06:37 PM
After installing Fedora, I had some problems with GRUB. I fixed some of the problems downloading the latest GRUB and using it on a CD...
Well, the OS is unable to boot automatically without editing a file...? From root(hd,0) to root(hd1,0).

I'm unable to boot from Windows neither, unless I use the GRUB CD to boot it manually.


What I can do to solve this issue?



Thanks in advance

Thread merged .

stoat
16th November 2008, 07:02 PM
After installing Fedora, I had some problems with GRUB. I fixed some of the problems downloading the latest GRUB and using it on a CD...
Well, the OS is unable to boot automatically without editing a file...? From root(hd,0) to root(hd1,0).

I'm unable to boot from Windows neither, unless I use the GRUB CD to boot it manually. Boot Fedora however you did it before, and then edit the file /boot/grub/grub.conf.

lcruz007
16th November 2008, 07:14 PM
Boot Fedora however you did it before, and then edit the file /boot/grub/grub.conf.

Thank you. I guess that will solve the problem with Fedora... What am I doing when I edit root(hd1,0)? I just know that it works when I edit it. :p

I think I'll still have the problem with Windows though... Do you know how can I solve it? :)

stoat
16th November 2008, 07:17 PM
I think I'll still have the problem with Windows though... Do you know how can I solve it?The same way at the same time. Windows very likely has an entry in the grub.conf, too. Probably the section with a title command with "Other" after it. Just change the rootnoverify command line in the same way that you did to manually boot Windows.

lcruz007
16th November 2008, 07:22 PM
The same way at the same time. Windows very likely has an entry in the grub.conf, too. Probably the section with a title command with "Other" after it.

Ok... Thank you.
It seems Fedora boot now automatically. But I still got to insert the GRUB disk! Because that's the only way to force Fedora/Windows to boot. Otherwise, a grub prompt appears, telling me to press tab for the available commands. Is there anything I can do to boot the OS automatically without using the GRUB CD?

stoat
16th November 2008, 07:28 PM
Is there anything I can do to boot the OS automatically without using the GRUB CD?For that to happen, you need to re-install the GRUB boot loader in the master boot record of the hard drive. Make sure that is what you want to do, and that it will not upset anything else (e.g., Dell special features or anything else not mentioned so far). Boot Fedora, start a terminal, and run these commands...
su
/sbin/grub-install /dev/sda

lcruz007
16th November 2008, 07:35 PM
For that to happen, you need to re-install the GRUB boot loader in the master boot record of the hard drive. Make sure that is what you want to do, and that it will not upset anything else (e.g., Dell special features or anything else not mentioned so far). Boot Fedora, start a terminal, and run these commands...
su
/sbin/grub-install /dev/sda

I reinstalled the GRUB boot loader. :)
When I try to boot, however, I get an infinite chain message, that says "grub"...

stoat
16th November 2008, 07:41 PM
How many drives are there, and have you been changing the boot order in BIOS or at a splash screen menu? If you can still boot Fedora with your CD, it may also help to post the result of this in a terminal...
su
/sbin/fdisk -l

lcruz007
16th November 2008, 07:49 PM
How many drives are there, and have you been changing the boot order in BIOS or at a splash screen menu? If you can still boot Fedora, it may also help to post the result of this in a terminal...
su
/sbin/fdisk -l

What do you mean?
I have set in the BIOS to boot from the CD, and have to use the GRUB CD that I downloaded to manually boot Fedora or Windows. If I boot from the hard drive I get the infinite message...

I have 3 hardisks on this PC. I use an 80GB drive for Fedora, a 160GB for Windows, and the other one is not used....


[root@localhost luis]# /sbin/fdisk -l

Disk /dev/sda: 40.0 GB, 40059321856 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x1dfe1dfe

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4110 33013543+ 7 HPFS/NTFS

Disk /dev/sdb: 82.3 GB, 82347195904 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6b8e97eb

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 25 200781 83 Linux
/dev/sdb2 26 10011 80212545 8e Linux LVM

Disk /dev/sdc: 160.0 GB, 160040803840 bytes
240 heads, 63 sectors/track, 20673 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0xc76c6833

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 20672 156280288+ 7 HPFS/NTFS

Disk /dev/dm-0: 79.9 GB, 79993765888 bytes
255 heads, 63 sectors/track, 9725 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x30307800

stoat
16th November 2008, 08:22 PM
What do you mean?By that I meant the order of the hard drives in BIOS, not the boot device priority. I know you have that set to the optical drive at the moment. I can set those two things separately in my BIOS, but BIOSes are different. Maybe you can't.

Now I'm a little worried about digging a hole here. See, something was not sounding right from the beginning. Before you installed Fedora, Windows surely had been booting normally. Right? While installing Fedora, if you had allowed the default boot loader option to happen, then GRUB and Fedora should have booted directly from BIOS afterwards. If you had chosen the option to install GRUB in the Fedora boot partition or to install no boot loader at all, then Windows should still be booting now. Neither of those appears to have happened, so that leaves the possibility that you selected a different drive to boot from in Anaconda, and that drive is not now first in BIOS. Only you know what happened. If you can remember exactly what you did along those lines, it might help avoid digging a deep hole that ends in a re-install. This has all the tell-tale signs of that already.

lcruz007
16th November 2008, 08:45 PM
By that I meant the order of the hard drives in BIOS, not the boot device priority. I know you have that set to the optical drive at the moment. I can set those two things separately in my BIOS, but BIOSes are different. Maybe you can't.

Now I'm a little worried about digging a hole here. See, something was not sounding right from the beginning. Before you installed Fedora, Windows surely had been booting normally. Right? While installing Fedora, if you had allowed the default boot loader option to happen, then GRUB and Fedora should have booted directly from BIOS afterwards. If you had chosen the option to install GRUB in the Fedora boot partition or to install no boot loader at all, then Windows should still be booting now. Neither of those appears to have happened, so that leaves the possibility that you selected a different drive to boot from in Anaconda, and that drive is not now first in BIOS. Only you know what happened. If you can remember exactly what you did along those lines, it might help avoid digging a deep hole that ends in a re-install. This has all the tell-tale signs of that already.

I don't know if I did something wrong in the installation process, I remember selecting the 80GB drive to install Fedora though.

Let me see if I understood correctly... Maybe Anaconda was started on the wrong hard drive, and then I installed Fedora on the other drive? The GRUB boot loader might be in conflict because it's on the other drive?

Should I disable the other drives, and leave enabled just the one that will have fedora installed and try running Anaconda with just one drive enabled?

stoat
16th November 2008, 09:20 PM
I don't know if I did something wrong in the installation process, I remember selecting the 80GB drive to install Fedora though.I don't know either. But here's the thing. After installing Fedora, something should boot. Either Fedora or whatever was booting before... unless an option was selected to prevent that from happening (and that's possible to do). Or else the BIOS drive order was changed.




Let me see if I understood correctly... Maybe Anaconda was started on the wrong hard drive, and then I installed Fedora on the other drive? The GRUB boot loader might be in conflict because it's on the other drive?No I didn't meant that exactly. You probably installed Fedora on the drive that you intended (or else something you started with would be missing now), but you could have made a boot loader option choice that caused GRUB to be installed in a now unexpected place (e.g., the MBR of another drive, or the Fedora boot partition).




Should I disable the other drives, and leave enabled just the one that will have fedora installed and try running Anaconda with just one drive enabled?I never unplug drives just to install Fedora. Some people do. One well-known method calls for that. But I don't recommend it because I don't think it's necessary for a good (and safe) result. But it does ease the anxiety of the ultra-paranoids who don't want Windows harmed in any way through a mistake or accident. IMO, the classic and probably most popular way to install Fedora alongside Windows, is to have Windows booting normally from BIOS and on the first drive in BIOS (it's usually already like that). Then install Fedora either on the same drive or its own drive and allow the default boot loader option which installs GRUB in the MBR of /dev/sda. GRUB usually then boots directly from BIOS and offers Fedora and Windows in its menu.

What to do now?

If you are gravitating towards a re-install (sounds like it), then it will do no harm to try a few things before you do that. Try entering BIOS setup and setting the 80 GB Fedora drive to first in the hard drive order, the 160 GB Windows drive to second, and the other drive third. Do you have a way to do that in your BIOS setup routine somewhere? If you can do that, then just try rebooting that way. You might get a surprise. If it doesn't boot just from that drive order change, then try booting with the 160 GB Windows drive first in BIOS. After that, try re-installing GRUB in the master boot record again with the drives in either of those configurations. It shouldn't harm anything or take long to try these few ideas. It might also help to unravel the puzzle.

P.S.: It's kind of odd (but not impossible) for your Windows drive to be third in the BIOS drive order. If it really is and has been all along, then its boot loader files are somewhere else (such as that 40 GB drive with an NTFS partition).

P.P.S.: If you have important files in that Windows system's partition (or any other drive that is connected and running), you should stop now and make verified backups of important files. Installing an OS is not like installing ordinary software. Everything on every running drive is in mortal danger while installing Fedora if you are careless or make a mistake. It happens all the time.

lcruz007
16th November 2008, 09:56 PM
OK, I'll do what you suggested me. Thank you very much for your support. :D

Ps. Changing the drives did not make a big difference. The loop is gone, but still no boot... It stays like "GRUB Loading stage2...". I will try with other methods.

stoat
16th November 2008, 10:28 PM
The loop is gone, but still no boot... It stays like "GRUB Loading stage2...".Which drive order did that? You may be able to repair it in this configuration.

lcruz007
16th November 2008, 10:46 PM
Using the 80GB drive (Fedora drive) at first... Well, I found out something interesting... I disabled the other hard drives and just left enabled the Windows drive, it couldn't boot because I got a GRUB error, I had to manually boot it using the GRUB CD... The drive that I used for Fedora was the 80GB drive though, So there shouldn't be any problem booting Windows.

You were right... What I will do now is reinstall Fedora with the other drives disabled. I think it's safer.

stoat
16th November 2008, 11:03 PM
Using the 80GB drive (Fedora drive) at first...With that 80 GB drive first in BIOS like that, you could probably boot Fedora manually with the CD, run that grub-install command again, and have it boot now.




I disabled the other hard drives and just left enabled the Windows drive, it couldn't boot because I got a GRUB error...At some point today, GRUB stage1 got installed in its master boot record. It's okay to leave it that way for now as long as GRUB is going to be your boot loader.




So there shouldn't be any problem booting Windows.I agree. And if you decided to try re-installing GRUB one more time before you re-install, and the Fedora drive is first, and it works and boots, then a minor tweak to the grub.conf will be required to get Windows to boot from a non-first drive. When that bridge comes...

lcruz007
16th November 2008, 11:23 PM
[QUOTE=stoat;1111997
At some point today, GRUB stage1 got installed in its master boot record. It's okay to leave it that way for now as long as GRUB is going to be your boot loader.[/QUOTE]

Yes, indeed... Well, the problem is the infinite loop when the GRUB is loaded in the Main drive (Windows), so I have to manually boot it with the GRUB cd, I think I'll be able to fix this problem by re-installing Windows.

If I disable the other drives, and just leave the one that I will use to install Fedora, the GRUB for multi-booting won't be used...? I would have to switch the drives priorities in the BIOS to go to the OS that I want. Am I right?

stoat
16th November 2008, 11:33 PM
If I disable the other drives, and just leave the one that I will use to install Fedora, the GRUB for multi-booting won't be used...? I would have to switch the drives priorities in the BIOS to go to the OS that I want. Am I right?I don't think so. Once you get Fedora booting normally, you can still boot Windows from Fedora with the chainloader command in the grub.conf as long as the Windows partition's boot sector remains intact (and it should be). It won't matter what is in the Windows drive's MBR then. The MBR is only important for booting directly from BIOS. I'm referring to the boot code in the MBR. Of course, the partition table of every drive's MBR is always important.

lcruz007
16th November 2008, 11:53 PM
Oh I see. Well that's a helpful info you provided me. :)
Thanks. I'll see what I can do when I re-install Fedora, after taking backup of important files of my hard drive.