This is an old revision of the document!
Table of Contents
ESXi - Update ESXi Host on CLI
This page describes the update procedure of a standalone ESXi host on command line. The commands can be performed over SSH or on the ESXi Shell.
Check current Version
Get the version and build information about the host just to know what you are working on.
~ # esxcli system version get Product: VMware ESXi Version: 6.0.0 Build: Releasebuild-2494585 Update: 0 Patch: 0
Configure firewall for outgoing HTTP connections
To update your host with VIB's from the internet you have to allow httpClient in the firewall. You can check if the connections are alowed with the following command.
~ # esxcli network firewall ruleset list -r httpClient Name Enabled ---------- ------- httpClient true
If the command returns false you can allow it with the following command.
~ # esxcli network firewall ruleset set -r httpClient -e true
Get the latest profile name
Now you have to determine the profile you want to update to.
You can perform this action on command line.
~ # esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-6 ESXi-6.0.0-20150404001-standard VMware, Inc. PartnerSupported ESXi-6.0.0-20150704001-standard VMware, Inc. PartnerSupported ESXi-6.0.0-20150704001-no-tools VMware, Inc. PartnerSupported ESXi-6.0.0-20150404001-no-tools VMware, Inc. PartnerSupported ESXi-6.0.0-2494585-standard VMware, Inc. PartnerSupported ESXi-6.0.0-20150504001-no-tools VMware, Inc. PartnerSupported ESXi-6.0.0-20150701001s-no-tools VMware, Inc. PartnerSupported ESXi-6.0.0-20150701001s-standard VMware, Inc. PartnerSupported ESXi-6.0.0-20150504001-standard VMware, Inc. PartnerSupported ESXi-6.0.0-2494585-no-tools VMware, Inc. PartnerSupported
There is a web page with detailed information about the updates, including VIB names with link, short description, imageprofile name and a lot more. I really like it. It is more comfortable to get the profile name on the web page than on CLI. VMware ESXi Patch Tracker
Stop running VM's
To update the host, you have to enter the maintenance mode which requires no running machines. So let's stop the running machines.
Show which VM's are running:
~ # esxcli vm process list my_vm_x World ID: 35930 Process ID: 0 VMX Cartel ID: 35699 UUID: 56 4d 67 bf 2c 52 e1 e0-33 1b 57 42 02 d8 d8 3b Display Name: my_vm_x Config File: /vmfs/volumes/5463f5fa-e9e1b35a-983d-6451066626e8/my_vm_x/my_vm_x.vmx my_vm_y World ID: 36398 Process ID: 0 VMX Cartel ID: 36397 UUID: 56 4d f9 f5 10 4e fa e0-42 e8 80 17 a2 bf b5 93 Display Name: my_vm_y Config File: /vmfs/volumes/5463f5fa-e9e1b35a-983d-6451066626e8/my_vm_y/my_vm_y.vmx
Now get the Vmid's of this VM's:
~ # vim-cmd vmsvc/getallvms Vmid Name File Guest OS Version Annotation 1 my_vm_x [my_host_storage1] my_vm_x/my_vm_x.vmx windows8Server64Guest vmx-11 11 my_vm_z [my_host_storage1] my_vm_z/my_vm_z.vmx solaris10_64Guest vmx-11 13 my_vm_y [my_host_storage1] my_vm_y/my_vm_y.vmx debian8_64Guest vmx-11
Repeat the following command with every Vmid of your running VM's:
~ # vim-cmd vmsvc/power.shutdown 1
I use the following one-liner to shutdown all my running vm's. Use it at your own risk.
~ # for vmid in $(vim-cmd vmsvc/getallvms | egrep "$(esxcli vm process list | grep "^[^ ]" | xargs | sed 's/ /|/g')" | awk '{ if($1 ~ /^[0-9]*$/ ) { print $1} }'); do vim-cmd vmsvc/power.shutdown $vmid; done
Set host to maintenance mode
Now set the host to maintenance mode:
~ # esxcli system maintenanceMode set -e true
If the command won't return, there are some problems entering maintenance mode. Probably some VM's are still running. Check and shutdown them on another SSH session or with VMware vSphere Client.
If the command returns you can check the current mode with the following command.
~ # esxcli system maintenanceMode get Enabled
Start upgrade process
Now you are ready to upgrade. Replace the profile name of the following command (ESXi-6.0.0-20150704001-standard) with your prefered profile name to upgrade to. It takes some minutes until the Update Result is displayed.
~ # esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-6.0.0-20150704001-standard Update Result Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective. Reboot Required: true VIBs Installed: VMware_bootbank_esx-base_6.0.0-0.11.2809209, VMware_bootbank_lsu-lsi-lsi-mr3-plugin_1.0.0-2vmw.600.0.11.2809209, ... VIBs Removed: Hewlett-Packard_bootbank_scsi-hpsa_5.5.0.106-1OEM.550.0.0.1331820, LSI_bootbank_scsi-mpt2sas_15.10.06.00.1vmw-1OEM.550.0.0.1198610, ... VIBs Skipped: VMWARE_bootbank_mtip32xx-native_3.8.5-1vmw.600.0.0.2494585, VMware_bootbank_ata-pata-amd_0.3.10-3vmw.600.0.0.2494585, ...
Upgrade HP software and drivers
If you are using an HPE Server, you may want to upgrade all HP VIB's too.
The simplest way to do this, is to directly fetch the HP VIB repo data.
~ # esxcli software vib update -d https://vibsdepot.hpe.com/hpe/index.xml [MetadataDownloadError] Could not download from depot at https://vibsdepot.hpe.com/hpe/index.xml, skipping (('https://vibsdepot.hpe.com/hpe/index.xml', '', '[Errno 14] HTTP Error 404: Not Found')) url = https://vibsdepot.hpe.com/hpe/index.xml Please refer to the log file for more details.
But I bet it won't work for you, too. HP and VMware seemes to share their website developers and hosters, because the availability and performance of both sites is really bad.
Another way to upgrade is to download the depot and do an offline installation.
Download the depot ZIP file on https://my.vmware.com/. You will find it in the section “Custom ISOs”. It's name will be similar to “VMware-ESXi-6.0.0-Update2-3620759-HPE-600.U2.9.4.7.13-Mar2016-depot.zip”. Now you have to extract the ZIP file on a datastore which is accessible by your ESX (myDataStore).
Update the HP VIB's with the local depot.
~ # esxcli software vib update --depot=file:///vmfs/volumes/myDataStore/VMware-ESXi-6.0.0-Update2-3620759-HPE-600.U2.9.4.7.13-Mar2016-depot/index.xml Installation Result Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective. Reboot Required: true VIBs Installed: BRCM_bootbank_net-tg3_3.137l.v60.1-1OEM.600.0.0.2494585, EMU_bootbank_elxnet_10.5.121.7-1OEM.600.0.0.2159203, ... VIBs Removed: Broadcom_bootbank_misc-cnic-register_1.710.70.v55.1-1OEM.550.0.0.1331820, Broadcom_bootbank_net-bnx2_2.2.5f.v55.16-1OEM.550.0.0.1331820, ... VIBs Skipped: Hewlett-Packard_bootbank_char-hpcru_6.0.6.14-1OEM.600.0.0.2159203, Hewlett-Packard_bootbank_char-hpilo_600.9.0.2.8-1OEM.600.0.0.2159203, ...
Exit maintenance mode
You may want to exit the maintenance mode so your VM's will start automatically after reboot. This can be especially useful if your management machine is on this ESXi host and you update to another major version because it can occur that SSH is disabled after reboot.
Exit maintenance mode:
~ # esxcli system maintenanceMode set -e false
Check status:
~ # esxcli system maintenanceMode get Disabled
Reboot host
Reboot your host. You will loose your SSH connection to it.
~ # reboot ~ # Connection to my_host closed by remote host. Shared connection to my_host closed.
Reconnect to host
Restart your SSH connection to your host if it is back.
manu@automatix:~$ ssh my_host The time and date of this login have been sent to the system logs. VMware offers supported, powerful system administration tools. Please see www.vmware.com/go/sysadmintools for details. The ESXi Shell can be disabled by an administrative user. See the vSphere Security documentation for more information. ~ #
Check running version
Now check again your current ESXi host version. The output should differ from the last execution.
~ # esxcli system version get Product: VMware ESXi Version: 6.0.0 Build: Releasebuild-2809209 Update: 0 Patch: 11
Credits
- Thanks to William Lam for his uncountable and wonderful blog post about VMware and ESXi including the one I got the upgrade information from A Pretty Cool Method of Upgrading to ESXi 5.1.
- Thanks to Andreas Peetz for maintaining the VMware ESXi Patch Tracker.