Drew, comments below...
Drew Weaver wrote: > 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: This point is not so clear to me... are you using the following script as a post-install script? because in this case I'm not able to figure how it can work, since post-install scripts run chrooted into the installed image... > > 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: > ok, now this is a post-install script (I suppose). Moreover (I'm sure this is not the problem), but I'd try to put grub-install after the substitutions. > 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. > You can check if your script is the last script executed just before the reboot... otherwise other scripts could modify the menu.lst, writing /dev/sda3 in the root parameter... systemconfigurator for example could do something like that... > 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. > Sure... look at update-grub: http://www.fifi.org/cgi-bin/man2html/usr/share/man/man8/update-grub.8.gz Maybe you can also try to run this command in a post-install script... Regards, -Andrea ------------------------------------------------------- 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=121642 _______________________________________________ Sisuite-users mailing list Sisuite-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sisuite-users