How to manually install GRUB after a failed installation or disk corruption of the MBR
This document (7001376) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Desktop 10 Service Pack 1
SUSE Linux Enterprise Server 10 Service Pack 2
SUSE Linux Enterprise Server 10 Service Pack 1
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9 Service Pack 4
SUSE Linux Enterprise Server 9 Service Pack 3
SUSE Linux Enterprise Point of Service
Situation
- BIOS error message about no bootable drive
- After first installation, server will not boot with BIOS error message
Resolution
For this example, /dev/sda1 is the assumed /boot and /dev/sda2 is the assumed root partition.
LVM and EVMS users:
If you are using LVM, then the devices should be automatically seen. Type "lvscan" to make sure that your logical volumes have been detected.
For users using EVMS, the LVM volumes should be detected. You may use "lvscan" to find the volumes. Since the changes are being made to the /boot partition, LVM is not needed."
Procedure
- Mount root to /mnt. If root is on an LVM or EVMS device, use the LVM or EVMS name for the device
mount /dev/sda2 /mnt
- Mount /boot to /mnt/boot. This device should be a traditional partition.
mount /dev/sda1 /mnt/boot
- Mount system pseudo file systems under /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys - "change root" or chroot to /mnt
chroot /mnt
- Under /boot/grub, there is a file called "device.map." The file needs to be populated according to your disk layout. The first disk should be (hd0 ) . If the file looks fine, then continue to the next step. If it is missing or looks incorrect, populate it according to the following template.
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/cciss/c0d0
(hd3) /dev/cciss/c0d1 - Launch the grub interactive shell
grub
- In the interactive shell, you will see a "grub>" prompt. With grub the first partition on the first hard drive is hd0,0. The following example will install Grub on the first parition of the first drive.
grub> root (hd0,0) Filesystem type is ext2fs, partition type 0x83 grub> setup (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2/boot/grub/menu.lst"... succeeded Done.
- Type quit
- Type exit
- Type reboot
The server should now reboot.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7001376
- Creation Date: 17-Sep-2008
- Modified Date:15-Mar-2021
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com