System has configured 'manage_etc_hosts' as True

Posted April 8, 2015 26.7k views
ApacheDNSConfiguration Management


I had created an Ubuntu 14.04 x64 droplet. I have a warning message in top of my /etc/hosts file.

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data

before that in my other droplets when I want to set a sub-domain first I create the ‘a records’ in digital ocean panel then config my web server virtual hosts and then set up my domain details in /etc/hosts file. now I don’t change /etc/hosts but everything is ok and my virtual hosts work successfully.
I try to find manage_etc_hosts option for changing it but I didn’t find it.
let me now if it’s bad problem or no ? if yes how can I fix it ?

tnx a lot.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
7 answers

Those comments can be safely ignored. They are an artifact of how networking is initially set up on the first boot using Cloud-Init. After first boot, you should be able to manage /etc/hosts as you would normally expect.

I was able to fix mine by editing /etc/cloud/templates/hosts.debian.tmpl with the host info.

I’m starting to see this on new Ubuntu droplets, and find it VERY confusing. Is this something that DigitalOcean recently implemented? And if so, why would they leave that message in there if it’s just an artifact and is not accurate? It’s stuff like this that takes the fun out of server management.

Confirmed: It does appear to be an artifact. Rebooting the server does not cause edits to be lost.

I added manage_etc_hosts: false in /etc/cloud/cloud.cfg
…no help.

I “solved” (note quotes) this also as @Yeaoh did via /etc/cloud/templates/hosts.debian.tmpl
…that’s not how it’s supposed to be “solved”.
…and that’s not what the error message in the same file itself says = =.

Please bump this issue. much love

edited by asb
  • Hi Jessesteele

    How did you exactly solved it?

    I added the hostname to /etc/cloud/templates/hosts.debian.tmpl and the options in /etc/cloud/cloud.cfg I got:

    preserve_hostname: True

    No luck so far, hostname does not survive reboot

    edited by asb
    • I have:
      /etc/cloud/cloud.cfg :
      manage_etc_hosts: false
      preserve_hostname: false
      and this works: /etc/cloud/templates/hosts.debian.tmpl

      My thoughts

      1. It works probably because cloud.cfg does not seem to be managing Debian, at least this week. Remember, Ubuntu is a mod of mods build on a mod of a science project. Debian is a lower layer in that stack of waffles.
      2. From where I sit and how I know the cow chews the cud and the world spins among spinning worlds, it seems that the problem exists in that “zone” where the DigitalOcean servers are interacting with settings in the droplets at their creations and resurrections. As I have grown to the geriatric 30 some years old, I’ve learned not to fix other people’s problems because when they finally fix their problems, your fix breaks their fix and you have to unfix it so it will fix again.
      3. Scientific method…
      • Is this happening with new 16.04 droplets, WebApp droplets build on 16.04 (i.e. possibly a LAMP or WordPress)?
      • Or, is this only happening on droplets that you restored from a snapshot?
      • Let DigitalOcean know. Start a ticket if you haven’t already. I did.

      As I understand, DigitalOcean is aware of a problem of /etc/hosts files being overwritten. Help them out. Be their eyes and ears.

      Love to you.

Set manage_etc_hosts to false in /etc/cloud/cloud.cfg.d/01_debian_cloud.cfg and that should fix it. I’m assuming that the file naming is same as Debian; in case not, then do:

grep -ir manage_etc_hosts /etc/cloud/

You should find the correct file name to edit. ;-)

This appears NOT to be an artifact. I have Debian installed and when I change the /etc/hosts, it change back after reboot, again and again. I’ve followed the instructions by adding the host to /etc/cloud/templates/hosts.tmpl but doesn’t seems to have any effect either

To solve this add the line below at the bottom of file (or wherever you want):

manage_etc_hosts: False

cloud.cfg is case-sensitive

If you use a bash script to provision your droplet add this:

echo 'manage_etc_hosts: False' | tee --append /etc/cloud/cloud.cfg

then, update your /etc/hosts