Cant acces to webGUI after trying to change the node/hostname name

Datex

New Member
Sep 22, 2024
3
0
1
Hey guys. Im having an issue that after i tried to change the node/hostname name i can no longer acces the webGUI. I did it using this tutorial video. after the system reboot i found out foulder /etc/pve/nodes didnt exist, it was just deleted. luckily i still had backup of the original /etc/pve/nodes/<old-node-name>. So i created dir /etc/pve/nodes than copy the backup to /etc/pve/nodes than i renamed it to the new node name. In the end it looked like this /etc/pve/nodes/<new-node-name> with the original files. but even with the old node dir i couldnt acces the web gui. I would really appreciate for every suggestion i get.
 
I've tested this here. Simply rename the node under /etc/hostname and /etc/hosts. After a reboot you have 2 nodes under /etc/pve/nodes/. The oldnamed and the newnamed. Now move all the files from old to new. Example: change nodename/hostname pve to pve1: (the directory can't be moved)

Code:
cd /etc/pve/nodes/pve1
mv  ../pve/* .

mv: cannot move '../pve/qemu-server' to './qemu-server': Directory not empty
LXC and qemu-server cannot be moved, therefore only the contents:

Code:
mv ../pve/qemu-server/* qemu-server/.
After you moved everything, you can delete the old node with:

Code:
rm -rf /etc/pve/nodes/pve
 
Just chiming in (I am running 9.2).

1) The steps above did bring back a smidge of the WebGUI, but that did not fix the problem.

2) Fortunately, I did back up /etc/pve/nodes/oldname and /etc/pve/newname but was unable to revert from newname to oldname either.

Seems like everything under /etc/pve is coming from an sql database (fuse type filesystem) so hacking it may not be the best idea.

3) Do not change the hostname. Looks like I will have to reinstall everything.
 
Last edited:
Bash:
#!/bin/bash
change_hostname() {
    local original_hostname=$(hostname)
    read -p "Enter new hostname: " new_hostname

    mkdir -p /tmp/qemu
    cp /etc/pve/nodes/$original_hostname/qemu-server/* /tmp/qemu/

    hostnamectl set-hostname "$new_hostname"

    sed -i "s/$original_hostname/$new_hostname/g" /etc/hosts

    services=("pveproxy.service" "pvebanner.service" "pve-cluster.service" "pvestatd.service" "pvedaemon.service")

    for service in "${services[@]}"
    do
        systemctl restart "$service"
    done

    rm -rf "/etc/pve/nodes/$original_hostname"
    cp /tmp/qemu/* /etc/pve/nodes/$new_hostname/qemu-server/
}
change_hostname