cloud-init manage-resolv-conf not working as expected
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:
#cloud-config
manage_resolv_conf: true
manage-resolv-conf: True
manage_etc_hosts: true
# Automatically configure resolv.conf when the instance boots for the first time.
resolv_conf:
nameservers: ['10.0.
searchdomains:
- novalocal
domain: novalocal
options:
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
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- 2013-08-14
- Last reply:
- 2014-09-14
Try:
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolvconf
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 |
Hi,
I also try to manage resolv.conf file with cloud-init.
I use that cloud-init user data:
#cloud-config
manage-resolv-conf: false
resolv_conf:
nameservers: ['8.8.4.4', '8.8.8.8']
options:
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:
#cloud-config
runcmd:
- [ sh, -xc, "DEBIAN_
- [ sh, -xc, "sed -i 's/domain-
- [ sh, -xc, "service networking restart" ]
- [ sh, -xc, "sed -i '/nameserver/d' /etc/resolv.conf" ]
- [ sh, -xc, "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf" ]
- [ sh, -xc, "echo 'nameserver 8.8.4.4' >> /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 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-
manage_
see ~line 97: http://
The example at http://
| Loic Dachary (dachary) said : | #10 |
Even with manage_
| 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.

