SDDC Manager UI fails with error '502 Bad Gateway' due to missing loopback mapping.
search cancel

SDDC Manager UI fails with error '502 Bad Gateway' due to missing loopback mapping.

book

Article ID: 417256

calendar_today

Updated On:

Products

VMware SDDC Manager / VCF Installer

Issue/Introduction

  • The SDDC Manager UI is inaccessible and returns an HTTP 502 Bad Gateway error.

  • Operations manager, Domain manager, commonsvcs logs might not get generated and nginx might fail to start.
  • The postgres service on the SDDC Manager appliance fails to start and the status of postgres service shows "could not translate host name 'localhost'":
     # systemctl status postgres
    * postgres.service - Postgres
         Loaded: loaded (/etc/systemd/system/postgres.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Day YYYY-MM-DD HH:MM:SS UTC;
        Process: 910 ExecStartPre=/usr/bin/sh -c /opt/vmware/vcf/commonsvcs/scripts/postgres/postgres-upgrade.sh /usr/pgsql/15/bin/ 15 (code=exited, status=0/SUCCESS)
        Process: 920 ExecStart=/usr/pgsql/15/bin/pg_ctl start -D ${PGDATA} -s -w -t 270 (code=exited, status=1/FAILURE)
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[940]: YYYY-MM-DD HH:MM:SS UTC [940] LOG:  starting PostgreSQL 15.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.5.0, 64-bit
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[940]: YYYY-MM-DD HH:MM:SS UTC [940] LOG:  could not translate host name "localhost", service "5432" to address: Temporary failure in name resolution
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[940]: YYYY-MM-DD HH:MM:SS UTC [940] WARNING:  could not create listen socket for "localhost"
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[940]: YYYY-MM-DD HH:MM:SS UTC [940] FATAL:  could not create any TCP/IP sockets
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[940]: YYYY-MM-DD HH:MM:SS UTC [940] LOG:  database system is shut down
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[920]: pg_ctl: could not start server
    MM DD HH:MM:SS <sddc_manager_fqdn> pg_ctl[920]: Examine the log output.
    MM DD HH:MM:SS <sddc_manager_fqdn> systemd[1]: postgres.service: Control process exited, code=exited, status=1/FAILURE
    MM DD HH:MM:SS <sddc_manager_fqdn> systemd[1]: postgres.service: Failed with result 'exit-code'.
    MM DD HH:MM:SS <sddc_manager_fqdn> systemd[1]: Failed to start Postgres.
  • The loopback address resolution in the "/etc/hosts" file is commented out or the hosts file is blank.
    # Begin /etc/hosts (network card version)
    
    # End /etc/hosts (network card version)
    # VAMI EDIT BEGIN
    # Generated by Studio VAMI service. Do not modify manually.
    # 127.0.0.1 <sddc_manager_fqdn> <sddc_manager_hostname> localhost
    # :: 1 <sddc_manager_fqdn> <sddc_manager_hostname> localhost ipv6-localhost ipv6-loopback
    # VAMI EDIT END

 

Environment

  • VCF 5.x
  • VCF 9.x

Cause

The /etc/hosts file on the SDDC Manager appliance is missing the loopback address mapping or the entry is commented out. PostgreSQL requires localhost resolution to bind its internal communication sockets. Without this, the database service fails, causing a 502 error at the NGINX proxy layer.

Resolution

  1. Log in to the SDDC Manager appliance as root via SSH.
  2. Create a backup of the current hosts file: cp /etc/hosts /etc/hosts.backup
  3. Edit the /etc/hosts file: vi /etc/hosts
  4. Ensure the loopback entries match the below exactly:
    #Begin /etc/hosts (network card version)
    127.0.0.1 localhost.localdomain
    127.0.0.1 localhost
    127.0.0.1 photon
    #End /etc/hosts (network card version)
  5.  Save the file using 'Esc + :wq!' and press Enter to exit vi editor.
  6. Verify the changes: cat /etc/hosts
  7. Restart SDDC Manager Appliance.

Additional Information

 For further assistance, see Contact Broadcom Support. To track updates on this issue, subscribe to this article.