Hostname and OpenVZ


Depending on reboot method, this file can be re-updated not properly by virtualization system :

Work around is to lock this file from being changed by anything once value is correct, example :

To lock it :
chattr +i /etc/hostname

To unlock it, do :
chattr -i /etc/hostname

Same for /etc/hosts and /etc/resolv.conf f you use custom entries you want to keep at each reboot

Install utility to proceed :
apt-get install e2fsprogs
yum -y install e2fsprogs