Operating System - Linux
1821638 Members
3091 Online
109633 Solutions
New Discussion юеВ

Trying to Install GRUB Loader

 
SOLVED
Go to solution
Debbie Downing_2
Regular Advisor

Trying to Install GRUB Loader

Hi

I am trying to reinstall the GRUB Loader onto my system. I have performed the following but cannot seem to get to run the grub-install at all.

1. boot into rescue mode
2. chroot /mnt/sysimage
3. grub-install /dev/sda

keep getting error "does not have any corresponding BIOS drive".

I have tried running a grub-install --recheck /dev/sda and get probing system for BIOS drive, this may take a long time.
/dev/md0 does not have any corresponding BIOS drive.

I dont know what else to try to get the GRUB reinstalled onto the system.

Please can anyone help.

Kind Regards

Debbie
11 REPLIES 11
Tom Robinson_1
Advisor

Re: Trying to Install GRUB Loader

You could try to run the grub console manually.

Type grub at the prompt and then type help at the grub prompt.

if you type:

grub> root (hd
Possible disks are: hd0 hd1 hd2 hd3 hd4

grub should list the possible drives on your system (this is like command-line completion at the bash prompt).

choose the device where grub can find the boot loader stages (Red Hat systems put this in /boot/grub/). e.g.

grub> root (hd0,
Possible partitions are:
Partition num: 0, Filesystem type is ext2fs, partition type 0xfd
Partition num: 1, Filesystem type unknown, partition type 0xfd

I'll choose (hd0,0) as that's where the grub stage files can be found on my system. The syntax (hd0,0) is grub's way of designating the first disk (hd0) and the first partition on that disk (hd0,0).

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd

On my system this is a software raid1 (mirror) which I can boot from and want to install the bootloader to.

You can now install the boot loader to the first disk (hd0) by typing:

grub> setup (hd0)

Grub should report that it found the stages it needs to setup the bootloader and give a success message when it's complete. You will probably see about eight to ten lines of output. Read it though carefully and make sure grub is installed correctly.

(you can also type help setup for more information).

t.
Debbie Downing_2
Regular Advisor

Re: Trying to Install GRUB Loader

Hi Tom

I did the following but when I am in Grub if I try the tab it doesn't work.

I did a find /grub/grub.conf and got back (hd0,0) and (hd1,0).

I then proceeded and run:-

root (hd0,0)
setup (hd0)

I then got the following back:-

checking if "/boot/grub/stage1" exists ..No
checking if "/grub/stage1" exists ... yes
checking if "/grub/stage2" exists ... yes

running "embed /grub/e2fs_stage1_5 16 sectors are embedded succeeded

running "install /grub/stage1 (hd0) (hd0)1+16 (hd0,0)/grub/stage2 /grub/grub.conf" succeeded

When I reboot the system I get the message
No Operating system found???

Any other ideas....

Thanks for your help

Regards

Debbie
Tom Robinson_1
Advisor
Solution

Re: Trying to Install GRUB Loader

When you use the don't use any other characters. e.g.

grub> root (hd

ignore the '<' and '>' they are only to bracket the word TABKEY. don't type them. You probably did understand that anyway but I'm just checking.

>I did a find /grub/grub.conf and got back (hd0,0) and (hd1,0).

Looks like a mirror. Have you set up software raid on mirrored disks?

>I then proceeded and run:-

>root (hd0,0)
>setup (hd0)

>I then got the following back:-

>checking if "/boot/grub/stage1" exists ..No

Grub can read filesystems and substitutes the designated disk for the mount point. Above it looks first for the configured default location but the directory path (hd0,0)/boot/grub/stage1 doesn't exist. That's ok as below it succeeds.

>checking if "/grub/stage1" exists ... yes
>checking if "/grub/stage2" exists ... yes

Here grub is really saying (hd0,0)/grub/stage1 and (hd0,0)/grub/stage2 and likes what it sees (effecively that maps to /boot/grub/stage{1,2}. It installs the stage1 to the boot sector on (hd0) and references stage2 from there.

>running "embed /grub/e2fs_stage1_5 16 sectors are embedded succeeded

>running "install /grub/stage1 (hd0) (hd0)1+16 (hd0,0)/grub/stage2 /grub/grub.conf" succeeded

All looks good so far.

>When I reboot the system I get the message No Operating system found???

Did this get you further than before? What's in your grub.conf? (I'm assuming you're on a Red Hat/Fedora/CentOS system?).

Can you find the kernel and initrd on the boot device (in the rescue evironment, under chroot /mnt/sysimage, do 'ls /boot').

If you can boot to a grub console you could also try:

grub> root (hd0,0)
grub> cat /grub/grub.conf

and then maybe try to load the kernel and initrd manually to see if it can be found on the disk?

grub> kernel /vmlinuz- ro root=
grub> initrd /initrd-
grub> boot

Regards,

Tom
Debbie Downing_2
Regular Advisor

Re: Trying to Install GRUB Loader

Hi Tom

I did was able to to enter the kernel but not the initrd.

grub> root (hd0,0)
grub> cat /grub/grub.conf
grub> kernel /vmlinuz ro root=

the above went through fine...

grub> initrd /initrd

I get Error 16 inconsistend filesystem structure

Tom Robinson_1
Advisor

Re: Trying to Install GRUB Loader

Hi Debbie,

Can you please send the output from:

grub> geometry (hd0)

and your boot device?

the contents of grub.conf would also be handy.

Are you using LVM on your system? This may be causing some of the problems.

You could also try do a filesystem check (fsck) on your volumes to see that they are clean. NB: DO NOT run a fsck on a mounted volume. (i.e. do the fsck from the recovery evironment without chroot'ing).

Regards,

t.
Debbie Downing_2
Regular Advisor

Re: Trying to Install GRUB Loader

Hi

grub> geometry (hd0)
drive 0x80 C/H/S = 4427/255/63. The number of sectors = 71132000, /dev/sda

partition num 0 filesystem type is ext2fs, fartition 0xfs
partition num 1 filesystem type is unknown.

The boot device was configured to boot from the san - device /dev/sda

CONTENTS OF GRUB:-

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/vg00/lvol00
# initrd /initrd-version.img
#boot=/dev/sdc1
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux ES (2.6.9-22.0.2.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-22.0.2.EL ro root=/dev/vg00/lvol00 acpi=off
initrd /initrd-2.6.9-22.0.2.EL.img
title Red Hat Enterprise Linux ES (2.6.9-5.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-5.EL ro root=/dev/vg00/lvol00 acpi=off
initrd /initrd-2.6.9-5.EL.img

ARE WE USING LVM? Yes

Thanks for all your help Tom...

Regards


Debbie
Tom Robinson_1
Advisor

Re: Trying to Install GRUB Loader

Hi Debbie,

>partition num 0 filesystem type is ext2fs, fartition 0xfs
>partition num 1 filesystem type is unknown.

I have to assume you made a typo copying the lines above in. partition type 0xfs is invalid and I'll assume that it's 0xfd - or 'Linux Raid Autodetect'

Are you using 'partition num 1' from above? It appears to be unrecognised and may be part of the problem. If it is an LVM volume it should show up with a hex code of 0x8e. In the rescue environment can you access this volume via mount? Any other way? (Actually you can show me 'cat /proc/partitions' as well and/or 'fdisk -l').

As far as I know a SAN device /dev/sda should be fine for booting.

>CONTENTS OF GRUB:-

>default=0
>timeout=5
>splashimage=(hd0,0)/grub/splash.xpm.gz
>hiddenmenu
>title Red Hat Enterprise Linux ES >(2.6.9-22.0.2.EL)
>root (hd0,0)
>kernel /vmlinuz-2.6.9-22.0.2.EL ro >root=/dev/vg00/lvol00 acpi=off
>initrd /initrd-2.6.9-22.0.2.EL.img
>title Red Hat Enterprise Linux ES >(2.6.9-5.EL)
>root (hd0,0)
>kernel /vmlinuz-2.6.9-5.EL ro >root=/dev/vg00/lvol00 acpi=off
>initrd /initrd-2.6.9-5.EL.img

Have you tried manually booting your older kernel and initrd combination. If this works, maybe you have a corrupted initrd? You can rebuild the initrd in the rescue environment using the mkinitrd command.

When booting manually, try using the 'root=/dev/vg00/lvol00' device, not 'root=/dev/sda'. This is the 'root' filesystem. If this is an LVM volume, LVM needs to be activated before the kernel can mount it. Normally the drivers are loaded by the kernel from the initrd so if it's corrupted you need to rebuild it (see above). The grub error is more concerning though and I think that the partition type may need resetting via a partitioning tool such as fdisk (to type 0x8e). (Please be careful when partitioning and make a backup of your data).

I've assumed a few things here. A) that you've managed to re-install grub to the MBR of your boot disk and that it loads correctly then fails with 'error 16...'. B) You can get to the grub console from grub after loading. C) you want the kernel to mount 'partition num 1' above (i.e. the second partition on the disk) and that the disk is a SAN device. D) you have no local disks on the system. Please tell me if incorrect.

t.
Bill Thorsteinson
Honored Contributor

Re: Trying to Install GRUB Loader

You must have /boot/grub in the root of the
partion you are installing grub to.
Note: if you have /boot as a mounted partition then you need /boot/boot/grub in
the directory structure of the boot drive.
If you use this structure then boot needs to
be somewhere between 256k and 512k depening
on the kernels you install there.

Also if your are installing in the default
location of (hd?,0) then don't maximize that
drive. Grub will overwrite the first 16k or
so of the first track depending on the stage1
loader it is using.

Debbie Downing_2
Regular Advisor

Re: Trying to Install GRUB Loader

Hi Tom

I would just like to say thanks for all your help...

After discussion with my manager we felt the easier way would just to rebuild the server and boot it off the internal drive rather than the SAN.

So thanks again.

Regards


Debbie
Tom Robinson_1
Advisor

Re: Trying to Install GRUB Loader

No Worries, Debbie. I'm sorry that we couldn't get it booting. Good luck with the new configuration.
Justin_99
Valued Contributor

Re: Trying to Install GRUB Loader

I ran into the same problem "no operating system found" with raid mirroring and grub. I was able to resolve the problem by installing grub on both of the devices. In my case /dev/md0 which was /dev/sda & /dev/sdb.

Booted into rescue
ran grub
installed and setup grub on each disk

Once grub was loaded onto each of the devices in the raid /dev/md0 the system would boot.