Why the system Ubuntu 14.04 is configured 'manage_etc_hosts' as True by default?

October 9, 2014 8.1k views

I had created a droplet before with an image of Ubuntu 14.04 x64 but now that I create one appears this message when I see the file /etc/hosts

# 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

I didn't set any configuration and I checked that in the older droplet that I have those files don't exists.
Does the image changed? is there another change in it?

1 comment
4 Answers

There was recently a change to the way that the initial configuration of new droplets is done. cloud-init is now used to do things like set the hostname and add SSH keys. This is the first step to allowing users to provide first boot configuration details using cloud-config files or scripts via "user-data.".

After first boot, you should be able to manage /etc/hosts as you would normally. I just tested making direct changes to the file, and it persisted following a reboot. cloud-init itself seems to be creating this misleading warning. I'm going to bring this up with our engineering team to investigate.

  • Please resolve, there shouldn't be scary crufty messages like this in common config files.

  • Any update on this?

  • I, too, would love to know if it's safe to rely on /etc/hosts direct changes; I see the big scary warning at the top but don't have any file at /etc/cloud/templates/hosts.tmpl that I could update. (There are a few platform-specific files there, like hosts.debian.tmpl, but nothing at hosts.tmpl itself.)

  • Hello,

    If you do not have a /etc/cloud/templates/hosts.tmpl file, you can disable the cloud-init functionality to make changes to your /etc/hosts by changing the manage_etc_hosts parameter in either of these files, depending on your distribution:


    You'll use the redhat file for CentOS and debian for Debian and Ubuntu droplets.

    cloud-init should only run on the initial boot, but will likely not be able to remove the message once the build is complete (which is why the message persists); you can likely remove that text from the hosts file without issue as well.

    • Note that the template file will be used if you're restoring from a snapshot.

Hello All,

In my experience you must either be logged in as ROOT. Login to the console provided by DigitalOcean and you will be allowed to edit all those files with that message.

Not sure why it does this though. I have restricted SSH setup and I am using an added user maybe that is the issue.

Hi, I am having trouble with this problem. It doesn't seem that my /etc/hosts file is working. I tried the above instructions with no changes. Can anyone offer any other instruction? Appreciate the help.

I'm glad I found this as well. It would be great to fix this soon.

I was surprised to see this message in /etc/hosts and I didn't think I could change my hostname until I found this message.

Have another answer? Share your knowledge.