If you specified an incorrect hostname when you installed the Proxmox VE node, you can change it.
On a standalone Proxmox host where no virtual machines or containers have yet been created, it is sufficient to change the hostname in three files:
# nano /etc/hosts
This file contains the Proxmox node’s IP address, full and short hostname.
Similarly, replace the old hostname with the new one in the following files:
# nano /etc/hostname
# nano /etc/postfix/main.cf
Reboot the Proxmox host.
Proxmox services may not start if you have misspelled the hostname in the configuration files or missed something.
To get the detailed info about Proxmox startup errors, run
# journalctl -xeu pve-cluster.service
In my case, I forgot to change the short name in the hosts file. That is why the error appeared:
solve node name 'pve2' to a non-loopback IP address - missing entry in '/etc/hosts' or DNS?
If VMs or containers have already been created on the Proxmox host, there are a number of additional steps to take. Hostname is used for the following directory paths:
/var/lib/rrdcached/db/pve2-storage/[OLD-HOSTNAME]
/var/lib/rrdcached/db/pve2-node/[OLD-HOSTNAME]
/etc/pve/nodes/[OLD-HOSTNAME]
Create directories with the new hostname:
# mkdir /var/lib/rrdcached/db/pve2-node/<new-name>
# mkdir /var/lib/rrdcached/db/pve2-storage/<new-name>
# mkdir -p /etc/pve/nodes/<new-name>/qemu-server
Copy the configuration files to new directories:
#cp -p /var/lib/rrdcached/db/pve2-node/<old-name>/* /var/lib/rrdcached/db/pve2-node/<new-name>
# cp -p /var/lib/rrdcached/db/pve2-storage/<old-name>/* /var/lib/rrdcached/db/pve2-storage/<new-name>
# mv /etc/pve/nodes/<old-name>/qemu-server/* /etc/pve/nodes/<new-name>/qemu-server
Remove the source directories.
When a Proxmox host is added to a cluster, it is not a good idea to rename the host while it is under load. It would be better to move the workloads from the host to other nodes and remove it from the cluster. Then, change the hostname as described above and rejoin the host to the cluster.
If this is not possible, try renaming the Proxmox node in the cluster.
- Update name in files /etc/hosts and /etc/hostname
- Stop the cluster service and start the pmxcfs cluster filesystem in local mode:
# systemctl stop pve-cluster # systemctl stop corosync # pmxcfs -l
- Backup the corosync.conf file:
# cp /etc/pve/corosync.conf /etc/pve/corosync.conf_bak
- Change the hostname in the file /etc/pve/corosync.conf
Increase the value of the config_version parameter by 1 - Restart the cluster:
# killall pmxcfs # systemctl start pve-cluster