cloud-init manage-resolv-conf not working as expected

Asked by Jay Rosenthal on 2013-08-14

New to using cloud-init with OpenStack so please be patient and kind ;-)

I am having trouble getting manage-resolv-conf to work from my cloud-config file. The target instance has Ubuntu 12-04 as the OS. I do not see the nameservers (and other setting) being set in the /etc/resolv.conf file, nor do I see the comments that cloud-init puts in there indicating is it managed by cloud-init.

My cloud-config looks like this:


manage_resolv_conf: true
manage-resolv-conf: True

manage_etc_hosts: true

# Automatically configure resolv.conf when the instance boots for the first time.
  nameservers: ['','', '','']
  - novalocal
  domain: novalocal
    rotate: true
    timeout: 1

fqdn: Test19.novalocal

Question #1 - What is the correct syntax of manage-resolv-conf: ? Is it with "-" or "_" ? I believe it is "-" , but I have seen examples using both. I have tried it both ways but still no success.

Question #2 - I read somewhere that this may only supported on RedHat distributions. Is that correct ?

If question #2 is false, then why else might this not be working ?

Any suggestions, help or guidance would be appreciated.

Jay R.

Question information

English Edit question
Ubuntu cloud-init Edit question
No assignee Edit question
Last query:
Last reply:


echo "nameserver" | sudo tee -a /etc/resolvconf/resolv.conf.d/head

Will set that nameserver at each boot

Jay Rosenthal (jay-rosenthal) said : #2

Thanks for the reply..
Are you suggesting I put that as part of the "runcmd:" section of cloud-config ?

I can give this a try as a workaround, but it really doesn't answer my questions :-)

I've been seeing lots of people struggling with resolvconf behaviors in Ubuntu 12-04

Édouard Thuleau (ethuleau) said : #3


I also try to manage resolv.conf file with cloud-init.
I use that cloud-init user data:


manage-resolv-conf: false

  nameservers: ['', '']
    rotate: true
    timeout: 1

But it fails. I made that test on UEC Ubuntu 13.10 image with cloud-init version 0.7.3

I reopen that question because the actionparsnip does not aswert to it.
I use that type of workaround but it is not the solution:


  - [ sh, -xc, "DEBIAN_FRONTEND=noninteractive apt-get remove -y resolvconf" ]
  - [ sh, -xc, "sed -i 's/domain-name-servers, domain-search, //' /etc/dhcp/dhclient.conf" ]
  - [ sh, -xc, "service networking restart" ]
  - [ sh, -xc, "sed -i '/nameserver/d' /etc/resolv.conf" ]
  - [ sh, -xc, "echo 'nameserver' >> /etc/resolv.conf" ]
  - [ sh, -xc, "echo 'nameserver' >> /etc/resolv.conf" ]

Édouard Thuleau (ethuleau) said : #4

In fact, i cannot reopen the question because I'm not the owner.
Jay could you reopen it?

Édouard Thuleau (ethuleau) said : #5

I also try to set 'manage-resolv-conf' to true and it's the same.
resolv/conf file is not updated accordingly to the user data and I cannot see any error in the cloud-init logs.

It was never closed. The only person who can close the question is the asker. I marked the question as answered as I did in fact give an answer. The question is done when it is marled as 'solved'. This, again, can only be done by the asker. That person is not me.

Édouard Thuleau (ethuleau) said : #7

Ha ok, I thought 'answwer' was the last question status.
I did not know the 'solved' status.
Sorry actionparsnip.

Claude Durocher (claude-d) said : #8

In cloud-init user data use :

manage_etc_hosts: true
fqdn: guestname.domain

Mark Horstman (mah042) said : #9

manage-resolve-conf: true is incorrect. If you look at the source, it's expecting:
manage_resolve_conf: true

see ~line 97:

The example at is wrong.

Loic Dachary (dachary) said : #10

Even with manage_resolve_conf: true it does not work, most probably because cloud.cfg does not activate resolv_conf by default on Ubuntu 14.04

Mike Henry (mike-henry) said : #11

Confirmed that resolv_conf is not activated in cloud.cfg on Ubuntu 16.04 LTS either.

Why is this module not active by default in Ubuntu?

Can you help with this problem?

Provide an answer of your own, or ask Jay Rosenthal for more information if necessary.

To post a message you must log in.