RHEL-ES-4 kickstart %post problems

Oliver Hookins ohookins at gmail.com
Thu Apr 7 23:49:24 UTC 2005


OK sorry for inundating you all with questions but what is happening
here doesn't really make sense. Previously we had kickstart scripts
set up for RHEL-ES-3 and Fedora Core 2 that worked perfectly. The idea
was to set up some bind mounts, install some extra RPMs and set up
CFengine.

Now even the basic section that sets up the bind mounts is not
working. I cannot for the life of me figure out why. Has Redhat
changed the shell that the %post script uses? For starters, here is
the partitioning layout we use, which is determined from parameters
passed to the kernel and included in the %pre script:

---------------
# /
part raid.00 --size 500      --ondisk=sda
part raid.01 --size 500      --ondisk=sdb
# swap
part raid.10 --size 2048     --ondisk=sda
part raid.11 --size 2048     --ondisk=sdb
# /var
part raid.20 --size 2048     --ondisk=sda
part raid.21 --size 2048     --ondisk=sdb
# /usr
part raid.30 --size 2048     --ondisk=sda
part raid.31 --size 2048     --ondisk=sdb
# /data
part raid.40 --size 1 --grow --ondisk=sda
part raid.41 --size 1 --grow --ondisk=sdb

# Assemble the RAID devices.
raid /     --fstype ext3 --level=RAID1 raid.00 raid.01
raid swap  --fstype ext3 --level=RAID1 raid.10 raid.11
raid /var  --fstype ext3 --level=RAID1 raid.20 raid.21
raid /usr  --fstype ext3 --level=RAID1 raid.30 raid.31
raid /data --fstype ext3 --level=RAID1 raid.40 raid.41
----------------

I know that this works, since the drive is empty before this and I
have checked that all of the desired partitions and mount points are
created.

Then, in the %post section, I have some code that determines which
partitioning style we selected, and installs grub properly to the MBR
(a bug workaround), then sets up the bind mounts:

------------
%post
# Fix up Grub installation which is broken in EL4 and FC3
PART=`cat /proc/cmdline | tr ' ' '\n' | grep '^part=' | cut -d= -f2`

if [ "$PART" = "ide-hda-hdb-srv" ]; then
  grub --batch << EOF
    device (hd0) /dev/hda
    root (hd0,0)
    setup (hd0)
    device (hd1) /dev/hdb
    root (hd1,0)
    setup (hd1)
    quit
  EOF
elif [ "$PART" = "ide-hda-hdc-srv" ]; then
  grub --batch << EOF
    device (hd0) /dev/hda
    root (hd0,0)
    setup (hd0)
    device (hd1) /dev/hdc
    root (hd1,0)
    setup (hd1)
    quit
  EOF
elif [ "$PART" = "ide-hda-srv" ]; then
  echo "Single drive GRUB installs are fine."
elif [ "$PART" = "ide-freedom" ]; then
  echo "Single drive GRUB installs are fine."
elif [ "$PART" = "ide-ws" ]; then
  echo "Single drive GRUB installs are fine."
elif [ "$PART" = "scsi-raid1" ]; then
  grub --batch << EOF
    device (hd0) /dev/sda
    root (hd0,0)
    setup (hd0)
    device (hd1) /dev/sdb
    root (hd1,0)
    setup (hd1)
    quit
  EOF
elif [ "$PART" = "scsi-raid5" ]; then
  grub --batch << EOF
    device (hd0) /dev/sda
    root (hd0,0)
    setup (hd0)
    device (hd1) /dev/sdb
    root (hd1,0)
    setup (hd1)
    device (hd2) /dev/sdc
    root (hd2,0)
    setup (hd2)
    quit
  EOF
else
  echo "If this was a RAID install, GRUB may not be installed properly."
fi

# Setup bind mounts.
if [ -d /data ]
then
        test -d /var/lib/mysql || mkdir -p /var/lib/mysql
        test -d /var/lib/pgsql || mkdir -p /var/lib/pgsql
        mkdir /data/home /data/opt /data/var.lib.mysql /data/var.lib.pgsql
        cat >> /etc/fstab <<EOF
/data/home          /home          none defaults,bind 0 0
/data/opt           /opt           none defaults,bind 0 0
/data/var.lib.mysql /var/lib/mysql none defaults,bind 0 0
/data/var.lib.pgsql /var/lib/pgsql none defaults,bind 0 0
EOF
        mount /home
        mount /opt
        mount /var/lib/mysql
        mount /var/lib/pgsql
else
        echo "Data is not a directory"
fi
----------------------

Now, GRUB is installed properly since the system boots. But, I am
finding that on the terminal, it is printing Data is not a directory.
I can confirm immediately on the second terminal that
/mnt/sysimage/data exists (since the %post is executed in a chroot of
/mnt/sysimage).

What could be going wrong with the script that is causing it not to
set up these bind mounts? It is stumping me... especially since it
worked fine on RHEL-ES-3 and Fedora Core 2, but not RHEL-ES-4 or
Fedora Core 3?!?!

Thanks,
Oliver




More information about the Redhat-install-list mailing list