Q. When setting a hostname in Ubuntu 18 (using traditional methods: /etc/hostname and hostnamectl), it reverts back after reboot.
A.The setting is being reset by the service: cloud-init. This service has to be either disabled or a value set to bypass the hostname reset:
Edit /etc/cloud/cloud.cfg and set the following to true: