How to change the hostname of a Proxmox node

Changing the host name of a Proxmox node is unfortunately a bit harder than changing the hostname of your typical Linux machine. This article will guide you through the process. Keep in mind that this only covers changing the host name for a standalone node, I don’t know if the process is different when the node is part of a cluster.

First change the host name like you would do on any Debian based machine.

hostnamectl set-hostname NEW-HOSTNAME

Update your hosts file with your favorite text editor.

vim /etc/hosts

Proxmox should momentarily create a new node with the new host name. You can see this here.

ls -la /etc/pve/nodes

There you will find a folder with the same name as your old host name and one with your new host name. If you can’t see the folder with your new host name you might have to wait a bit or you can restart the machine.

Now I like to take a backup of the current config files just in case:

cp -r /etc/pve/nodes/OLD-HOSTNAME /root/

Next you need to copy the configuration files for the old host name to the new one. I had some problems doing this, not sure why, so I copied mine from the backup which worked.

cp /root/OLD-HOSTNAME/qemu-server/* /etc/pve/nodes/NEW-HOSTNAME/qemu-server

Now reboot the machine.

reboot

This should be everything you have to do. I had one problem though, none of my VMs would boot. Yes that is a pretty big problem but it was because they couldn’t find my LVM-volume. The problem was in /etc/pve/storage.cfg:

lvmthin: data
        thinpool data
        vgname pve2
        content rootdir,images
        nodes OLD-HOSTNAME

I just had to nodes to the new host name and it worked.

3 Replies to “How to change the hostname of a Proxmox node”

  1. Hey there,

    What did you do to resolve the certificate issue? I’m getting

    /etc/pve/local/pve-ssl.key: failed to load local private key (key_file or key) at /usr/share/perl5/PVE/APIServer/AnyEvent.pm line 1687.

    This is after updating the hostname.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.