Symptoms:
You have your Linux /etc/hosts configured correctly and after a reboot, the Cloud removes the line where your hostname was set. So the questions is how to permanently change the hostname of an Oracle Cloud Infrastructure (OCI) compute instance?
Cause:
If any aplication that looks for the physical hostname to start, an example is Weblogic, the start process will hang due to the missing entry on /etc/hosts
Solution:
As given on the MOS Doc ID 2325469.1, by design, changes made in the /etc/hosts and resolve.conf files revert to their original values, after an instance restart.
To stop reverting this changes, edit the oci configuration file for hostnames as given below to update the needed value to 2.
vi /etc/oci-hostname.conf
PRESERVE_HOSTINFO=2
Reboot the instance and check.