Re: Second stage does not match boot disk error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert,

You need make sure the kernel versions in your boot image and your netstg1.img are the same.

mkdir /mnt/stg1
mount -o loop netstg1.img /mnt/stg1
cp /mnt/stg1/modules/modules.cgz
gunzip modules.cgz -S .cgz
cpio -ivdF modules

Check that the version in there matches the version in your boot(net) image... If not - update it... Obtain the correct kernel-BOOT rpm, create a new directory for that version, copy any additional
drivers in, gzip/cpio the modules back up and drop it back into your netstg1.img

I wrote the below enclosed script to ease the cracking open and buttoning up process:  Simply type:

 bootcrack bootnet.img 

The script simply opens the img file, opens the initrd file inside that, and optionally opens the modules/modules.cgz (use the -m option) into a temp area (configurable using ~/.bootcrackrc file).
Once the img is cracked open you can manipulate the kernel vers, etc... then... simply use the finish.sh script that bootcrack places in the top level temp directory where the image has been cracked
open.  The finish.sh script will button everything up.

The script is alpha - let me know if you have suggestions for improvement.

Let me know how you make out... 

Best of luck!
Mike


______________________________________
Michael Lynn, RHCE
Merrill Lynch - IDS DCS Unix Product Engineering
95 Greene Street, 5th Floor
Jersey City, NJ 07302
Desk: (201) 671-1063
Mobile: (215) 833-8441
Email: ml@xxxxxx


#!/bin/sh
#
#************************************************#
#                   bootcrack                    #
#           written by Mike Lynn <ml@xxxxxx>     #
#                December 05, 2003               #
# NO WARRANTY - USE AT YOUR OWN RISK             #
#                                                #
#      Utility to crack open fat image files.    #
#                                                #
#************************************************#

TEXTDOMAINDIR=/usr/local/share/locale
TEXTDOMAIN=bootcrack

#
# 	some functions
#

function requirements
{
        #####
        #       Function to gather and set requirements
        #       No arguments
        #####

	GUNZIP=`which gunzip`
	[ $? -eq 126 ] && error "Unable to find 'which'."
	# since these commands may move around, let's find'm and create vars
	for i in gzip gunzip umount mount zcat; do
		F=`which $i`
		if [ $? -gt 0 ]; then
			error "File %s not found." "$i" ; # File not found.
		fi	
		eval $i="$F"
	done
}

function helptext
{
        #####
        #       Function to display help message for program
        #       No arguments
        #####

        local tab=$(echo -en "\t\t")

        cat <<- -EOF-

        ${PROGNAME} ver. ${VERSION}
        This program opens an image file.

        $(usage)

        Options:

               -h, --help      Display this help message and exit.
               -v, --version   Display version and exit.
               -m              Enable modules.cgz processing.
               -i image        File system image to be cracked open.
               -d	       Display debug messages.
               -s	       Step Mode.  Display system calls prior to execution and pause.


-EOF-
}

function clean_up
{

        #####
        #       Function to clean up things - doesn't do much now.
        #       No arguments
        #####
	stty echo ; # turn echo back on.
	:
}

function create_finish
{

        #####
        #       Function to create a script that will close up things nicely.
        #       No arguments
        #####

cat <<- -EOF- >> $_TOPDIR/bootcrack$$/finish #!/bin/sh # this finish script was created by bootcrack ver. ${VERSION} TOPDIR="$_TOPDIR"
KERNEL_VERSION="$KERNEL_VERSION"
cd $_TOPDIR/bootcrack$$
DEBUG="$DEBUG"
STEPMODE="$STEPMODE"
PROGNAME='bootcrack'
VERSION="$VERSION"
_AUTOSTEP_TIMEOUT="$_AUTOSTEP_TIMEOUT"

msg()
{
        echo -n "\$PROGNAME: "
        local format=\$1
        shift
        printf "\$(gettext -s "\$format")\n" "\$@"
}
	
syscall()
{
        #####
        #       Function to execute commands - centralizing enables stepmode
        #       Argument: $0 - commands to execute
        #####

        let _SCNT=\$_SCNT+1
        local tab=\$(echo -en "\t")

        if [[ \$DEBUG || \$STEPMODE ]]; then
                echo "\$PROGNAME[\$_SCNT]: \${tab} \$* "
        fi
        if [ \$STEPMODE ]; then
                msg "Press [ENTER] to continue : "
                if [ \$_AUTOSTEP_TIMEOUT -gt 0 ]; then
                        read -t \$_AUTOSTEP_TIMEOUT ans <&1
                else
                        read ans <&1
                fi
                echo
                ans=\`echo \$ans | tr a-z A-Z\`
                [ "\$ans" == "Q*" ] && graceful_exit
        fi
        \$* 
        if [ \$? -gt 0 ]; then
                error "Error return - %s" "\$?"
        fi
}

remake_initfs()
{
        #####
        #       Function to recreate the initrd - resizing to save space
        #       No arguments
        #####
        FSOVERHEAD=30 ; # 30k file system overhead
	BASESIZE=\`du -s -k initfs | awk '{print \$1}'\`
	let SIZE=\$BASESIZE+\$FSOVERHEAD
        syscall dd if=/dev/zero of=newinitrd bs=1k count=\$SIZE
        syscall echo "y" | mke2fs newinitrd > /dev/null 2>&1
        syscall mkdir newinitfs
        syscall mount -o loop newinitrd newinitfs
        syscall cp -a initfs/* newinitfs/
	syscall rm -rf newinitfs/lost+found
        syscall $umount initfs
        syscall rm -rf initfs
        syscall rm -rf initrd
        syscall $umount newinitfs
        syscall mv newinitfs initfs
        syscall mv newinitrd initrd
	syscall mount -o loop initrd initfs
}
error() {

        ######
        # Function to exit with an error code
        ######

        printf "$(gettext -s ${1:-"Unknown Error"})\n" >&2
        exit 1
}
-EOF-
	if [ -n "$MODS" ]; then
	cat <<- -EOF- >> $_TOPDIR/bootcrack$$/finish function usage {

        #####
        # Print some helpful usage text
        #####

                error "Usage: \$0 [-d] [-s] [-m] <kernel ver>"
}
	
while getopts "sdm:" opt; do
        case \$opt in
                m )     MODDIR=\$OPTARG         ;;
		s )	STEPMODE=true		;;
		d )	DEBUG=true		;;
                * )     usage	                ;;
	esac
done
	if [ -n "\$MODDIR" ]; then
		KERNEL_VERSION="\$MODDIR"
	fi
FND=\`find . -name "\$KERNEL_VERSION"\`
if [ -z "\$FND" ]; then
	error "Modules error.  To correct this, rerun \$0 -m <KERNEL DIRECTORY>"
fi
find \$KERNEL_VERSION | cpio -ov -H crc | $gzip -c9  > initfs/modules/modules.cgz
-EOF-
fi ; # if MODS
cat <<- -EOF- >> $_TOPDIR/bootcrack$$/finish remake_initfs # recreate init to reduce size syscall $umount initfs syscall $gzip -S .img initrd syscall mv -f ${_INITRDIMG} bootnetfs syscall $umount
bootnetfs syscall rm -rf initfs syscall rm -rf bootnetfs
-EOF-
if [ -n $MODS ]; then
	cat <<- -EOF- >> $_TOPDIR/bootcrack$$/finish
	if [ -n $KERNEL_VERSION ]; then
		syscall rm -rf $KERNEL_VERSION
	fi
	if [ -f modules.cgz ]; then
		syscall rm -f modules.cgz
	fi

-EOF-

fi
	cat <<- -EOF- >> $_TOPDIR/bootcrack$$/finish msg "All done!  Your modified file can be viewed at %s" "$_TOPDIR/bootcrack$$/$BIMAGE"
syscall rm -rf finish
-EOF-

	syscall chmod +x $_TOPDIR/bootcrack$$/finish

} ; # finish


rootuser() {

        ######
        # Test for root
        ######

        if [ $(id -u) != "0" ]; then
                error "You must have superuser priviledges to execute %s" "$PROGNAME" 
        fi

}

usage() {

        #####
        # Print some helpful usage text
        #####

                error "Usage: %s [-i] <image file> [-h] [-v] [-m] [-d] [-s]" "$PROGNAME"
}


graceful_exit() {

        ######
        # Function to exit with a proper code
        ######

        clean_up
        exit 0
}
msg()
{
	echo -n "$PROGNAME: "
	local format=$1
	shift
	printf "$(gettext -s "$format")\n" "$@" 
}

syscall()
{
        #####
        #       Function to execute commands - centralizing enables stepmode
	#	Argument: $0 - commands to execute
	#####

	let _SCNT=$_SCNT+1
        local tab=$(echo -en "\t")

        if [[ $DEBUG || $STEPMODE ]]; then
		echo "$PROGNAME[$_SCNT]: ${tab} $* "
	fi
	if [ $STEPMODE ]; then
                msg "Press [ENTER] to continue : "
		if [ $_AUTOSTEP_TIMEOUT -gt 0 ]; then
			read -t $_AUTOSTEP_TIMEOUT ans <&1
		else
			read ans <&1
		fi
		echo
		ans=`echo $ans | tr a-z A-Z`	
		[ "$ans" == "Q*" ] && graceful_exit
	fi
	$*
	if [ $? -gt 0 ]; then
		error "Error return - %s" "$?"
	fi
}

error() {

        ######
        # Function to exit with an error code
        ######

	#printf "$(gettext -s ${1:-"Unknown Error"})\n" >&2
	local format=$1
	shift
	printf "$(gettext -s "$format")\n" "$@" >&2
	exit 1
}

function term_exit
{
        #####
        #       Function to perform exit if termination signal is trapped
        #       No arguments
        #####

        error " Terminated"
        clean_up
        exit
}
function version
{
	#####
	#	Report version info
	#####

	echo $PROGNAME $VERSION $EMAIL;
}
function int_exit
{
        #####
        #       Function to perform exit if interrupt signal is trapped
        #       No arguments
        #####

        echo 
	error "Aborted by user"
        clean_up
        exit
}

#
#       Program starts here
#

PROGNAME=$(basename $0)
VERSION="1.0.0"
EMAIL="Mike Lynn <ml@xxxxxx>"
_SCNT=0; # Counter for system calls
DEFAULT_LANG='en_US'

#
#	Look for local options file - default to global
#

if [ -f ~/.bootcrackrc ]; then
	. ~/.bootcrackrc
elif [ -f /etc/bootcrack ]; then
	. /etc/bootcrack
else
	_INITRDIMG='initrd.img'
	_TOPDIR='/tmp'
	_AUTOSTEP_TIMEOUT=5
fi

if [ -z $_INITRDIMG ]; then
	_INITRDIMG='initrd.img'
fi

#
# 	Set file creation mask so that all files are created with 600 permissions.
# 	This will help protect temp files.
#

umask 066

# Trap TERM, HUP, and INT signals and properly exit

trap term_exit TERM HUP
trap int_exit INT

#
# 	get required elements
#

requirements

QUIET=false

#
# 	shutup. not implemented yet.
#

if [ "$1" = "--quiet" ]; then
        QUIET=true
        shift
fi

#
# 	everybody needs help sometimes.
#

if [ "$1" = "--help" ]; then
        helptext
        graceful_exit
fi

if [ "$1" = "--version" ]; then
	version
	graceful_exit
fi

#
# 	if we've not got'ny args - carp about it.
#

if [ -z "$1" ]; then
	usage
	graceful_exit
fi

#
# 	if we've only one - why not use it.
#

if [ -f "$1" ]; then
	IMAGE=$1
	shift
fi

#
# 	Process command line options and arguments - edit to taste
#

while getopts "st:mhdqvi:" opt; do
        case $opt in
                t )     _TOPDIR="$OPTARG";;
                m )     MODS=true       ;;
                i )     IMAGE="$OPTARG" ;;
                d )     DEBUG=true      ;;
                q )     QUIET=true      ;;
                v )     version;
			graceful_exit 	;;
                h )     helptext
                        graceful_exit 	;;
		s )	STEPMODE=true	;;
                * )     usage
                        clean_up
                        exit 1
        esac
done

if [ -z "$_TOPDIR" ]; then
	_TOPDIR=/tmp
fi

BIMAGE=`basename $IMAGE`
if [ ! -f $IMAGE ]; then
	error "${MSGS[4]}" ; #	File not found.
fi

#
#	Get messages based on $LANG env variable
#

[ $DEBUG ]&& msg "Preparing working directory..." 

syscall mkdir -p $_TOPDIR/bootcrack$$

syscall cp -f $IMAGE $_TOPDIR/bootcrack$$

[ ! -d "$_TOPDIR/bootcrack$$/bootnetfs" ] && syscall "mkdir $_TOPDIR/bootcrack$$/bootnetfs"

syscall $mount -o loop $_TOPDIR/bootcrack$$/$BIMAGE $_TOPDIR/bootcrack$$/bootnetfs

#
# 	extract the initrd file from the bootnet image
#

syscall cp -f $_TOPDIR/bootcrack$$/bootnetfs/${_INITRDIMG} $_TOPDIR/bootcrack$$

syscall ${GUNZIP} -S .img $_TOPDIR/bootcrack$$/${_INITRDIMG}

[ ! -d "$_TOPDIR/bootcrack$$/initfs" ] && syscall mkdir $_TOPDIR/bootcrack$$/initfs

#
# 	mount up the ramdisk image into a temporary work area
#

syscall $mount -o loop $_TOPDIR/bootcrack$$/initrd $_TOPDIR/bootcrack$$/initfs

if [ -n "$MODS" ]; then
	syscall cd $_TOPDIR/bootcrack$$
	syscall cp $_TOPDIR/bootcrack$$/initfs/modules/modules.cgz $_TOPDIR/bootcrack$$
	KERNEL_VERSION=`$zcat modules.cgz | cpio -t |head -1 | awk -F / '{print $1}'`
	echo $KERNEL_VERSION if $DEBUG
	syscall $zcat $_TOPDIR/bootcrack$$/modules.cgz | cpio -ivd fi

#
# 	create the finish script to aid in buttoning things up when we're done modifying stuff.
#

create_finish

#
# 	tell everybody about we're finished. 
#

#echo "${MSGS[1]} $_TOPDIR/bootcrack$$."
msg "Your file image has been cracked open at %s." "$_TOPDIR/bootcrack$$"

#
# 	all done - bye
#

graceful_exit

#
#	Program Stops Here
#


-----Original Message-----
From: kickstart-list-admin@xxxxxxxxxx [mailto:kickstart-list-admin@xxxxxxxxxx] On Behalf Of Wehner, Robert
Sent: Wednesday, February 04, 2004 6:28 PM
To: 'kickstart-list@xxxxxxxxxx'
Subject: Second stage does not match boot disk error

I am attempting to build a RedHat AS 2.1 Update 2 (2.4.9-e.24) boot.iso disk with the 1.18k megaraid driver included in it to install on many Dell PE 1750s with the Perc 4/Di RAID cards. I know there
are some driver disks available for the megaraid driver, but driver disks just add too much complexity for the sometimes non-technical staff that has to do the final install of these servers.

Whenever I use my new boot disk, I get the following error message: 

"The second stage of the install which you have selected does not match the boot disk which you are using. I am going to reboot your system now."

Does anyone have any idea where this is coming from? Or how Anaconda determines a match between boot and 2nd stage media? It seems to come shortly after the netstg1.img file is downloaded to the 1750
being built.
(virtual console output at the end of this message).

Here is the long version of what I've done to build the new images: 
- download the megaraid drivers (1.18k) and compile against 2.4.9-e.24BOOT using DKMS per linux.dell.com.

-Using the basic procedure outlined at
http://www.puschitz.com/Kickstart.shtml I added the following to isolinux/initrd.img, RedHat/base/stage2.img, RedHat/base/netstg1.img:
  - added new megaraid.o to modules.cgz
  - added the following line to the pcitable: 
    0x1028  0x000f  "megaraid"      "Dell|PowerEdge Expandable RAID
Controller 4/Di"  

Sorry for the long email, but here's the console output when I get this
message:
* transferring
ftp://<my.kickstartserver.com>/kickstart/as_2.1u2/Redhat/base/updates.img to a fd
* transferring
ftp://<my.kickstartserver.com>/kickstart/as_2.1u2/disc1/Redhat/base/updates.
img to a fd
* transferring
ftp://<my.kickstartserver.com>/kickstart/as_2.1u2/Redhat/base/netstg1.img to a fd
* copied 8712192 bytes to /tmp/ramfs/netstg1.img
* loopfd is 13
* getting ready to spawn shell now
..................
<6> tg3: eth0: Link is up at 100Mps, full duplex <6> tg3: eth0: Flow control is off for TX and off for RX.
<4> Unable to identify CD-ROM format
<4> VFS: Can't find ext2 filesystem on dev loop(7,0).

I'm baffled why this won't work and would really appreciate if anyone has any comments/ideas.

thanks,
Robert 


_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list




[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux