vCenter UI Displays "localhost"
search cancel

vCenter UI Displays "localhost"

book

Article ID: 372090

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • The vCenter hostname under inventory object view of the vCenter server will be displayed as localhost instead of the vCenter FQDN.



  • /var/log/vmware/vmon/vmon.log displays below log snippets:

    vmware-scaservice.yaml not present, we will go ahead and use the method parameters sent by the caller.
    YYYY-MM-DDTHH:MM:SS (##)+ host-####
    YYYY-MM-DDTHH:MM:SS (##) host-#### <vpxd> Service pre-start command's stderr: Failed to parse vpxd. cfg. File is not a valid XML! vpxd will launch with default settins. : Cannot parse file:/etc/vmware-vpx/vpxd. cfg

  • /var/log/vmware/vpxd/vpxd.log and the /usr/sbin/vpxd output displays below log snippets:

    YYYY-MM-DDTHH:MM:SS info vpxd[######][Originator@#### sub=vpxdVdb]    [VpxdVdb: : SetDBType] Logging in to DSN: VMware VirtualCenter with username vpxd
    YYYY-MM-DDTHH:MM:SS info vpxd[######][Originator@#### sub=vpxdVdb]    [VpxdVdb: : SetDBType] Logging in to DSN: VMware VirtualCenter with username vpxd
    YYYY-MM-DDTHH:MM:SS info vpxd[######][Originator@#### sub=vpxdVdb]    [VpxdVdb: : SetDBType] Logging in to DSN: VMware VirtualCenter with username vpxd
    YYYY-MM-DDTHH:MM:SS info vpxd [######]    [originator@#### sub=vpxdVdb]    [VpxdVdb: : SetDBType] Logging in to DSN: VMware VirtualCenter with username vpxd
    YYYY-MM-DDTHH:MM:SS info vpxd[######] [Originator@#### sub=vpxdVdb]    [Originator@#### sub=vpxdVdb]    [VpxdVdb: : SetDBType] Logging in to DSN: VMware VirtualCenter with username vpxd
    YYYY-MM-DDTHH:MM:SS error vpxd[######] [Originator@#### sub=vpxdVdb] [VpxdVdb: : SetDBType] Failed to connect to database: ODBC error: (08001) - [unixODBC] connection to    server on socket "/var/run/vpostgres/. s. PGSQL. 5432" failed: FATAL: Peer authentication failed for user "vpxd"    
    -- > . Retry attempt: #### ...

Cause

This issue occurs due to the /etc/vmware-vpx/vpxd.cfg file corruption, may be due to following reasons:

  • An abrupt/unexpected reboot/Power Outage in the environment.
  • Snapshot revert of the vCenter server.
  • Failed upgrades of the vCenter server.
  • After upgrade of the vCenter server, which changes the contents of the vpxd.cfg file.
  • Due to invalid characters/strings in the vpxd.cfg file.

Resolution

Option 1: Verify if the vpxd.cfg is valid or corrupt using KB316610.

Or using the below steps:

  1. Take Snapshot of the affected vCenter server (Offline Snapshots in case of ELM)
  2. Take ssh of the affected vCenter with root credentails.
  3. Go to /etc/vmware-vpx and run below command:

    xmllint --noout vpxd.cfg

    Example O/p:



  4. Take backup of the vpxd.cfg file, using below command:

    cp vpxd.cfg vpxd.cfg.bak

  5. Use the below command to edit the vpxd.cfg file:

    vi vpxd.cfg
  6. Remove the invalid characters/strings which are displayed above, save and exit using the below command:

    Press Esc key and Type :wq! and hit Enter key.

  7. Restart all the vCenter services using below command:

    service-control --stop --all && service-control --start --all

  8. Logout and re-login to the vCenter UI.

 

Option 2: If the above Option fail, then follow below steps to recreate and edit vpxd.cfg file:

  1. Take a Snapshot or Backup

Before making changes, take a valid snapshot or backup of the affected vCenter Server Appliance (VCSA) and any other nodes in the SSO domain.

  1. Gather Required Information from the Broken VCSA

Connect to the broken VCSA using SSH or console and collect the following:

    • FQDN of the vCenter

      Run:
      hostname -f
    • Machine ID

      Run:
      /usr/lib/vmware-vmafd/bin/vmafd-cli get-machine-id --server-name localhost
    • PostgreSQL Version

      Run:
      /opt/vmware/vpostgres/current/bin/psql -V
    • vCenter Database Password

      Run:
      cat /etc/vmware-vpx/vcdb.properties
      (This should return something like password = my-secret-password)

    • Self-managed Check – vCenter VM ID (only if the VC manages itself)

      Run:
      /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
      Then at the prompt:
      select id from VPX_ENTITY where name = '<VC VM Name>';
      (Replace <VC VM Name> with the actual name of the VCSA VM)

      Note the returned ID, for example 1017, to be used as vm-1017.
  1. Get a Clean vpxd.cfg File

Deploy a temporary vCenter Server of the same version and build as the broken VCSA.

From the temporary VCSA, copy the file /etc/vmware-vpx/vpxd.cfg to your local PC using WinSCP or any SCP tool.

  1. Edit the Clean vpxd.cfg File

Choose one of the following options:

Option A-Edit on your local PC:

Open the file using a text editor, and make the following changes:

      • Remove the line <key_EvaluationExpiryDate>.
      • Replace the <hostnameUrl> value with the correct FQDN of the affected vCenter.
      • In the <sso> section, ensure all <uri> entries point to the correct PSC FQDN (or VCSA FQDN if embedded).
      • Replace the machine ID value with the one collected earlier.
      • If PostgreSQL version is present in the config, confirm it matches the version you gathered. If not present, you can skip this step.
      • If the vCenter manages itself, add this line just before </registry>:
        <key_VCVmId>vm-XXXX</key_VCVmId> (replace XXXX with the ID from the database query)

Option B -Edit directly on the affected VCSA using vi:

    • Copy the clean file to /tmp/vpxd.cfg on the broken VCSA. Then run:
      vi /tmp/vpxd.cfg

Make the same changes listed above using vi.

  1. Replace the Current Config File

On the affected VCSA:

    • Backup the original file:
      Rename /etc/vmware-vpx/vpxd.cfg to vpxd.cfg.bak

    • Replace it with the updated version:

      Move your edited file to /etc/vmware-vpx/vpxd.cfg
  1. Update the Database Password

If vcdb.properties contains a password, run:

      • /sbin/vpxd -p

You’ll be prompted to enter the password twice. If the file was empty, skip this step.

  1. Restart All vCenter Services

Run the following commands:

        • service-control --start vmware-vpxd