cancel
Showing results for 
Search instead for 
Did you mean: 

Kickstart %POST problems.

Paul Clayton
Frequent Advisor

Kickstart %POST problems.

I got this problem with the kickstart configuration. IT works well until the %post bit, and then nothing afterwards. I have tried multiple options, but no luck. What I am trying to do is mount an NFS server, then cpio the archive down to recreate the base image of the server.
Below is my kickstart config file.

#Generated by Kickstart Configurator
#platform=x86, AMD64, or Intel EM64T
#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#Sytem timezone
timezone Africa/Johannesburg
#Root password
rootpw --iscrypted $1$FkGS4/cU$jalrqQZH8uFOfT0QNk/Lu/
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
nfs --server=*******.***.******.com --dir=/data/Redhat/RHEL_4
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext3 --size 25
part / --fstype ext3 --size 16958
part swap --size 448
#System authorization infomation
auth --useshadow --enablemd5
#Network information
Left out for security reasons
#Firewall configuration
firewall --disabled
#SELinux configuration
#selinux --enforcing
#Do not configure XWindows
skipx
%post
#/usr/sbin/chroot /mnt/sysimage
/bin/hostname ranger.cpt.intecbilling.com
/bin/mkdir /mnt/archmnt
/bin/mount ****.*****.*****.com:/data/linux/recovery/archives/ranger /mnt/archmnt
cd /
/usr/bin/open -s -w -- /bin/cpio -icvt /mnt/archmnt/archive_latest.cpio
7 REPLIES
Jean-Yves Picard
Trusted Contributor

Re: Kickstart %POST problems.

hello,

just my 2 cents :

try
cat < /mnt/sysimage/cpio-it.sh
/bin/hostname ranger.cpt.intecbilling.com
/bin/mkdir /mnt/archmnt
/bin/mount ****.*****.*****.com:/data/linux/recovery/archives/ranger /mnt/archmnt
cd /
/usr/bin/open -s -w -- /bin/cpio -icvt /mnt/archmnt/archive_latest.cpio
EOF

/usr/sbin/chroot /mnt/sysimage cpio-it.sh


my guess is that your first chroot fork a /bin/sh and then stop.

Jean-Yves Picard
Paul Clayton
Frequent Advisor

Re: Kickstart %POST problems.

I did try a basic
echo "hello" >>/etc/motd
and nothing at all. It seems to jump this section completely.
Alexander Chuzhoy
Honored Contributor

Re: Kickstart %POST problems.

I'm not sure whether you use chroot or comment it out, but I don't use chroot in %post section.

also is ****.*****.*****.com recognizable by the machine on which the kickstart runs,i.e can it access it via hostname,etc.
Are the NFS permissions allow this host to connect?

Robert Walker_8
Valued Contributor

Re: Kickstart %POST problems.

Gday,

We have the following this all runs under chroot environment - no need to do or say anything else other than %post assuming your script is a bash one!

%post
!/bin/bash
chvt 3
NFSSERVER=192.168.1.1
mkdir /nfs
mount -o ro,nolock -t nfs $NFSSERVER:/data/nfs /nfs
echo "Starting Post Build Script"
ksh -x /nfs/buildserver/postbuild.sh "KICKSTART" 3 1 >> /root/postbuild.log 2>&1

all data is referenced via /nfs an NFS mount point on root. Your NFS server needs a mount point of /data/nfs as *(ro,sync) and all files under it need to be world readable/executable is your going to runs scripts.

The above postbuild does all sorts of stuff including registering to the redhat network depending upon parameter 2 - 3 indicates dont bother, 1 uses are prod rhn user and 2 is an eval one we setup. Parameter 3 sets up hardened systems does more than the generic config.

Hope this helps, we had some problems to start with however now its a dream, the only problem we get is building servers in between firewalls and not at this stage having it down pat as to what ports we need completely open for the build etc.

Robert.
Robert Walker_8
Valued Contributor

Re: Kickstart %POST problems.

Sorry, mucked up !/bin/bash should be #!/bin/bash otherwise should be ok.

Robert.
Paul Clayton
Frequent Advisor

Re: Kickstart %POST problems.

RObert, Thanx I will try that way around as see if it works. What I note of interest, is that you declare the hash pling upfront as if the whole process was a script.
Jean-Yves Picard
Trusted Contributor

Re: Kickstart %POST problems.

Hello,

Paul you wrote :
I did try a basic
echo "hello" >>/etc/motd
and nothing at all. It seems to jump this section completely.

in this case, Hello is writen on temporary /etc/motd, which is lost when system reboot.

you should try
echo hello > /mnt/sysimage/etc/mytest.txt

and to answer Alexander, ****.*****.*****.com ought to be resolved and have read access since it is used on nfs --server %install part of kickstart.

Jean-Yves