(no subject) [GRUB boot problems]

Phil Schaffner Philip.R.Schaffner at NASA.gov
Thu Jan 15 15:16:57 UTC 2004


List members:  Sorry for any confusion here, but we took it off the list
so I could send Paolo an attachment.  (Anyone who would like to have the
script, a mod of an old version of mkbootdisk to make a grub-menu
floppy, please e-mail me directly.  If there's interest I can post it.)


On Thu, 2004-01-15 at 03:35, Paolo wrote:
> Phil Schaffner said:
> [...]
> > We're getting there - run the attached script as root to create a grub
> > boot floppy that supports menus on a running Linux system.  If you don't
> > have one available can send you a gzipped floppy image.
> 
> No, I don't have a linux machine available.
> Can I run your script after I run/mount/chroot my installation from
> the recovery cd rom ?

I think that should work - don't have a machine that I can take down
right now to test.

> 
> > Will reply to the list with more HOWTO tomorrow, but have kid stuff to
> > cover right now.  Gotta run.  Please send back your current
> > /boot/grub/grub.conf - should have asked for it before.
> 
> Ok, here it is my grub.conf:
# 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,1)
> #          kernel /vmlinuz-version ro root=/dev/hda3
> #          initrd /initrd-version.img
> boot=/dev/hda
> default=1
> timeout=10
> splashimage=(hd0,1)/grub/splash.xpm.gz
> title Red Hat Linux (2.4.20-8)
>         root (hd0,1)
>         kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
>         initrd /initrd-2.4.20-8.img
> title DOS
>         rootnoverify (hd0,0)
>         chainloader +1
> 
> Thanks and ciao.

I should have also asked for "fdisk -l" output, but will wing it -
device names may have to be changed to protect the innocent.  It's
possible all this can be fixed by modifying BIOS setting to change the
boot order; however, on my IDE/IDE-RAID/SCSI system that failed to
work.  Thus the following mess...

Let's assume for now that the disk that grub (when booted from the
floppy) sees as (hd0) is /dev/sda.  (If it's on something else, like a
second IDE controller, it might be /dev/hde.)

Run the script I sent and you should end up with a DOS format bootable
grub floppy with a copy of the grub.conf and device.map files created by
Anaconda.  If not, I can send a gzipped floppy image off-list.

Mount the floppy ("mount -wt vfat /dev/fd0 /mnt/floppy" works for a
normal system - again, not 100% positive about chroot-recovery mode -
some things get weird there) and edit grub.conf and device.map in
/mnt/floppy/grub/ as follows to match what grub sees on the floppy boot:

----------------------------------------------------------------------

# 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 (hd1,1)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
# Make this /dev/hde or whatever for ATA/IDE secondary controller:
boot=/dev/sda
# Looks like you want default to be Windoze - change to 0 for Linux:
default=1
timeout=10
splashimage=(hd1,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-8)
        root (hd1,1)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
        initrd /initrd-2.4.20-8.img
#
# A bit of guessing here - the map commands may be necessary to fool
# Windoze once grub takes over.  May want to try without them first
title DOS
	map (hd0) (hd1)
	map (hd1) (hd0)
        rootnoverify (hd1,0)
        chainloader +1

----------------------------------------------------------------------

Fix the device.map to go back on the hard drive to match what grub
sees from the floppy-boot (again, if you have secondary IDE rather than
SCSI, you may need /dev/hde rather than /dev/sda):

----------------------------------------------------------------------

# this device map was generated by grunt-work
(fd0)     /dev/fd0
(hd0)     /dev/sda
(hd1)     /dev/hda

----------------------------------------------------------------------

After saving the files, unmount the floppy and reboot from it.  With any
luck, you should be able to boot to your installed Linux system.  If it
works, copy the modified grub.conf and device.map to /boot/grub/, and do
the following:

	# grub --device-map=/boot/grub/device.map
	grub> find /grub/stage1
	(hd1,1)			# Hopefully - was (hd0,1) before.
	grub> root (hd1,1)
	grub> setup (hd0)	# Write the MBR on the other disk
	grub> quit

Reboot without the floppy and report success :-) or failure :-(

This probably deserves a Bugzilla report, but it's sufficiently complex
and esoteric that I have not attempted one.  You are the only other case
of the problem I have encountered.

Good luck!

Phil









More information about the fedora-list mailing list