Today we had an issue with one of our older vSphere ESXi hosts which is version 5.5. The vSphere environment which holds these ESXi hosts is version 6.5. This should not be a problem in general but we did encounter some kind of error on the hosts which were being upgraded to version 6.5 through Update Manager.
Upgrade Manager gave us some error about conflicting VIB’s that are still present on the ESXi hosts but conflicting with the newer image. Instead of removing those automatically Update Manager crashes and basically tells you to fix it yourself. So that is what we did! We found out that the following two VIB’s were providing us these errors:
scsi-lpfc820
scsi-qla2xxx
Because the hosts were already decommissioned and out of any production environment, we just deleted them from the command line with the following two commands:
~ # esxcli software vib remove -n=scsi-lpfc820 --dry-run
Removal Result
Message: Dryrun only, host not changed. The following installers will be applied: [BootBankInstaller]
Reboot Required: true
VIBs Installed:
VIBs Removed: Emulex_bootbank_scsi-lpfc820_10.0.727.24-1OEM.500.0.0.472560
VIBs Skipped:
~ # esxcli software vib remove -n=scsi-qla2xxx --dry-run
Removal Result
Message: Dryrun only, host not changed. The following installers will be applied: [BootBankInstaller]
Reboot Required: true
VIBs Installed:
VIBs Removed: QLogic_bootbank_scsi-qla2xxx_934.5.29.0-1OEM.500.0.0.472560
VIBs Skipped:
~ # esxcli software vib remove -n=scsi-lpfc820
Removal Result
Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
Reboot Required: true
VIBs Installed:
VIBs Removed: Emulex_bootbank_scsi-lpfc820_10.0.727.24-1OEM.500.0.0.472560
VIBs Skipped:
~ # esxcli software vib remove -n=scsi-qla2xxx
Removal Result
Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
Reboot Required: true
VIBs Installed:
VIBs Removed: QLogic_bootbank_scsi-qla2xxx_934.5.29.0-1OEM.500.0.0.472560
VIBs Skipped:
I found this process quite tedious to be honest, especially because I had to do this on 10 hosts. So I figured, isn’t this possible through PowerCLI? Well good news, ofcourse it is! It took me some time to figure it out because most of the examples on the internet didn’t work for me. In one example that I found Luc Dekens used the following script:
Get-VMHost | %{
$esxcli = Get-EsxCli -VMHost $_
$esxcli.software.vib.list() | Where { $_.Name -like “*vibname*”} | %{
$esxcli.software.vib.remove($false, $false, $false, $true, $_.Name)
}
}
I integrated these constructs in my script but this didn’t work at all, all I received was the following:
If specified, the arguments parameter must contain a single value of type Hashtable.
At line:9 char:1
+ $esxcli.software.vib.remove.Invoke($true, $false,@($vib), $false, $fa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException
Digging some more inside this method I noticed that it wanted me to give it a single argument with all parameters. I found this while entering:
$esxcli.software.vib.remove
=====================
EsxCliMethodElement: remove
Methods:
--------
Hashtable CreateArgs()
InstallationResult Invoke(Hashtable args)
string Help()
So after some more digging and looking around on the internet I made this script to help me delete the faulty VIB’s:
#Start of script.
##########################################
# Author = Bryan van Eeden #
# Version = 1.0 #
# Date = 21/12/2018 #
##########################################
$VMhostlist = @(Get-VMHost -Name "VMHostName")
foreach($VMhost in Get-VMHost -Name $VMHostlist){
$esxcliRemoveVibArgs = $esxcli.software.vib.remove.CreateArgs()
$esxcliRemoveVibArgs.dryrun = $true
$esxcli = Get-EsxCli -VMHost $VMhost -V2
$vibs = $esxcli.software.vib.list.Invoke() | where{$_.Name -match "scsi-qla2xxx" -or $_.Name -match "scsi-lpfc820" }
foreach ($vib in $vibs){
$esxcliRemoveVibArgs.vibname = $vib.Name
$esxcli.software.vib.remove.Invoke($esxcliRemoveVibArgs)
}
}
#End of script.
The result of this script is:
Message : Dryrun only, host not changed. The following installers will be applied: [BootBankInstaller]
RebootRequired : true
VIBsInstalled :
VIBsRemoved : {Emulex_bootbank_scsi-lpfc820_10.0.727.24-1OEM.500.0.0.472560}
VIBsSkipped :
Message : Dryrun only, host not changed. The following installers will be applied: [BootBankInstaller]
RebootRequired : true
VIBsInstalled :
VIBsRemoved : {QLogic_bootbank_scsi-qla2xxx_934.5.29.0-1OEM.500.0.0.472560}
VIBsSkipped :
So I went ahead and changed the “dry-run” argument to $false and it removed the VIB’s from the ESXi hosts.
I thought it would be useful to share this in this post because it took me quite some time to make it work, especially because there is not a lot of documentation around that worked for me or is still accurate. I am still not sure why the script that Luc made doesn’t work for me, but now that I made the one above it doesn’t matter anymore.
2 Comments
Dominik · November 4, 2019 at 12:09 pm
Thanks for this post, it save me some minutes!
There is a small mistake!
$esxliRemoveVibArgs -> ESXLi not CLi in some lines
Bryan van Eeden · November 8, 2019 at 7:18 pm
Hi Dominik,
Thank you for noticing it. I changed it. It was only the argument definition though, so no functionality was impaired. Since it was consistent throughout the script. But for esthetic purposes I changed it into
$esxcliRemoveVibArgs.