Product Announcements

Ops changes part 4 – Injecting or installing drivers

Two weeks ago I was presented with a problem regarding the use of drivers that were not part of the standard ESXi ISO. I started looking into it and discovered there are two main solutions for a problem like this.

  1. Installing drivers during the installation
  2. Injecting drivers into the ISO

Both solutions have it's advantage and disadvantage but I guess the main argument why I prefer to install drivers during the installation versus injecting them into the ISO is flexibility and support. When a new driver is released I want to be able to change the driver bundle instantly without the need to repackage the ISO and I want the installation mechanism to be fully supported. However there are always corner cases where it might be required to inject the driver into the ISO. In this article we will describe both methods. I have used the following articles and documents to create this article:

Installing drivers during the installation

The steps required to install drivers during a scripted installation are straight forward. First the driver package needs to be downloaded and preferably hosted on an internal website. I would recommend using the same location as were the ks.cfg is stored for your scripted install. (If http based of course.)

With ESXi there are two sections where you can define post installation actions. These sections are %post and %firstboot. The difference between these two is that all actions defined in %post will run before the Installer reboots the host where all actions defined in %firstboot will run during the first boot. In the case of %firstboot this is done by a script located in /etc/vmware/init/init.d/ with a prefix of 999, which means it is the last script to be executed during boot.

Depending on the driver that needs to be installed you will either need to use the %post or the %firstboot section. The %post section is mostly used in the case where a network driver needs to be downloaded before the restart, see my article on yellow-bricks.com for an example. In most cases however placing all commands in %firstboot should suffice. Our example will deal with the most common scenario and that is the download and installation of a driver in the %firstboot section.

Edit the install script and include the following in the %firstboot section where <ip-address> needs to be replaced with the ip-address of the web server and <driverbundle> with the name of the actual bundle:

This script will place the host in maintenance mode install the bundle and exit maintenance mode again. This is a very simple and flexible method to install drivers during the installation. Please note that it might be necessary to reboot the server after the installation of the patches. This can of course also be scripted, just at a "reboot" at the end of the %firstboot section if required.

Inject drivers into the ISO

The second options which enables you to use drivers that are not part of the standard ISO is to inject them into the ISO. This is a bit more complex and a less flexible solution as every update to the drivers will require the ISO to be repackaged. Also note that VMware currently does not support the injection of drivers into the ISO and this procedure is provided "as is" without warranty/guarantee.

The following tools are used to alter the ISO:

  1. Auto Deploy appliance
  2. VMware Workstation (VMware Player or ESXi will also work)

The first step is to import the Auto Deploy appliance into VMware Workstation. When it has been imported you will need to power it on and make the ESXi ISO available. (If the power-on fails with a kernel panic you will need to change the SCSI device to "lsilogic" and the OS to "Redhat 5 – 64Bit".) When the ISO is available the following steps will need to be taken to inject a driver:

  1. Mount the ISO image
    sudo mount -o loop VMware-VMvisor-Installer-4.1.0.update1-348481.x86_64.iso /mnt/iso/
  2. Create a new folder which will be used for the content of the mounted IS0
    mkdir /tmp/custom-iso
  3. Copy the content of the ISO to the folder
    cp -R /mnt/iso/* /tmp/custom-iso/
  4. Go to the tmp folder
    cd /tmp
  5. Unzup the image to enable the injection of a bundle
    sudo bunzip2 -c /tmp/custom-iso/imagedd.bz2 > imagedd
  6. Inject the bundle (-o) or a driver (-v) into the image, for the exercise we will insert a single .vib file, please not that <filename.vib> will need to replaced with the actual filename
    sudo vibddi -i imagedd -v <filename.vib> -n
  7. Validate that the bundle has been injected
    sudo vibddi -i imagedd -q
  8. Zip the image
    bzip2 imagedd
  9. Create a new checksum
    md5sum imagedd.bz2
  10. Copy the checksum and replace the checksum in the following file using your favorite editor (I used "vi")
    /tmp/custom-iso/imagedd.md5
  11. Copy the file to the custom ISO folder (might need to "sudo" depending on the permissions)
    cp imagedd.bz2 /tmp/custom-iso/
  12. Go to the custom ISO folder
    cd /tmp/custom-iso
  13. Recreate the ESXi ISO
    mkisofs -l -J -R -r -T -input-charset UTF-8 -o /tmp/VMware-Custom-VMvisor-Installer-4.1.0.update1-348481.x86_64.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /tmp/custom-iso

Now the ISO should be ready for use! Again, please note that VMware does not support the "vibddi" injection mechanism. However, I decided to document this procedure as in some cases it is very difficult to install ESXi without having the drivers packaged inside the ISO and I wanted to show that it is possible.

Hopefully this will ease your migration to ESXi.