Reinstalling the GRUB MBR on SLE 10
Occasionally during an install, the MBR is not written correctly and the server will not boot into the second part of the install.
In SLES 9 this was relatively easy to fix as /dev contained static device entries for all devices. SLE 10 uses a full udev implementation, which means that these device files are created on the fly when the system boots. Therein lies the problem – you cannot simply boot to the rescue system and run grub-install as per SLES 9 as it will complain that your boot disk does not exist. Fear not, the fix is simple.
Boot from your SLE 10 media and select “Rescue System” from the boot menu.
When prompted for login details, log in as root (no password is required).
Now check to see if your boot device has been detected properly. In this case I'm using an IBM ServeRAID so my disk will be presented as /dev/sda. If you're using an HP Smart RAID the device will be something like /dev/cciss/c0d0. Use the following command to see all available partitions:
and you should see something resembling the following
major minor #blocks name
8 0 142192640 sda
8 1 5245191 sda1
8 2 136946092 sda2
This shows that we have a single disk with 2 partitions – in this case sda1 is the root partition and sda2 is used by LVM. sda1 is the partition that we need to use from here on in.
Mount this partition on /mnt as follows
mount /dev/sda1 /mnt
We can now check /mnt/boot/grub/menu.lst and check that it looks ok:
# Modified by YaST2. Last modification on Wed Jan 2 11:24:53 UTC 2008
##YaST - generic_mbr
##YaST - activate
###Don't change this comment - YaST2 identifier: Original name: linux###
title SUSE Linux Enterprise Server 10 SP1
kernel /boot/vmlinuz-18.104.22.168-0.12-smp root=/dev/sda1 vga=0x31a resume=/dev/system/swap0 splash=silent showopts
Everything looks in order and sda is indeed the disk that we're installing on.
The next step is to recreate the disk device files inside our real system as udev will not create them there for us.
mknod /mnt/dev/sda b 8 0
mknod /mnt/dev/sda1 b 8 1
mknod /mnt/dev/sda2 b 8 2
Now, we also need to fool our system into thinking that it's got filesystems mounted!
cp /etc/mtab /mnt/etc/mtab
OK, so the next step is to change into the root filesystem
You will now have a shell that sees your root filesystem as its root rather than being mounted on /mnt. You can now go ahead and re-install the mbr
You will see some error messages about /usr/lib etc, but these safely be ignored. The important things to look for are the following message and the last line which should show
Installation finished. No error reported.
i.e. the grub has been written to the MBR of your disk.
Now we need to clean up.
Exit the chroot shell with
Now remove the files we created earlier so that the system can boot correctly
You can now reboot and the bootloader should come up just fine.
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.