Failure to Extract Host Profile – “Failed to Read the Current Contents of the Hosts File” Due to Manual /etc/hosts Modifications
search cancel

Failure to Extract Host Profile – “Failed to Read the Current Contents of the Hosts File” Due to Manual /etc/hosts Modifications

book

Article ID: 396088

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

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',), '')...}

Environment

vCenter Server connected to the affected host

VMware ESXi 

 

Cause

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.

 

Resolution

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.

Steps

  1. Remove the manually added entries from /etc/hosts.

  2. Reboot the host to restore the default configuration.

  3. Re-add the host mappings using supported commands:

esxcli network ip hosts add    # To add a new host entry
esxcli network ip hosts list   # To list existing entries
esxcli 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.

  1. After completing the above, re-attempt Host Profile extraction from vCenter.

 

Additional Information

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