Changing the vCenter Server PNID fails/never completes and/or changing the VCSA hostname fails with "Unable to set hostname"
search cancel

Changing the vCenter Server PNID fails/never completes and/or changing the VCSA hostname fails with "Unable to set hostname"

book

Article ID: 395632

calendar_today

Updated On:

Products

VMware vCenter Server 8.0

Issue/Introduction

* Changing the vCenter Server Primary Network Identifier (PNID) on the vCenter VAMI GUI hangs and never completes.
Changing the vCenter Primary Network Identifier (PNID)

* When attempting to change the hostname manually with the vami_config_net untility, it also fails:

/opt/vmware/share/vami/vami_config_net

 Main Menu

0)      Show Current Configuration (scroll with Shift-PgUp/PgDown)
1)      Exit this program
2)      Default Gateway
3)      Hostname
4)      DNS
5)      Proxy Server
6)      IP Address Allocation for eth0
Enter a menu number [0]: 3

Warning: if any of the interfaces for this VM use DHCP,
the Hostname, DNS, and Gateway parameters will be
overwritten by information from the DHCP server.

Type Ctrl-C to go back to the Main Menu

New hostname [original-name.example.com]: new-name.example.com

== set_ipv4 ==
DEFULT_INT: eth0
DEFAULT_IPV4: ###.###.#.###
HN: new-name
DN: example.com
==============

== set_ipv6 ==
DEFULT_INT: eth0
DEFAULT_IPV6:
HN: new-name
DN: example.com
==============

Unable to set hostname to original-name.example.com, reverting to previous hostname: original-name.example.com
== set_ipv4 ==
DEFULT_INT: eth0
DEFAULT_IPV4: ###.###.#.###
HN: original-name
DN: dr.gslabs.local
==============

== set_ipv6 ==
DEFULT_INT: eth0
DEFAULT_IPV6:
HN: original-name
DN: example.com
==============

Host name has been set to original-name.example.com

 

 

* The PNID change log (/var/log/vmware/applmgmt/pnid_change.log), has entries similar to the following:

2025-04-28 13:48:18,603 - pnid_utils-update_network_config():1970 - INFO - Changing ipv4 config
2025-04-28 13:48:22,812 - pnid_utils-run_command():88 - INFO - Running command: /opt/vmware/share/vami/vami_set_hostname new-name.example.com
2025-04-28 13:48:23,194 - pnid_utils-run_command():106 - INFO - Command exited with exitcode : 1
2025-04-28 13:48:23,194 - pnid_utils-run_command():108 - WARNING - Command failed with following error:
2025-04-28 13:48:23,194 - pnid_utils-run_command():109 - WARNING - b''
2025-04-28 13:48:23,195 - pnid_utils-run_command():116 - INFO - Done running command
2025-04-28 13:48:23,195 - pnid_utils-update_network_config():1992 - ERROR -
2025-04-28 13:48:23,195 - pnid_utils-update_task_status():1677 - INFO - Task : Failed to update the hostname.


* The messages log (/var/log/vmware/messages), has entries similar to the following:

2025-04-28T13:48:22.965097+00:00 vcsa01 systemd-resolved[20547]: System hostname changed to 'new-name.example.com'.
2025-04-28T13:48:23.146519+00:00 vcsa01 systemd-resolved[20547]: System hostname changed to 'original-name.example.com'.
2025-04-28T13:48:23.163591+00:00 vcsa01 root: vami_set_hostname, line 247: Host name has been set to original-name.example.com


Environment

vCenter Server Appliance 7.0

vCenter Server Appliance 8.0

Cause

This can be caused by an invalid entry in the /etc/hosts file. 

For example:

cat /etc/hosts

###.###.#.##  original-name.example.com original-name  new-name.example.com new-name
# Begin /etc/hosts (network card version)

# VAMI_EDIT_BEGIN
# Generated by Studio VAMI service. Do not modify manually.
127.0.0.1   original-name.example.com original-name localhost
::1  original-name.example.com original-name localhost ipv6-localhost ipv6-loopback
# VAMI_EDIT_END

In the above example this line is causing the issue:
###.###.#.##  original-name.example.com original-name  new-name.example.com new-name

Resolution

* Revert the vCenter Server back to the snapshot/backup taken prior to the failed PNID change attempt.

* Review the /etc/hosts file for incorrect entries, incorrect permissions or file corruption. 

* Retry the PNID change.

Additional Information