My server is CentOS 7.1. After reboot the hostname is overwritten by the transient hostname (
/etc/hostnamecontains the correct value
hostnamectl --transient set-hostname my.desired.nameis working but only until next reboot
So, after reboot:
hostnamectl statusshows the correct static hostname but the wrong transient hostname (
hostname -fshows the wrong hostname.
/etc/sysconfig/network is overwritten “by anaconda” and has the line
HOSTNAME="mail". I tried to edit this file to configure the correct name but it's overwritten after reboot.
How can I prevent the transient hostname being set to
I already tried to add
DHCP_HOSTNAME="my.desired.name" to my /etc/sysconfig/network-scripts/ifcfg-e..... but with no success (line was removed after reboot).
And I tried to add execution of
hostnamectl set-hostname "" --transient (which will set the transient to the value of static hostname) at reboot which failed either with activated /etc/rc.local and also as a service with chkconfig on (with # chkconfig: - 11 91 so that it should run after all other services).
Any further suggestions are welcome.