While doing some work in trying ensure hostnames get set correctly on CoreOS I found that running hostnamectl set-hostname would destroy the file /etc/machine-info. In this case the hostname "host-10-0-0-7" is the hostname assigned via DHCP. The file /etc/machine-info was created by hand and the system was subsequently rebooted. [bharrington@leviathan-alticon-net coreos]$ ssh 192.168.1.202 Warning: Permanently added '192.168.1.202' (RSA) to the list of known hosts. Last login: Thu Mar 13 00:55:57 UTC 2014 from 192.168.1.63 on pts/1 ______ ____ _____ / ____/___ ________ / __ \/ ___/ / / / __ \/ ___/ _ \/ / / /\__ \ / /___/ /_/ / / / __/ /_/ /___/ / \____/\____/_/ \___/\____//____/ core@host-10-0-0-7 ~ $ core@host-10-0-0-7 ~ $ core@host-10-0-0-7 ~ $ core@host-10-0-0-7 ~ $ cat /etc/machine-info PRETTY_HOSTNAME=coreos-2.coreos.lab core@host-10-0-0-7 ~ $ sudo hostnamectl set-hostname coreos-1.coreos.lab core@host-10-0-0-7 ~ $ cat /etc/machine-info cat: /etc/machine-info: No such file or directory core@host-10-0-0-7 ~ $ hostname coreos-1.coreos.lab core@host-10-0-0-7 ~ $ cat /etc/hostname coreos-1.coreos.lab
"systemctl set-hostname" sets all three hostnames by default. If you want to set only the pretty, or only the transient, or only the static one use switches like --pretty, --transient, --static. You can even combine them... "systemctl set-hostname" will set all three names, then detect that there's no point in keeping the pretty name in place if it is char-for-char identical with the static one, and simply removes the file since there's nothing else in there. So, this is intended operation. And explained in the man page...
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.