While I was trying to list the VIBs installed on my esxi, got following error
[email@example.com:/var/db/esximg/profiles] esxcli software vib list [DatabaseIOError] Failed to create empty Database directory: [Errno 17] File exists: 'vibs' Please refer to the log file for more details. [firstname.lastname@example.org:/var/db/esximg/profiles]
The error message was not clear. The message said, File exists: ‘vibs’. But I haven’t created any file with name ‘vibs’. This error message prompted me to think about what is “empty Database directory” shown in the error message.
Where is Software Database Directory
With some search and experiments, it was observed that, the esx software information is kept in following places
By looking into the logs in /var/log/esxupdate, I could find a specific error related to /var/db/esximg directory
esxupdate: HostImage: INFO: Installer <class 'vmware.esximage.Installer.LiveImageInstaller.LiveImageInstaller'> was not initiated - reason: Could not parse Vib xml from database /var/db/esximg: (None, 'Could not parse VIB XML data: None.')
The above specific error was coming because of the presence of a file in /var/db/esximage/profiles directory. I had accidentally placed a script in this directory and the “esxcli software vib list” command fails to parse the xml information from that directory.
[email@example.com:/var/db/esximg/profiles] ls -lrt total 24 -r--r--r-- 1 root root 18827 Mar 1 10:56 %28Updated%29%20ESXi-5.5.0-20140302001-standard-1115286101 -rw-r--r-- 1 root root 35 Apr 22 09:56 a.py [firstname.lastname@example.org:/var/db/esximg/profiles]
When I removed the file from the /var/db/esximg directory, the error disappeared and the command worked fine.
This made me to find out how esxcli software vib list command is working and from where it is fetching the information. Below section can corrupt your machine’s patchDB, so do it with caution.
Display your own VIB information
[email@example.com:/var/db/esximg/vibs] esxcli software vib list |grep -i emulex emulex-esx-elxnetcli 10.2.309.6v-0.0.2494585 VMware VMwareCertified 2016-03-01
Now go to /var/db/esximg/vibs directory and copy emulex-esx-elxnetcli–20239152.xml to emulex-esx-vwires–20239152.xml
[firstname.lastname@example.org:/var/db/esximg/vibs] cp emulex-esx-elxnetcli--20239152.xml emulex-esx-vwires--20239152.xml
Open the newly created emulex-esx-vwires–20239152.xml using vi editor and modify the <name> property to whatever name you like such as ’emulex-this-is-test-vib’
[email@example.com:/var/db/esximg/vibs] esxcli software vib list |grep -i emulex emulex-esx-elxnetcli 10.2.309.6v-0.0.2494585 VMware VMwareCertified 2016-03-01 emulex-this-is-test-vib 10.2.309.6v-0.0.2494585 VMware VMwareCertified 2016-03-01 [firstname.lastname@example.org:/var/db/esximg/vibs]
The above output shows that, esxcli software vib list command parses all xml’s inside /var/db/esximg/vibs directory and displays values from certain tags from these xmls.