Grub error 21 fixes itself following a reset

Hello,

First of all i have to state that i am new to the Linux/GNU environment.

I installed and booted openSUSE 11.2 with a swap partition of 2 GB, a root partition of 100+ GB and a local partition of 800 GB. Although i know that my partition distribution is not safe i imagined it would be easier if i kept things as simple as possible. My desktop has a new gigabyte am3 main board with amd phenom II cpu. A windows xp 64 bit was installed on a separate hard disk before the openSUSE installation and still is.

Here is my issue:

Each time i run my computer for the first time i receive a “grub error 21”. Following a quick reset (not restart) openSUSE boot screen (openSUSE desktop/failsafe and windows) appears enabling a successful boot of openSUSE or windows; however i need to repeat this reset trick every time.

Thanks in advance for suggestions.

Welcome to the forums !!!

Can you open a terminal window and post output of:


fdisk -l
su -c 'cat /boot/grub/menu.lst'   (enter rootpassword when asked for)

There they are;

fdisk:

Disk /dev/sda: 80.1 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x9a369a36

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1912    15358108+   7  HPFS/NTFS
/dev/sda2            1913        9732    62814150    f  W95 Ext'd (LBA)
/dev/sda5            1913        9732    62814118+   7  HPFS/NTFS

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x20b5d0b0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         262     2104483+  82  Linux swap / Solaris
/dev/sdb2             263       17167   135789412+  83  Linux
/dev/sdb3           17168      121601   838866105   83  Linux

su -c:

# Modified by YaST2. Last modification on Tue Apr 27 22:04:46 EEST 2010
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd1,1)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.2 - 2.6.31.12-0.2
    root (hd1,1)
    kernel /boot/vmlinuz-2.6.31.12-0.2-desktop root=/dev/disk/by-id/ata-ST31000528AS_9VP0Z2Z7-part2 resume=/dev/disk/by-id/ata-ST31000528AS_9VP0Z2Z7-part1 splash=silent quiet showopts vga=0x31a
    initrd /boot/initrd-2.6.31.12-0.2-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.2 - 2.6.31.12-0.2
    root (hd1,1)
    kernel /boot/vmlinuz-2.6.31.12-0.2-desktop root=/dev/disk/by-id/ata-ST31000528AS_9VP0Z2Z7-part2 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x31a
    initrd /boot/initrd-2.6.31.12-0.2-desktop

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
    rootnoverify (hd0,0)
    chainloader +1

Might be the flaw where Grub code can’t find the loader code if it’s too far up the drive.

One option is to go into bios setup and alter the boot sequence so it addresses the linux drive as the primary drive. Then put grub code in the MBR of the Linux drive with a re-initialised bootloader. Or just swap the drives and reinit the bootloader into the MBR of the Linux drive.

How can i

…put grub code in the MBR of the Linux drive with a re-initialised bootloader…
?

Me changing hard disk boot priority resulted “System Failure”. I guess my linux drive lacks a boot sector.

Probably the Linux drive has no boot code in the MBR. The default is to have no boot code in the MBR.

You can switch the boot sequence in the BIOS to the Linux drive and save it so it always boot that way and fix the boot code, here’s the method:

First you would boot into openSUSE and back up the Grub menu file with this command in a console:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.original

Then reboot and switch the BIOS boot focus to the Linux drive. Of course it won’t now boot so you use the installation DVD to boot into openSUSE [see the section “Boot the installed system from the Installation DVD” in this tutorial: HowTo Boot into openSUSE when it won’t Boot from the Grub Code on the Hard Drive to achieve the boot]

Then reinitialise the bootloader such that it writes code to the Master Boot Record of the Linux drive [see the Appendix “Installing a brand new bootloader once you’ve booted into openSUSE” in the tutorial to achieve the reinitialisation]

If you have XP you will have to use the map function in the Grub menu file (menu.lst) but not if you use vista or win 7 [see the section “A Windows 2000/XP Bootloader is in partition 1 of drive 2 because you swapped drives” in a different tutorial, near the end, for an explanation of that]

Be sure you want to do this because there’s no going back (without help from me on how to reverse the changes)

Thanks for your attention swerdna.