My server is CentOS 7.1. After reboot the hostname is overwritten by the transient hostname (mail) and I can't find a way to avoid that. Maybe AutoDNS and the MX record mail causes that?
/etc/hostnamecontains the correct valuehostnamectl --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 (mail).hostname -sorhostname -fshows the wrong hostname.
The file /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 mail after restarting?
EDIT:
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.
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.