Configure Advanced Bootloader and Kernel Options

by admin

You can perform an unattended installation or upgrade of an ESXi host by using scripts. To do so, you need a kickstart file, which can either be included in the ESXi image, or accessed by configuring the boot options of the host during the install, or via PXE boot. The kickstart file/installation script is called ks.cfg, a default one can be found on the ESXi media.

Once you have created/modified a kickstart file with suitable settings for your environment, it needs to be placed where it can be reached by the host during install. You can call the kickstart file from any of the following locations:

  • FTP
  • NFS Share
  • USB flash drive
  • CD/DVD device

Once you have your kickstart file in place, and accessible to your hosts, you need to edit the boot loader settings on the host in order to call the script. A example of the contents of a ks.cfg file would be:

#Sample kickstart scripted installation
rootpw VMware1!
install --firstdisk --overwritevmfs
network --bootproto=static --ip= --gateway= --nameserver= --netmask= --hostname=esxi5.vmlab.loc --device=vmnic0 --addvmportgroup=0

%firstboot --interpreter=busybox
# Rename local datastore name
vim-cmd hostsvc/datastore/rename datastore1 "$(hostname -s)-local-storage-1"
# DNS names
esxcli system hostname set --fqdn=esxi5.vmlab.local
esxcli network ip dns search add --domain=vmlab.local
# DNS server addresses
esxcli network ip dns server add --server=
# SSH and ESXi shell
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell

You can then call the script by pressing SHIFT-0 when the installer starts:


You will then be presented with a prompt, where you can set the boot options referencing the ks.cfg file (which in this example I’ve placed on a web server):

ks= nameserver= ip= netmask= gateway=

After hitting return, the installation will begin and the host will be configured with the settings defined in the ks.cfg script. Other boot loader options include (taken from VMware KB200582):

Boot Option Description
BOOTIF=<MAC address> Tries to use a network adapter device when looking for an installation script and installation media.
gateway=<ip address> Sets this network gateway as the default gateway
ip=<ip address> Sets up a static IP address to be used for downloading the installation script and the installation media.
ks=cdrom:/<path\> Performs a scripted installation with the script at path, which resides on the CD in the CD-ROM drive.
ks=file://<path> Performs a scripted installation with the script at path.
ks=protocol://<serverpath> Performs a scripted installation with a script located on the network at the given URL. Protocol can be HTTP, HTTPS, FTP, or NFS.
ks=usb:</path> Performs a scripted install, accessing the script from an attached USB drive. Searches for a file named ks.cfg.
nameserver=<ip address> Specifies a domain name server
netdevice=<device> Use network adapter device (MAC or vmnicN)
netmask=<subnet mask> Specifies subnet mask for the network interface
vlanid=<vlanid> Configure the network card to be on the specified VLAN
ksdevice=device Tries to use a network adapter device when looking for an installation script and installation media. Specify as a MAC address, for example, 00:50:56:C0:00:01. This location can also be a vmnicNN name. If not specified and files need to be retrieved over the network, the installer defaults to the first discovered network adapter that is plugged in.

There is a default ks.cfg script which can be found at /etc/vmware/weasel/ks.cfg. You can use this as the basis for your ks.cfg script if required.

Configuring ESXi Kernel Options

ESXi uses the  mboot.c32 boot loader during installation. The boot.cfg file contains the Kernel path, Kernel options and boot modules used by mboot.c32. The boot loader configuration file contains the following statements:

Command Description
title=STRING Sets the title of the boot loader.
kernel=FILEPATH Sets the kernel path.
kernelopt=STRING Adds options to the kernel. For example, you may specify the kickstart file location here.
modules=FILEPATH Lists the modules to be loaded

If you want to create a custom ESXi iso, you could do so, editing the ‘kernelopt’ string to point to an installation/ks script, which saves having to change the boot loader options.

Given a Scenario, Determine when to Customize a Configuration

There a few ways to install ESXi, both manually and automated. The options are:

  • Interactive Install
  • Scripted Install
  • vSphere Auto Deploy

The scripted install, I’ve touched on here, whilst I have written about Auto Deploy elsewhere on the site.

Generally speaking, if you have a small number of hosts to install, an interact installation is the best approach. If you have a larger number of hosts then it is worth spending the time looking at automating the installations.

Useful Links and Resources


Keep up to date with new posts on - Follow us on Twitter:
Be Sociable, Share!

Leave a Comment


Previous post:

Next post: