Brian, thanks for finally clearing that up.

I went ahead and came up with my own solution to this problem; however
this is a single hangup that I cant seem to get past; if anyone has ANY
suggestions I would be forever in their debt as I have spent so much
time trying to make this thing work:

        I am using SystemImager to auto-install about 500 different
machines, some of them are CentOS; as you can Imagine I want to automate
the installation of the bootloader; so I wrote a 2 scripts to accomplish
this task. Why two? Because some of the machines are IDE, and some of
them are SATA, and I need to be able to use the same disk image on both
of the drive types. Here is the first bash script:

if grep -q sda /proc/diskstats
then
   TYPE="sda1"
   MOUNT1="/dev/sda1 /a/boot"
   MOUNT2="/dev/sda3 /a"
else
   TYPE="hda1"
   MOUNT1="/dev/hda1 /a/boot"
   MOUNT2="/dev/hda3 /a"
fi
   mount $MOUNT2
   mount $MOUNT1
   MOUNT3="proc /a/proc -t proc -o defaults"
   mount $MOUNT3
   MKSYS="-p /a/sys"
   MOUNT4="sysfs /a/sys -t sysfs -o defaults"
   mkdir $MKSYS
   mount $MOUNT4
   MOUNT5="/dev /a/dev -o bind"
   mount $MOUNT5
   echo "mount $MOUNT2"
   echo "mount $MOUNT1"
   cp /sbin/grubinstall /a/sbin/grubinstall
   chmod 755 /a/sbin/grubinstall
   chmod +x /a/sbin/grubinstall
   chroot /a /sbin/grubinstall
exit 0

What this does is determines whether the drive is SATA or IDE by looking
at diskstats, if it is SATA, it mounts /dev/sda1 & /dev/sda3, if it is
IDE, it mounts /dev/hda1 & /dev/hda3, it also creates and mounts all of
the auxillary filesystems (proc, sys, dev) The next script which I run
in the CentOS environment via chroot is:

TYPE=               
SUBS=
if grep -q sda /proc/diskstats
then
   TYPE="sda1"               
   SUBS="s/hda/sda/g"
else
   TYPE="hda1"
   SUBS="s/sda/hda/g"
fi
   grub-install --no-floppy --recheck /dev/$TYPE
   sed -i "$SUBS" /boot/grub/menu.lst       
   echo "sed -i $SUBS /boot/grub/menu.lst"
   sed -i "$SUBS" /etc/fstab
   echo "sed -i $SUBS /etc/fstab"
   sed -i "$SUBS" /boot/grub/grub.conf
   echo "sed -i $SUBS /boot/grub/grub.conf"
   sed -i "$SUBS" /etc/grub.conf
   echo "sed -i $SUBS /etc/grub.conf"
   ls "ls -l /etc/grub.conf /boot/grub/grub.conf /boot/grub/menu.lst"
exit 0


By the way /a is the ROOT of the hard drive (freshly imaged) and /a/boot
is the boot partition of the hard drive (freshly imaged).

This script again enumerates the type of hard disk attached to the
system, installs grub on /dev/hda1 or /dev/sda1, modifies
/boot/grub/menu.lst /boot/grub/grub.conf /etc/fstab /etc/grub.conf
sda>hda hda>sda and so forth.

        Everything actually works fine; grub is installed; the files are
all modified appropriately. 

        The issue comes when the newly imaged system comes up. The first
time the system boots up; grub is still configured to boot with
root=/dev/sda3; even though NONE of the configuration files mention
anything about /dev/sda3. However if I hit 'E' and modify the 'kernel
...' line in the grub editor from the bootloader, and allow it to boot
up; the system boots up normally.

        The STRANGE part; is that after the first time it boots off of
/dev/hda3; grub suddenly starts using that EVERY time the system boots;
but I cant figure out why I have to first manually change it; and then
reboot before it will work.

        Its almost like the CentOS boot process 'fixes' whatever is
wrong with grub; the first time it boots after I run my crazy script on
it; but I cant figure out what process during the boot is doing it; or
what else I need to do to ensure trouble free auto-installation of
CentOS.

Any advice anyone can give me would be wonderful.

Thanks,
-Drew

-----Original Message-----
From: Brian Elliott Finley [mailto:[EMAIL PROTECTED] On Behalf Of
Brian Elliott Finley
Sent: Friday, March 03, 2006 9:34 PM
To: Drew Weaver
Cc: sisuite-users@lists.sourceforge.net
Subject: Re: [Sisuite-users] Can System Imager deal with LVM yet?

I'm afraid what you are attempting is currently not a supported
configuration.  Disk type independence is my next priority after getting
the current udev and uyok code, that is currently in the development
trunk, released as stable.

Cheers, -Brian


Thus spake Drew Weaver ([EMAIL PROTECTED]):
>       Actually; all I'm doing is trying to get it to install grub on
>an ext3 partition without disk labels. It works fine if I am imaging
>from hda -> hda or sda->sda but if I go from hda->sda or sda->hda, it
>fails to update /etc/fstab, /etc/grub.conf, /boot/grub/menu.lst.. etc
>etc etc.
>
>-Drew
>
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Andrea
>Righi
>Sent: Friday, March 03, 2006 12:42 PM
>To: sisuite-users@lists.sourceforge.net
>Subject: Re: [Sisuite-users] Can System Imager deal with LVM yet?
>
>Drew,
>
>could you provide more details about that? For example grub is not able
>to load kernel & initrd if them are over an LVM volume... I don't know
>if this is your scenario, but in this case you should consider to
create
>a /boot plain partition using for example ext[23], reiserfs, etc...
>
>Regards,
>-Andrea
>
>Drew Weaver wrote:
>> It doesn't even install grub properly; so I doubt it handles LVM.
>> 
>> -Drew
>> 
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting
>language
>that extends applications into web and mobile media. Attend the live
>webcast
>and join the prime developer group breaking into this new coding
>territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=12164
2
>_______________________________________________
>Sisuite-users mailing list
>Sisuite-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/sisuite-users
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
>that extends applications into web and mobile media. Attend the live
webcast
>and join the prime developer group breaking into this new coding
territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
>_______________________________________________
>Sisuite-users mailing list
>Sisuite-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/sisuite-users

-- 
Brian Elliott Finley
Mobile:  630.631.6621


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sisuite-users mailing list
Sisuite-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to