This is my own approach on customizing the VMWare vSphere ESX 4.0 installation DVD.
The vSphere ESX 4 install process uses an updated linux boot release commonly referred to as Syslinux. From the Syslinux boot process vSphere launches an initrd.img kernel instance which is a custom VMware/Linux kernel containing a multitude of VMware ESX 4 drivers and components. The custom VMware kernel incorporates Linux kickstart scripting functionality to invoke automated installations. The script location is defined as part of the Syslinux functionality and is available as a menu at boot time. A control file located on the boot media provides these variable control elements.
So this is my attempt to documenting my approach on modifying the VMWare syslinux boot menu and putting my kickstart config file “ks.cfg” on the boot media. This makes an install clean and only requires the installation DVD instead of a USB thumb drive to hold the ks.cfg.
For more information my particular ks.cfg file and how I prompt for dynamic ESX host properties like network information and FQDN see my previous post here.
To put a custom “ks.cfg” file on the CDROM’s filesystem so you need a couple of prerequisites….I use the mkisofs tool to modify the default ESX ISO because it is a Unix command line tool and I’m familiar with using it. You can use whatever you are comfortable with but the document process below will need to be adjusted.
Do all of this signed in as root, of course. Install the mkisofs tool on an ESX Host with a lot of space, you can download the version I used here
# rpm -i ./mkisofs-2.0-6.i386.rpmDownload the DVD iso from VMware and upload to your ESX Service console on one your ESX hosts.
Mount the iso
# mount -o loop ./esx-DVD-4.0.0-164009.iso /mnt/cdromCreate a Directory to hold the contents of this iso in a filesystem that has at least 3 GB of free space.
# mkdir /home/root/newisoCopy the contents of the mounted iso to this new newiso directory:
# cp -rp /mnt/cdrom/* /home/root/newisoUnmount the ESX DVD iso
# cd /root/newiso # umount /mnt/cdrom
To save space you can now delete the original iso file. We don’t need it anymore.
In the new location change into the isolinux sub-directory.
# cd /root/newiso/isolinuxFirst we need to modify the isolinux.cfg file. This controls the menu that is displayed when the isolinux image is booted.
The default menu looks something like this:
And is defined in the isolinux.cfg like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | default esx gfxboot bootlogo prompt 1 #menu title ESX build 164009 timeout 300 LABEL esx menu default menu label Install ESX in graphical mode kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M quiet LABEL esx-text menu label Install ESX in text mode kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M text quiet LABEL usb-ks menu label ESX Scripted Install using USB ks.cfg kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=usb quiet LABEL first-disk-safe menu label ESX Scripted Install to first disk kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=file:///usr/lib/vmware/weasel/examples/ks-first-safe.cfg quiet LABEL first-disk menu label ESX Scripted Install to first disk (overwrite VMFS) kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=file:///usr/lib/vmware/weasel/examples/ks-first.cfg quiet LABEL skip-install menu label ^Boot from first hard disk localboot 0x80 |
I modified mine to point to a local ks.cfg file on the dvd we will be creating so networking would not be required. It now looks like this:

My modified Installation menu
Here is my modified isolinux.cfg file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | default esxscriptedtext gfxboot bootlogo prompt 1 timeout 300 LABEL esxscriptedtext menu default menu label Install ESX Using Scripted Text-mode, Prompt for Network kernel vmlinuz append initrd=initrd.img mem=512M text ks=file:///ks.cfg LABEL esx menu default menu label Manually Install ESX in graphical mode kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M quiet LABEL usb-ks menu label ESX Scripted Install using USB ks.cfg kernel vmlinuz append initrd=initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=usb quiet LABEL skip-install menu label ^Boot from first hard disk localboot 0x80 |
Much of it is the same but take note of the “esxscriptedtext” section I added that point to the local “ks.cfg” file.
Now we need to extract the isolinux boot image from the initrd file in the same directory.
Create a sub-directory to hold the extracted initrd files.
# mkdir newinitrd # cd newinitrd
Now extract the gziped cpio archive into this new directory.
# zcat ../initrd.img |cpio --extractThis extracts the files into your sub-directory. The only change we need to make is to copy in the customized ks.cfg file that I’m going to use to script my installation. See this post for a detail explanation of my ks.cfg file.
# cp /root/ks.cfg /root/newiso/isolinux/newinitrdNow that the root of the installation isolinux image contains our customized ks.cfg we need to reassemble the initrd.img file. From the newinitrd sub-directory create the new base file, then
# cd /root/newiso/isolinux/newinitrd # gzip it like this: find ./ | cpio -H newc -o > ../initrd # gzip ../initrd --suffix .img
We are almost ready to create the new iso so we need to get rid of the newinitrd sub-directory. We can always re-extract it from the initrd.img we just created
# cd .. # rm -rf newinitrd
Now to create the new iso image, I use the mkiosfs package.
Change to the root of the the new directory you created earlier.
# cd /root/newisoThe command to create the ISO took my quite awhile to puzzle out. The syntax below was from the mkisofs-2.0-6.i386.rpm version of the package and worked for me on ESX 4.0.
# mkisofs -l -J -R -r -T -o /root/ESX_scripted.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /root/newisoCopy off the ESX_scripted.iso and burn it with your favortie DVD burning package. And you are in business.
Thanks for the article, I’m currently struggling to achieve the same goal.
I think an easier option may be to simply add the kickstart as a plain file on the iso image (not include it in the initrd).
You can then use the boot option ‘ks=cdrom://path_to_the_kickstart.cfg’ on isolinux.cfg. No big differences but it saves you the extraction of the cpio archive every time you want to update the kickstart.
Comment by Erwan — August 11, 2010 @ 7:42 am