Has anyone else hadissues getting the %post section to work with ESX
3.5 kickstart files. I'm using kickstart to automate our installations
and they running flawlessly except for the %post section. I can't get
even the simplest of commands to run. It is as if the entire post
section is ignored :_|
Any suggestions on how to fix or troubleshoot post kickstart?
I've put the kickstart file below.
Thanx
Installation Method
cdrom
root Password
rootpw --iscrypted abcdefgh
Authconfig
auth --enableshadow --enablemd5
BootLoader ( The user has to use grub by default )
bootloader --location=mbr --driveorder=cciss/c0d0
Timezone
timezone Europe/London
X windowing System
skipx
Install or Upgrade
install
Text Mode
text
Network install type
network --device eth0 --bootproto static --ip 172.190.11.88 --netmask 255.255.0.0 --gateway 172.190.11.128 --nameserver 172.190.35.63,172.190.35.56,172.160.35.80 --hostname myserver.server.com
Language
lang en_GB
Langauge Support
langsupport --default en_GB
Keyboard
keyboard uk
Mouse
mouse generic3ps/2
Reboot after install ?
reboot
Firewall settings
firewall --disabled
Clear Partitions
clearpart --all --initlabel --drives=cciss/c0d0
Partitioning
part /boot --fstype ext3 --size 103 --ondisk cciss/c0d0 --asprimary
part / --fstype ext3 --size 10240 --ondisk cciss/c0d0 --asprimary
part swap --size 2048 --ondisk cciss/c0d0 --asprimary
part /var/log --fstype ext3 --size 1992 --ondisk cciss/c0d0
part None --fstype vmkcore --size 110 --ondisk cciss/c0d0
VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@mylicenseserver --edition=esxFull
%packages
@base
%vmlicense_text
%post --nochroot
Prepare the workspace
mkdir /vmimages/build
cd /vmimages/build
esxcfg-firewall --allowIncoming
esxcfg-firewall --allowOutgoing
Amount of memory to reserve for the console OS
vmservconmem --reserved=800
dateTime=`date '+%c'`
echo "Built using a scripted install by the OurTeam. Built on "$dateTime > /etc/motd
STEP 1 - Copy config.sh from cd to the build area
mount the cd
extract the relevant files
mount /dev/cdrom
cp /mnt/cdrom/custom/build/* /vmimages/build/
umount /mnt/cdrom
#mkdir /tmp/esxcd
#mount -t iso9660 /mnt/cdrom /tmp/esxcd
#cp -a /tmp/esxcd/custom/build/* /vmimages/build/
#umount -f /tmp/esxcd
#rm -rf /tmp/esxcd
STEP 2 - Create the build.sh and host.cfg for the post installation process
since the configuration cannot execute during the installation we need to
echo everything to a file for execution on next reboot -- Niiice
cat >> build.sh << EOF1
#!/bin/sh
logger "ESX Host Scripted Build - build.sh"
echo "ESX Host Scripted Build..."
Creating the host configuration for this host
echo "Generating Custom Host config file..."
echo "hwmodel=BL460c" > /vmimages/build/host.cfg
echo "iphostname=myserver" >> /vmimages/build/host.cfg
echo "ipdomain=server.com" >> /vmimages/build/host.cfg
echo "ipaddress=172.190.11.88" >> /vmimages/build/host.cfg
echo "ipsubnet=255.255.0.0" >> /vmimages/build/host.cfg
echo "ipgateway=172.190.11.128" >> /vmimages/build/host.cfg
echo "ippridns=172.190.35.63" >> /vmimages/build/host.cfg
echo "ipsecdns=172.190.35.56" >> /vmimages/build/host.cfg
echo "ntpserver=timesrv" >> /vmimages/build/host.cfg
echo "vmotionip=172.190.222.210" >> /vmimages/build/host.cfg
echo "vmotionnm=255.255.0.0" >> /vmimages/build/host.cfg
echo "vmotiongw=172.190.11.128" >> /vmimages/build/host.cfg
echo "nicscspeed=1000" >> /vmimages/build/host.cfg
echo "nicvmotionspeed=1000" >> /vmimages/build/host.cfg
echo "nicotherspeed=1000" >> /vmimages/build/host.cfg
Set execution properties of all scripts and configs
chmod 755 /vmimages/build/*.cfg
echo "Running Custom Config Script..."
/vmimages/build/config.sh /vmimages/build/host.cfg
cp -f /etc/rc.d/rc.local.sav /etc/rc.d/rc.local
echo "Scripted Build - Rebooting Server - Hold on..."
reboot
EOF1
Set execution properties of all scripts
chmod 755 /vmimages/build/*.sh
Set configuration script on reboot
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.sav
echo "/vmimages/build/build.sh" >>/etc/rc.d/rc.local
esxcfg-firewall --blockIncoming
esxcfg-firewall --blockOutgoing
Problem caused by starting script file on Window fixed by using dos2unix
Could you please explain how you fix the problem? Thanks!!
Problem Occurs while using windows Editor´s for building the Files.
The Problem is CR/LF. Use "dos2unix " to remove CR/LF.