ESXi Software Image Database

While I was trying to list the VIBs installed on my esxi, got following error

[root@vwires.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.
[root@vwires.com:/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

  • /bootbank/imgdb.tgz
  • /var/db/esximg
  • /locker/packages/var/db/locker/

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.

[root@vwires.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
[root@vwires.com:/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

[root@vwires.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

[root@vwires.com:/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’

[root@vwires.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
[root@vwires.com:/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.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s