VMware Cloud Community
NZPostie
Contributor
Contributor

ESX 3.5 Kickstart Post Problem

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

  1. Installation Method

cdrom

  1. root Password

rootpw --iscrypted abcdefgh

  1. Authconfig

auth --enableshadow --enablemd5

  1. BootLoader ( The user has to use grub by default )

bootloader --location=mbr --driveorder=cciss/c0d0

  1. Timezone

timezone Europe/London

  1. X windowing System

skipx

  1. Install or Upgrade

install

  1. Text Mode

text

  1. 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

  1. Language

lang en_GB

  1. Langauge Support

langsupport --default en_GB

  1. Keyboard

keyboard uk

  1. Mouse

mouse generic3ps/2

  1. Reboot after install ?

reboot

  1. Firewall settings

firewall --disabled

  1. Clear Partitions

clearpart --all --initlabel --drives=cciss/c0d0

  1. 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

  1. VMware Specific Commands

vmaccepteula

vmlicense --mode=server --server=27000@mylicenseserver --edition=esxFull

%packages

@base

%vmlicense_text

%post --nochroot

  1. Prepare the workspace

mkdir /vmimages/build

cd /vmimages/build

esxcfg-firewall --allowIncoming

esxcfg-firewall --allowOutgoing

  1. 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

  1. STEP 1 - Copy config.sh from cd to the build area

  2. mount the cd

  3. 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

  1. STEP 2 - Create the build.sh and host.cfg for the post installation process

  2. since the configuration cannot execute during the installation we need to

  3. 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..."

  1. 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

  1. 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

  1. Set execution properties of all scripts

chmod 755 /vmimages/build/*.sh

  1. 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

Tags (2)
0 Kudos
3 Replies
NZPostie
Contributor
Contributor

Problem caused by starting script file on Window Smiley Sad fixed by using dos2unix

0 Kudos
keinstein
Contributor
Contributor

Could you please explain how you fix the problem? Thanks!!

0 Kudos
admkern
Contributor
Contributor

Problem Occurs while using windows Editor´s for building the Files.

The Problem is CR/LF. Use "dos2unix " to remove CR/LF.

0 Kudos