Changing hostname and/or main IP after installing Proxmox

etron770

Well-Known Member
Feb 14, 2018
51
3
48
59
It seems to be a problem to change the hostname after installing Proxmox.
I did a fresh Debian bullseye installation added Proxmox
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
Proxmox was working, i canged the hostname and after reboot, there the ssh key were not accepted.
Looking what happend i saw:

The symlink authorized_keys -> /etc/pve/priv/authorized_keys was broken
the /etc/pve/ directory empty.

I have to install the new server moving the VMs to the new one with new IP and new Hostname
after that
have to put the server from the current rack to the rack of the old server to get the old IPS back.
In that case the old server is down and destroyed. Do I have a chance to manage this without braking the PVE system?
 
to get this right you have a new server which you want to have password less ssh access to another server with proxmox on it ?

and after that you want a server wich can be failover for your current one ?
 
I will have two server completely installed with proxmox all vms and ssh
The old one and the new one (like a mirror)
The new server must replace the old server completely including the physical rack
Therefore the new server will change the IPs in that moment when it will move to the original postion of the old one in the rack
The hostname of the new server need not change, i can do this with changing the DNS (if hostname change is a problem)
 
if you want to have a complete mirror of the server copy'ing disks so on and so forth sure you can do that, but if one of the servers are just as a 'reserve' not connected or anything why dont have the same ip and hostname configuration as the otherone then its just plug and play, whenever the old one fails.

also did you consider a HA Failover Cluster ? having both machines running at the same time, both of the servers being able to have the same VM's, and as soon as one of them fails (hopefully the old one) then the new one would spin up then vm's and run them. also i know space could be limited hence choosing the mirror* solution.

maybe do a fresh install if your missing all of your files in /etc/pve/?
 
The old server is partially broken - i must remvove it.
The question is why are the files in /etc/pve lost after changing the hostname
An why is the system unstable after changing the hostname at the console ?
 
well i never ran into any problems changing the hostname, did you do anything else before the reboot that could've caused this issue ?

is everything in the folder gone ? there is'nt a folder called /etc/pve/[oldhostname]/priv ? i dont know what caused your problem if everthing just got deleted after changing the hostname ?
 
I will try it again, the server is empty - an will report here
Teh folder was complete empty ...
 
I did a complete new installation with debian bullseye and proxmox
/etc/apt/sources.list.d/pve-install-repo.list
with
Code:
deb [arch=amd64] http://download.proxmox.com/debian/pve bullseye pve-no-subscription

and the issue of apt update:
Code:
E: Failed to fetch https://enterprise.proxmox.com/debian/pve/dists/bullseye/InRelease  401  Unauthorized [IP: 2a01:7e0:0:424::249 443]
E: The repository 'https://enterprise.proxmox.com/debian/pve bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
is that there is an file installed with
Code:
/etc/apt/sources.list.d/pve-enterprise.list
looking to the timestamps it was installed during the installation ob Proxmox
So the headline of the tread might be wrong - is there a old tread matching this issue?
 
The pve-no-subscription was working during the installtion.
The enterprice sourse list was installed with the installtion of the pve-non subsription system

It is working with deleting the enterprise source list.
and - it is only a root user available

So it is not a changing hostname problem
 
  • Like
Reactions: D0K
it seems that there is any kind of bug ind the bullseye pve-non subsription installtation.
the installation added a /etc/apt/sources.list.d/pve-enterprise.list file.
After that an apt update ist throwing an error [...] https://enterprise.proxmox.com/debian/pve/dists/bullseye/InRelease 401 Unauthorized [IP: xxxx:yyyy:zzzz::249 443]
The /etc/pve directory is still there after doing an apt update. Commenting the link at this file is solving this error.

I do not know at what stage the complete /etc/pve/ directory is has been deleted (happened twice after installing pve) before changing the hostname after installing (this happend once) or even later but I do not know at what stage I changed the hostname the second time.
The worsest thing is that PVE is moving the moving the /root/.ssh/ authorized_keys to /etc/pve/priv/authorized_keys
and the server was in an inaccessible stage after rebooting with deleted /etc/pve because PVE did not move the authorized_keys back.
The server was only accessible with a rescue-console
 
  • I moved the server to the new rack with another IP
  • started the server with the old /etc/hosts
  • Proxmox was starting the vms
  • The proxmox interface was not accessible
  • restating the server does not change anythin at this state
  • as I did the experienxe of the deleted /etc/pve/ directory i did a rsync to another HD
  • Changed the /etc/hosts to the new entries
  • Proxmox deleted the /etc/pve direcktory, after moving the server into another rack with another IP.
  • the server was unaccessable because the symlink /root/.ssh/authorized_keys -> /etc/pve/priv/authorized_keys was broken
  • what a big fault of PVE
  • an Rsync bakc of the /etc/pve directory brings the ssh login back but the PVE system in an unstable state

Code:
pct list
ipcc_send_rec[1] failed: Connection refused
ipcc_send_rec[2] failed: Connection refused
ipcc_send_rec[3] failed: Connection refused
Unable to load access control list: Connection refused

What can I do to get the system working
 
Perhaps someone from Proxmox can provide confirmation that this is correct.

Changing the host name is causing some problems.
I would not recommend to change the host name, especially when VMs are added.
Changing the host name needs to change some parts of the file structure where the hostname is used f.e
/etc/pve/nodes/[hostname]/priv
There are some treads available where user (me too) can read that the directory /etc/pve/ is empty. Looking to the system log will show that there is really a problem.
Code:
/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 1917.
There are some hints to restore a backup of the files of /etc/pve/, but this are wrong recommendations, because /etc/pve is a mounting point for Proxmox.

Back to the proxmox developer team. I my opinon it is a bug to move the /root/.ssh/authorized_keys to somewhere in the Proxmox system and providing the keys only after starting Proxmoc correctly.
Changing the hostname is a common thing and nobody would think that this could cause a system with broken ssh access, because the data of /etc/pve/ are not mounted.
Solutions:
  • leave authorized_keys where it is normally located and save a copy in proxmox for comparison. ( I would prefer that )
  • manage changing the hostname automatically
Alternative Solution
  • Start Proxmox with stored data of the old hostname an throw an error at the user interface, that it is impossible to change the hotsname, but keep the system working
But leaving a system that makes ssh access impossible is out of the question.
If you don't have a rescue console or don't know how to use it, you no longer have access to your server.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!