Managing ESXi without the VI Client – Part 4

In part one of Managing ESXi without the VI client, I dealt with some initial setup issues and creating a VM. In part two I demonstrated the process to add a license key, enable VM auto-start options and to unregister a VM. In part three of these articles I covered the process of creating a new virtual switch to which I attached a firewall VM. In this part I will cover installing a patch for ESXi.

1) I created a folder on a datastore to store the download and then made it the current directory.

# mkdir patches
# cd patches

2) I then downloaded the patch zip file. Note that the download URL from the vmware.com download page will be https and that won’t work with wget. Change the URL to http and then download the file.

  # wget https://hostupdate.vmware.com/software/VUM/OFFLINE/release-149-20090917-785671/ESXi400-200909001.zip
   wget: not an http or ftp url: https://hostupdate.vmware.com/software/VUM/OFFLINE/release-149-20090917-785671/ESXi400-200909001.zip
# wget http://hostupdate.vmware.com/software/VUM/OFFLINE/release-149-20090917-785671/ESXi400-200909001.zip
   
   Connecting to hostupdate.vmware.com (96.17.116.7:80)
   ESXi400-200909001.zi 100% |**********************************************************************|   163M 00:00:00 ETA


3) I then ran esxupdate to install the patch. The first attempt failed with the below error because the host was not in maintenance mode.

/vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/patches # ls -l

   -rw-r--r--    1 root     root          171723397 Oct 29 20:49 ESXi400-200909001.zip
   /vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/patches # esxupdate update --bundle=ESXi400-200909001.zip
 ESXi400-200909001.zip                                   ############################################################################## [100%]
Unpacking vmware-esx-firmware-4.0.0-0.7.193498.i386.vib ############################################################################## [100%]
Unpacking vmware-esx-tools-light-4.0.0-0.7.193498.i38.. ############################################################################## [100%]
Encountered error MaintenanceModeError:
   The error data is:
   Message     - The following VIBs require this host to be in maintenance mode:
   deb_vmware-esx-firmware_4.0.0-0.7.193498.  Please put the host
   in maintenance mode to proceed.
   Errno       - 18
   Description - Maintenance mode is not enabled or could not be determined.
   /vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/patches #
 

4) I then shutdown all VMs with vim-cmd vmsvc/power.shutdown and vmsvc/power.off. To put the host in maintenance mode I used vim-cmd hostsvc/maintenance_mode_enter. With the task_list option I could check that a task was created and I used hostsummary to verify that the host was in maintenance mode. I could have also used task_info to verify if the task had completed.

# vim-cmd hostsvc/maintenance_mode_enter
   'vim.Task:haTask-ha-host-vim.HostSystem.enterMaintenanceMode-365'
# vim-cmd hostsvc/task_list
   (ManagedObjectReference) [   'vim.Task:haTask-ha-host-vim.HostSystem.enterMaintenanceMode-365']
# vim-cmd hostsvc/hostsummary | grep Maintenance
   inMaintenanceMode = true,

5) I then ran the install for the patch again and it was successful.

/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/patches # esxupdate update --bundle=ESXi400-200909001.zip
   ESXi400-200909001.zip                       ########################################################### [100%]
Removing packages :vmware-esx-tools-light   ########################################################### [100%]
Installing packages :deb_vmware-esx-firmw.. ########################################################### [100%]
Installing packages :deb_vmware-esx-tools.. ########################################################### [100%]
The update completed successfully, but the system needs to be rebooted for the
   changes to be effective.

6) Prior to rebooting the host I took the host out of maintenance mode so that my VMs would automatically start.

# vim-cmd hostsvc/maintenance_mode_exit
'vim.Task:haTask-ha-host-vim.HostSystem.exitMaintenanceMode-398'
# vim-cmd hostsvc/hostsummary | grep Maintenance
inMaintenanceMode = false,

7) To be on the safe side I ran auto-backup.sh to backup the system configuration for ESXi.

8) I issued the reboot command to restart the host.

9) After the host was back up I went to check the state of the VMs and found that they had not powered up. I checked to see if the host was in maintenance mode and it was despite taking it out of maintenance mode above. I exited maintenance mode and then started up the VMs.

~ # vim-cmd vmsvc/power.getstate 352
Retrieved runtime info
Powered off
~ # vim-cmd vmsvc/power.getstate 272
Retrieved runtime info
Powered off
~ # vim-cmd hostsvc/hostsummary | grep Maintenance
inMaintenanceMode = true,
task_list
~ # vim-cmd hostsvc/maintenance_mode_exit
'vim.Task:haTask-ha-host-vim.HostSystem.exitMaintenanceMode-1852795280'
~ # vim-cmd hostsvc/hostsummary | grep Maintenance
inMaintenanceMode = false,
~ # vim-cmd vmsvc/power.on 272
Powering on VM:

10) Lastly I checked the version of ESXi to ensure I was running the patched version.

~ # vmware -v
   VMware ESXi 4.0.0 build-193498
   ~ #

Leave a Comment

Your email address will not be published. Required fields are marked *