Attempts to create or extract a Host Profile from an ESXi host fail with the following error:
A general system error occurred:
Failed to read the current contents of the hosts file.
This error may be visible in the vSphere Client or hostd.log as:
vmodl.fault.SystemError
message = "Failed to read the current contents of the hosts file"
From syslog:
hostprofile: Calling GatherData() for profile type EtcHostsProfile
hostprofile: /etc/hosts in file {('10.xxx.xxx.xx', 'hostname.domain.tld', ('alias',), '')...}
vCenter Server connected to the affected host
VMware ESXi
We used the following commands according to below KB workaround option 3 https://knowledge.broadcom.com/external/article/385346/hosts-constantly-sending-dns-queries.html
This issue occurs when the /etc/hosts file on the ESXi host has been manually edited or modified using unsupported tools such as configstorecli.
Such changes create inconsistencies between the configstore and system-level configurations, which can break components relying on consistent networking and identity resolution, such as Host Profiles or vLCM.
To resolve the issue, revert any manual modifications made to /etc/hosts or direct edits to the configstore. Then re-add the required entries using the supported esxcli method.
Remove the manually added entries from /etc/hosts.
Reboot the host to restore the default configuration.
Re-add the host mappings using supported commands:
esxcli network ip hosts add # To add a new host entryesxcli network ip hosts list # To list existing entriesesxcli network ip hosts remove # To remove an existing host entry
# Add a new host entry (example) esxcli network ip hosts add --ip 10.xxx.xxx.xx --hostname host-name.domain --alias hostname# List existing entries esxcli network ip hosts list# Remove an incorrect entry (example) esxcli network ip hosts remove --ip 10.xxx.xxx.xx --hostname host-name.domain
Replace all IP addresses and hostnames with values specific to your environment.
After completing the above, re-attempt Host Profile extraction from vCenter.
Editing /etc/hosts directly is no longer supported in ESXi 7.0 U3 and later. The use of esxcli ensures:
Proper configstore synchronization
Compatibility with hostd/vpxa services
Successful use of features like Host Profiles and vLCM