VMware Cloud Community
fatbobsufc
Contributor
Contributor

ESXi 5 Scripted Install Problem

Hi guys,

Despite having a nice set of working ESXi 4 scripts, I have found that the recent changes to the scripted install process for ESXi 5 has encouraged me to throw away the old scripts and start again with improvements.  However, I'm struggling with the pre-installation routine.

I followed William Lam's excellent tutorial at http://www.virtuallyghetto.com/2011/07/automating-esxi-5x-kickstart-tips.html which got me started, but I didn't want to have to specify all my IP parameters at the beginning of the build on the command line, preferring to have this in the script itself.  I therefore added the variables shown below.  For some reason I just can't get them to work and it defaults to DHCP based network settings (there is no DHCP server available).

#begin script

vmaccepteula

rootpw --iscrypted CryptedPassword

install --firstdisk --overwritevmfs

%include /tmp/networkconfig

%pre --interpreter=busybox

PREFQDN="fqdn.domain.com"


PREIP="10.x.x.x"

PREMASK="255.x.x.x"


PREGW="10.x.x.x"


PREDNS="10.x.x.x"


echo "network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=${PREIP} --netmask=${PREMASK} --gateway=${PREGW} --nameserver=${PREDNS}  --hostname=${PREFQDN}" > /tmp/networkconfig

# First boot script
%firstboot --interpreter=busybox

Script then continues into first boot script which I have omitted

Would appreciate anyone's help on this as googling has got me no-where.

0 Kudos
6 Replies
lamw
Community Manager
Community Manager

If you're hardcoding the IP Address, you don't need to use the %pre section, just specify the network --bootproto=static ....

I would recommend you use "dryrun" mode and login to the ESXi Shell before the install even starts to ensure the IP Address is being set correctly and see what might be going on.

fatbobsufc
Contributor
Contributor

Ah OK thanks Will, yes because in the first boot section I specify the IP address anyway...

ESXi 4 used to fail when you do that though and insisted you either specified a valid static IP for the kickstart or set it to use DHCP - I guess that's changed with 5?

Will give it a try thanks for your help Smiley Happy

0 Kudos
fatbobsufc
Contributor
Contributor

Think I've just worked out what you meant! Yeah you see the thing is, other technicians will use this as a template going forwards so I want to use variables so they know they only ever need to edit the variables. Keeps it simpler and makes documentation easier.

In ESXi 4 you used to have to specify kick start network settings, even if you were using a ks.cfg on the cd-rom image. If you specified DHCP and there wasn't a DHCP server it would fail. You also couldn't use 'static' and simply omit the static IP. So I had to bung in dummy network settings in the kick start config and then the real ones lower down in the first boot section. This was confusing for other engineers. So you see I want to offer them just variables to edit, bearing in mind there is no dhcp server and we're using local ks scripts.

Hope that now makes sense and this reads OK is I'm writing it on tube via phone!

0 Kudos
fatbobsufc
Contributor
Contributor

Does that make any sense? Please let me know if not and I'll try to clarify... could really use some help,

0 Kudos
lamw
Community Manager
Community Manager

Sorry, I don't follow exactly what you're asking for. Per your initial request, you just need to specify the network line with your information and your static IP Address. If you're asking about prompting users to enter some information for each build, then take a look here - http://www.virtuallyghetto.com/2011/05/semi-interactive-automated-esxi.html

0 Kudos
MCioe
Enthusiast
Enthusiast

I would be interested to hear if a solution has been found on this post.  I am having similar issues with regard to the DHCP server errors.  I didn't use the %pre script, but hardcoded temporary values which I reset after the first boot is complete.  My script looks like:

network --bootproto=static --device=vnmic0 --ip=192.168.100.1 -netmask=255.255.255.0 --gateway=192.168.100.254 --vlanid=222 -hostname=ESX.localdomain.domain.mil --nameserver=192.168.100.1 --addvmportgroup=0

reboot

%firstboot --interpreter=busybox

do rest of script, which includes resetting IP, gateway, hostname etc.

I get errors in the vmkernel log indicating DHCP server could not be found, it times out trying to find the DHCP server, and then the script continues on.

I appreciate any thoughts as waiting on the DHCP server timeout is a bit long.

From vmkernel log:

Progress has happened on a task that has not started.

Network choices not specified, using DHCP

connectDHCP called for pnic Name

Still waiting for an ip address from DHCP

0 Kudos