Fix Proxmox Error after hostname/ip change

When you change your hostname or ip on a proxmox host it can happend that you’re unable to access the ui. Journalctl will throw errors at you like this

/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 1899.

When you try to interact with the qm commands or update the certificates it will show the following

ipcc_send_rec[1] failed: Connection refused
ipcc_send_rec[2] failed: Connection refused
ipcc_send_rec[3] failed: Connection refused

To fix this make sure you changed your hostname with the command

hostnamectl set-hostname $YOURHOSTNAME

After this you need to change the hostname also at /etc/hosts. Make sure to set the hostname like the schema to new ip or hostname.

127.0.0.1 localhost.localdomain localhost
your.new.ip.address your.fully.qualified.domainname yourhostname

Now you need to replace the old hostname in the storage-config, othervise you’ll not be able to see/use the old pool.

vim /etc/pve/storage.cfg 

Keep the structure of the file, just replace the old hostname. You can do this like this in vim

:s/oldhostname/newhostname/g

or directly in the directory:

grep -rl "[oldhostname]" | xargs sed -i 's,[oldhostname],[newhostname],g'

After this you can restart all pve-daemons and the pools should be available

service pvedaemon restart
service pvestatd restart
service pveproxy restart

🖤 Did this article help you?
Buy me a coffee and support my work to keep this space 🚀 and ad-free. If you can’t, share my work to reach this 📖 out to more people.

Leave a reply

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