Hostname is not constant

Hi,

I change the hostname to server.local, but one day later is the hostname server-2.local!
But in /etc/hostname and /etc/hosts is server.local! :thinking:

Have you tried hostnamectl yet?

Here’s a link with some examples - https://www.geeksforgeeks.org/hostnamectl-command-in-linux-with-examples/

My guess is that it would change the name to “hostname-2” when there already is another host with “hostname”.

Btw I was curious and tested hostnamectl and it doesn’t work at my system: Failed to connect to bus: No such file or directory.
So I installed dbus (first google search result recommended this :rofl: ) but it doesn’t work either. Now I stop fiddling around, I don’t want to break something.

sudo hostname should also work, but this will not be the solution to your problem, maybe.

Are we discussing about the hostname shown in the bash prompt? Or something else?

The hostname was new and unused. In the third attempt, it seems to have worked out now. :thinking: