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 a general system error.

Error visible in the vSphere Client or /var/run/log/hostd.log:
vmodl.fault.SystemError message = "Failed to read the current contents of the hosts file"

Error visible in /var/run/log/syslog.log:

hostprofile: Calling GatherData() for profile type EtcHostsProfile hostprofile: /etc/hosts in file {('<REDACTED_IPS>', '<REDACTED_HOSTNAMES>', ('alias',), '')...}

Environment

VMware ESXi 
VMware vCenter Server

Cause

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

  1. Remove the manually added entries directly from the /etc/hosts file on the affected ESXi host.

  2. Reboot the ESXi host to restore the default configuration state.

  3. Re-add the required host mappings utilizing the supported esxcli namespace.

Command syntax for adding a new host entry: esxcli network ip hosts add --ip <xx.xx.xx.xx> --hostname <xxxxxxxx> --alias <xxxxxxxx>

Command syntax for listing existing entries: esxcli network ip hosts list

Command syntax for removing an incorrect entry: esxcli network ip hosts remove --ip <xx.xx.xx.xx> --hostname <xxxxxxx>

  1. Re-attempt the Host Profile extraction from vCenter Server.

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