imgdb.tgz file is corrupt
Recently I happen to deal with such an issue while installing the patches on an ESXi host using vSphere Update Manager. This issue is rare and will occur if you interrupt the patches remediation task abruptly, in my case thanks to one of my colleague.
I will mention the steps which helped me to recover the image profile for the ESXi host.
Issue: No image profile is found on the host or image profile is empty. In my case image profile shows Unknown – no profile defined
This issue has been seen on systems where the image database file, imgdb.tgz, is corrupt. An image profile is required to install or remove VIBs.
How to confirm if you are proceed with the mentioned solution:
To confirm that the imgdb.tgz file is corrupt:
Connect to the ESXi host via an SSH session.
Change directory to /vmfs/volumes by cd /vmfs/volumes
Search for the imgdb.tgz file: find * | grep imgdb.tgz
Note: This command normally results in two matches. For example:
Run this command on each match:
ls -l match_result
ls -l 0ca01e7f-cc1ea1af-bda0-1fe646c5ceea/imgdb.tgz
-rwx—— 1 root root 26393 Jul 20 19:28 0ca01e7f-cc1ea1af-bda0-1fe646c5ceea/imgdb.tgz
The default size for the imgdb.tgz file is approximately 26 KB. If one of the files is only a couple of bytes, it indicates that the file is corrupt.
There are 2 ways you can fix this issue. To work around this issue, perform one of these options:
1. Rebuild the ESXi host
2. Copy an imgdb.tgz file from a known good ESXi host to the host having the issue
You may rebuilt if you want but that is not what you are looking for!
Now let us see how we can proceed with the second option:
To copy the imgdb.tgz file from a known good ESXi host perform the following:
On the working ESXi host, copy a good copy of imgdb.tgz by perform the following
cp /bootbank/imgdb.tgz /vmfs/volumes/<shared-LUN>
On the corrupt host, copy the good copy of the imgdb.tgz to /tmp:
cp /vmfs/volumes/<shared LUN>/imgdb.tgz /tmp
tar -xzf imgdb.tgz
Copy the good profile files to the profile directory:
cp /tmp/var/db/esximg/profiles/* /var/db/esximg/profiles/
Copy the good VIBs to the VIB repository:
cp /tmp/var/db/esximg/vibs/* /var/db/esximg/vibs/
Remove the corrupt imgdb.tgz from the bootbank:
Move the good copy of imgdb.tgz into the bootbank:
cp /tmp/imgdb.tgz /bootbank/
Backup configuration changes made:
Restart the ESXi host, Attempt to install or patch the host again using vSphere Update Manager.