• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

Installing drivers during a scripted install of ESXi

Duncan Epping · Feb 23, 2011 ·

As you hopefully have read I have been busy over the last weeks with a new project. This project is all about enabling migrations to ESXi. I wrote two articles for the ESXi Chronicles blog of which the first article describes the scripted install procedure and the seconds gives some additional advanced examples of what is possible in these scripts. Based on that article I started receiving some questions from the field and last week I had a conference call with a customer who had issues “injecting” a driver into ESXi during the install. Normally installing a driver is done by using a simple “esxupdate” command and a reboot, but in this case however the situation was slightly different and let me explain the problem first.

This customer implemented a script that would run during the %firstboot section. The name of the section already explains what it is, this section will run after the reboot of the scripted install has been completed. The way this works is that ESXi creates a script in /etc/vmware/init/init.d with the prefix 999. This script will run as the last script during the boot and is generally used to configure the host. After a final reboot this script is automatically deleted and the host is ready to be added to vCenter.

The challenge however that this customer was facing is that it was using a Xsigo network environment. In this scenario a server that would need to be reinstalled would get a temporary network configuration that would only work during the first boot. Meaning that before this %firstboot section would even run the original network configuration would be restored. The problem with that however is that the original network configuration requires the drivers to be installed before it can be used. In other words, after the reboot done by the installer you will not be able to access the network unless you have loaded the drivers. This rules out downloading the drivers during the %firstboot section. Now how do we solve this?

The scripted installation has multiple sections that can contain your commands. The first section is called %post. The ESXi setup guide describes this section as follows:

Executes the specified script after package installation has been completed. If you specify multiple %post sections, they are executed in the order they appear in the installation script.

This means that in the case of this customer we will be able to use this section to download any driver package required with for instance “wget” and that is what I did. I issued the command below during the %post section and rebooted the server.

wget http://192.168.1.100/xsigo.zip

The problem however was that the package wasn’t persisted after a reboot which brought me back to right where I began, without a network after the restart. Than I figured that during the install a local datastore is created and I could use that as persistent storage. So I issued the following command in the %post section of the script:

wget http://192.168.1.100/xsigo.zip -O /vmfs/volumes/datastore1/xsigo.zip

I rebooted the installer and checked after the install if the driver bundle was there or not, and yes it was. The only thing left to do was to install the driver in the %fistboot section. This by itself is a fairly simple task:

esxupdate --bundle=/vmfs/volumes/datastore1/xsigo.zip update

As the host will need to reboot before the drivers are loaded I also added a “reboot” command at the end of to the “%firstboot” section. This ensures the drivers are loaded and the network is accessible.

I guess this demonstrates how easy a solution can be. When I first started looking into this issue and started brainstorming I was making things way too complex. By using the standard capabilities of the scripted install mechanism and a simple “wget” command you can do almost everything you need to do during the install. This also removes the need to fiddle around with injecting drivers straight into the ISO itself.

Go ESXi 🙂

Share it:

  • Tweet

Related

Server, Various 4.1, esxi, install, Scripting, scripts, vSphere

Reader Interactions

Comments

  1. Yuri Semenikhin says

    23 February, 2011 at 14:08

    Nice example

    “Go ESXi”

    after new release of vSphere, no choose to use ESX 😉
    so preparing to migrate from ESX to ESXi

  2. Sylvain Huguet says

    23 February, 2011 at 14:35

    I had to do the same recently, and I’d like to point that you need to enable maintenance mode (using vim-cmd for exemple) before installing the driver.

    Don’t forget to leave the maintenance mode after the driver as been installed!

    • Duncan Epping says

      23 February, 2011 at 15:02

      It seems to work fine without entering maintenance mode here during the install?

      • Sylvain Huguet says

        24 February, 2011 at 08:11

        I had to do this first last year for an ESX scripted install, and then I updated the script for ESXi PXE installation.

        I have to admit I didn’t test without entering maintenance mode on ESXi, but for ESX I’m sure you have to… I’ve assumed it would be the same for ESXi, and didn’t bother to test without it.

        If you say it’s not needed anymore, then it’s great news!

        • Duncan Epping says

          24 February, 2011 at 08:45

          It worked here, but it does make sense to enter maintenance mode first just to be on the safe side.

  3. Jeff Couch says

    23 February, 2011 at 14:46

    Great article Duncan. Exactly what I have been looking for! Thanks.

  4. Duncan Epping says

    23 February, 2011 at 15:40

    As one of my colleagues pointed out you can also download patches directly via “esxupdate” however in this case that would not work as esxupdate cannot be used in the %post section of the script as far as I am aware. In the %firstboot section it would look like this:

    esxupdate –bundle=http://192.168.1.100/xsigo.zip update

  5. ilya says

    4 August, 2011 at 23:25

    i’m under impression “wget/curl” and alike dont exist on esxi 4.1u1

    Is script above still valid?

Primary Sidebar

About the author

Duncan Epping is a Chief Technologist in the Office of CTO of the Cloud Platform BU at VMware. He is a VCDX (# 007), the author of the "vSAN Deep Dive", the “vSphere Clustering Technical Deep Dive” series, and the host of the "Unexplored Territory" podcast.

Upcoming Events

Feb 9th – Irish VMUG
Feb 23rd – Swiss VMUG
March 7th – Dutch VMUG
May 24th – VMUG Poland
June 1st – VMUG Belgium

Recommended Reads

Sponsors

Want to support Yellow-Bricks? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2023 · Log in