Upgrade from RH8 to FC1 hangs with GRUB

Phil Schaffner Philip.R.Schaffner at NASA.gov
Wed Jan 21 19:07:27 UTC 2004


On Wed, 2004-01-21 at 12:19, John Rumball wrote:
> That line must have been commented out by anaconda.

My guess as well.  Had wondered about why, but it works that way so
never dug in to find out.

> I notice that it 
> is also commented out on my FC1 box at home (which also has hda1, hda2, 
> hda3 and was recently upgraded from RH8) and on the old drive I am 
> replacing in this box.
> 
> I should also mention that I tried booting off my old drive and it 
> worked just fine, although it loaded RH8 and not FC1.  I guess this 
> confirms that my previously attempted yum upgrade never completed 
> properly!

Sounds like it.  From your original message it appears the actual
install of the new RPMS never started.  Haven't used Ghost for this kind
of cloning but it seems that something messed up.  Presumably you had to
configure the old drive as master or single (/dev/hda) to get the system
to boot back to RH8.  If the new drive is configured as slave, can still
boot to the old one?

If so, and if you still want to try an upgrade to preserve old settings
etc., I'd try "cloning" the running system on the old drive under Linux
to the new one configured as a slave drive (/dev/hdb).

Something along these lines has worked for me:

	dd if=/dev/zero of=/dev/hdb bs=512 count=1 # Kill old MBR
	fdisk /dev/hdb	# create partitions as desired
	...
Then
	mke2fs -j /dev/hda1
	mke2fs -j /dev/hda2
	mkswap /dev/hda3
	mkdir /alt
	mount /dev/hda2 /alt
	mkdir /alt/boot
	mount /dev/hda1 /alt/boot
	cp -aux /boot /alt
	cp -aux / /alt

Make a grub boot floppy so you can boot either instance in a pinch.

This script (I call it mkgrubmenu and it lives in /root/bin) may help
(did for Paolo):
-------------------------------------------------------------------
#!/bin/bash
# mkgrubmenu
#
# Written by Phil Schaffner <p.r.schaffner at ieee.org>
#  based on mkbootdisk by Erik Troan <ewt at redhat.com>

pause=yes
format=yes
device=/dev/fd0
unset verbose

GRUBDIR=/boot/grub
MOUNTDIR=/tmp/mkgrubmenu
PATH=/sbin:$PATH
export PATH

VERSION=0.1

usage () {
    cat >&2 <<EOF
usage: `basename $0` [--version] [--noprompt] [--noformat]
       [--device <devicefile>] [--grubdir <dir>] [--verbose -v]
       (ex: `basename $0` --device /dev/fd1)
EOF
    exit $1
}

while [ $# -gt 0 ]; do
    case $1 in
	--device)
	    shift
	    device=$1
	    ;;
	--grubdir)
	    shift
	    GRUBDIR=$1
	    ;;
	--help)
	    usage 0
	    ;;
	--noprompt)
	    unset pause
	    ;;
	--noformat)
	    unset format
	    ;;
	-v)
	    verbose=true
	    ;;
	--verbose)
	    verbose=true
	    ;;
	--version)
	    echo "mkgrubdisk: version $VERSION"
	    exit 0
	    ;;
	*)
            usage
	    ;;
    esac

    shift
done

[ -d $GRUBDIR ] || {
    echo "$GRUBDIR is not a directory!" >&2
    exit 1
}



if [ -e "$device" ]; then {
    [ -n "$pause" ] && {
	echo -n "Insert a"
	[ -n "$format" ] || echo -n " vfat formatted"
	echo " disk in $device."
	echo "Any information on the disk will be lost."
	echo -n "Press <Enter> to continue or ^C to abort: "
	read aline
    }

    [ -n "$format" ] && {
	[ -n "$verbose" ] && echo "Formatting $device... "
	fdformat $device || exit 0
	mkfs.msdos $device > /dev/null 2>/dev/null || exit 0
	[ -n "$verbose" ] && echo "done."
    }

    rm -rf $MOUNTDIR
    mkdir $MOUNTDIR || {
	echo "Failed to create $MOUNTDIR" >&2
	exit 1
    }
    [ -d $MOUNTDIR ] || {
	echo "$MOUNTDIR is not a directory!" >&2
	exit 1
    }

    mount -wt vfat $device $MOUNTDIR || {
	rmdir $MOUNTDIR
	exit 1
    }

    mkdir $MOUNTDIR/grub

    [ -n "$verbose" ] && echo -n "Copying $GRUBDIR files... "
    cd $GRUBDIR
    cp -a stage1 stage2 grub.conf device.map $MOUNTDIR/grub
    [ -n "$verbose" ] && echo "done."

    [ -n "$verbose" ] && echo -n "Setting up GRUB... "
    grub --device-map=$GRUBDIR/device.map --batch <<EOF
root (fd0)
setup (fd0)
quit
EOF

    [ -n "$verbose" ] && echo "done."

    umount $MOUNTDIR
    rmdir $MOUNTDIR
    [ -n "$verbose" ] && echo "done setting up GRUB."
    echo "edit (fd0)/grub/grub.conf to customize."
}
else
    echo "$device does not exist"
fi

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

Configure the new drive as single (recommended to avoid possible MBR
confusion) or master, with the old one either removed or as slave.  Boot
using the floppy, and (assuming success) log on as root and do the
following:

	grub
	root (hd0,0)
	setup (hd0)
	quit

You SHOULD, with any luck, then be able to reboot from the new disk and
continue with the upgrade.

Check out 
http://www.ldeo.columbia.edu/~vschmidt/notes/redhat2fedora/
for good hints on how to upgrade with yum.

Should also be possible to boot either instance of Linux with both disks
installed if you appropriately edit /boot/grub/grub.conf, and
/alt/etc/fstab and /alt/etc/mtab on the /dev/hdb2 partition, but won't
go into all that detail here.

Good luck!

Phil






More information about the fedora-list mailing list