[CentOS] GRUB CD errors on CentOS 4

Philip R. Schaffner

Philip.R.Schaffner at nasa.gov
Thu Jan 4 20:18:46 UTC 2007


Background:  I am in the habit of making bootable GRUB CDs with menus
and copies of working kernels and initrds, particularly for
multiple-boot testing machines with multiple distros and/or the Redmond
OS.  This has helped pull my fat out of the fire more than once when a
system was rendered unbootable by hardware changes, or when Bill Gates
decided the MBR should be taken over.  This generally works well, and I
find it easier than using rescue CDs or live distros to recover.  If the
system does not boot immediately from the CD, the GRUB shell usually
provides enough capability to debug the boot problems and get the system
back up.

Recently I have encountered problems on a couple of CentOS machines that
seems to be related to GRUB bug #14758:

   http://savannah.gnu.org/bugs/?func=detailitem&item_id=14758

The symptom is that after booting from the CD and selecting a menu
entry, GRUB throws "Error 25: Disk read error" on attempts to boot.
Booting can be done manually from the GRUB shell command prompt, or by
interactively editing the GRUB menu entries and explicitly specifying
the GRUB device in the path on the kernel and initrd lines.  For
example, the following GRUB stanza in (cd)/boot/grub/grub.conf

title CentOS CD sdc (2.6.9-42.0.3.ELsmp)
        root (cd)
        kernel /boot/vmlinuz-2.6.9-42.0.3.ELsmp ro root=LABEL=/1 rhgb
quiet
        initrd /boot/initrd-2.6.9-42.0.3.ELsmp.img

produces the error 25 with CentOS grub-0.95-3.5, but using the
interactive GRUB "e" command to make it look like

        kernel (cd)/boot/vmlinuz-2.6.9-42.0.3.ELsmp ro root=LABEL=/1
rhgb quiet
        initrd (cd)/boot/initrd-2.6.9-42.0.3.ELsmp.img

works.

Similar results occur using [for example] (hd2,0) in place of (cd) from
the same GRUB CD.  Using /usr/share/grub/i386-redhat/stage2_eltorito
from an FC6 machine as the boot record for the CD fixes the problem.
[See below.  I also copied FC6 /boot/grub/*stage* to iso/boot/grub for
good measure.]

The FC6 grub-0.97-13.src.rpm builds on CentOS 4 and provides a
work-around for this problem.  Might be a candidate for the centosplus
repo.

Can't find anything on this in EL4 bugzilla or the CentOS site/lists.  I
have not filed a RH BZ entry as I don't have an Enterprise Linux system
on which to verify the bug.  It seems to be only intermittently
reproducible on CentOS and appears to be specific to the hardware and/or
the details of grub.conf.  The conditions under which I have seen it
involved machines that had both CD/DVD and CD-RW/DVD-RW drives as well
as using a splashimage from the hard disk [i.e.
splashimage=(hd2,0)/grub/splash.xpm.gz  as opposed to
splashimage=(cd)/boot/grub/splash.xpm.gz].  Would be interested to hear
if anyone else has seen this problem and can document the conditions to
reproduce it.

Phil

**********************************************************************
For reference by those who may want to create a GRUB CD, I use a
one-line script called mkgrubiso (below) that expects to find an iso
directory in the current directory containing a modified copy of
the /boot directory tree plus the file
/usr/share/grub/i386-redhat/stage2_eltorito.  The docs found by "info
grub" may be a bit misleading/incorrect/incomplete.  The procedure goes
like this:

Save mkgrubiso to root's ~/bin directory and make it executable.
# chmod +x ~/bin/mkgrubiso

In a directory of your choice:
# mkdir iso
# cp -a /boot iso
# cp /usr/share/grub/i386-redhat/stage2_eltorito iso/boot/grub

Edit iso/boot/grub/grub.conf using the grub.conf below as a model.  Can
have stanzas that use vmlinuz/initrd images on the hard disk directly,
as well as loading the kernel from the CD.

In the directory containing iso/ do:
# mkgrubiso

Burn the resulting grub.iso image to a CD-R/CD-RW.

Reboot to test.

-------------------------------------------- /root/bin/mkgrubiso
--------------------------------------------
#!/bin/bash
# mkgrubiso
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size \
4 -boot-info-table -o grub.iso iso
-------------------------------------------- /root/bin/mkgrubiso
--------------------------------------------

------------------------------------------ iso/boot/grub/grub.conf
------------------------------------------
# Note that you do not have to rerun grub after making changes to this
file
# NOTICE:  You do not have a (cd)/boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (cd)
#          kernel /boot/vmlinuz-version ro root=LABEL=/
#          initrd /boot/initrd-version.img
#boot=/dev/hdc
default=0
timeout=15
splashimage=(cd)/boot/grub/splash.xpm.gz
#hiddenmenu
title CentOS CD sdc (2.6.9-42.0.3.ELsmp)
        root (cd)
        kernel /boot/vmlinuz-2.6.9-42.0.3.ELsmp ro root=LABEL=/1 rhgb
quiet
        initrd /boot/initrd-2.6.9-42.0.3.ELsmp.img
# boot from hard disk
title CentOS sdc (2.6.9-42.0.3.ELsmp)
        root (hd2,0)
        kernel /vmlinuz-2.6.9-42.0.3.ELsmp ro root=LABEL=/1 rhgb quiet
        initrd /initrd-2.6.9-42.0.3.ELsmp.img
------------------------------------------ iso/boot/grub/grub.conf
------------------------------------------





More information about the CentOS mailing list