dwilkin
By:
dwilkin

How to fix the March 2017 Ubuntu DNS resolution issues

March 22, 2017 15.9k views
DNS PHP Email FAQ Miscellaneous WordPress Networking Ubuntu

As of March 20th, many Ubuntu users across the web were suddenly having DNS resolution issues pop up in their applications due to a bad update pushed out by Canonical (the maintainers of Ubuntu) which breaks DNS resolution after a few hours of uptime. Here's the bug report where the issue was reported and triaged:

https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1674532

This may have resulted in failures of your CMS to update/install plugins/install themes, failures to connect to external APIs, and/or error messages similar to the following:

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname
Could not resolve host: downloads.wordpress.org
cURL error 6: Could not resolve host: example.com in....

Fortunately Canonical has since been able to resolve the issue, but affected systems must update to acquire the fix. To do that, you'll need DNS working, so if it's currently down please first reboot your Droplet. Once DNS resolution is working as normal, please run:

sudo apt-get update
sudo apt-get upgrade

Then you can check your versions to ensure you've got the right ones. This can be done with:

sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'

If you're on Ubuntu 16.X, you should see output similar to the following:

# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.23-0ubuntu7
2.23-0ubuntu7
2.23-0ubuntu7

If you're on Ubuntu 14.X, you should see output similar to the following:

# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.19-0ubuntu6.11
2.19-0ubuntu6.11

If you're on Ubuntu 12.X, you should see output similar to the following:

# sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.15-0ubuntu10.17
2.15-0ubuntu10.17

If you see older versions of those packages, you'll need to upgrade per the previous instructions to avoid this issue.

If you have further questions, please don't hesitate to comment below or open a ticket! We're happy to help :)

Regards,
Darian
Platform Support Advocate

9 Answers

I am having some trouble still. DNS works but is extremely slow (~1min), I was able to sudo apt-get update and sudo apt-get upgrade and confirmed right version -- but still having dns issues even after reboot (pinging any url fails, but pinging ip's works fine)

  • Hey there! Are you by chance in the NYC or SFO region? This could be due to a different problem with Google's DNS, particularly if your IP address starts with 192.241. To resolve that problem, please try replacing the contents of /etc/resolv.conf with:

    nameserver 208.67.222.222
    nameserver 208.67.220.220

    Then saving that file. That should get you around the Google DNS problems until they're resolved.

    • This was definitely the case for us. Updating all packages didn't fix the issue but switching to OpenDNS seems to be working a bit better. We're still seeing some slow resolution times (~10 seconds to resolve an address) but no failures now. Would be curious to know if the Google DNS thing is widespread. We have quite a few servers in NYC.

    • Turns out editing /etc/resolvconf/resolv.conf.d/base didn't apply on our server (this was a WordPress Ubuntu image). That file was empty and adding OpenDNS to it just put 1 of the IPs below the two Google nameservers in /etc/resolv.conf. We had to edit /etc/network/interfaces.d/50-cloud-init.cfg and change the nameserver IPs there, then service networking restart and resolveconf -u and now we're only using OpenDNS and things are loading much faster.

      • Thanks so much for the update, and you're right! I've edited the response to reflect a more temporary change that will avoid any permanent changes for those users affected by this problem.

    • Worked for me even without executing apt-get update/upgrade.

      I'm running Wordpress on Ubuntu 12.04.5 and noticed my dashboard became almost completely unresponsive since yesterday. Some plugins returned cURL error 6: Couldn’t resolve host.

      BTW, no reboot is required after editing /etc/resolv.conf, you just save it.

    • Thanks, solved my problem in NYC2 region

Thank you, I hope this has solved my issue. We have been having intermittent issues connecting to the aws api as of 21st March receiving the 'cURL error 6: Could not resolve host: example.com' error message.

  • That's great to hear Adam! Please don't hesitate to share so others don't have to struggle through this! :)

Did the update, but still seeing the issue, do we need to reset anything after the update? :)

phpnetworkgetaddresses: getaddrinfo failed: No address associated with hostname (0)

  • Could you share the output of:

    sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
    

    You may want to try rebooting as well, just to ensure all the affected services have restarted.

This worked to get plugin updates and the dashboard news feeds working again on my WordPress site. Thank you!

I performed the procedure, but the problem is still occurring.

CURL error 28: Resolving timed out after 10521 milliseconds

My droplet is on the NYC1 server running a WordPress 4.7 on 16.04 image.

  • It's possible you're being affected by another distinct issue with Google's DNS that just popped up in the last 48 hours; particularly if your IP address starts with 192.241. To resolve that problem, please try replacing the contents of /etc/resolv.conf with:

    nameserver 208.67.222.222
    nameserver 208.67.220.220

    Then saving that file. That should get you around the Google DNS problems until they're resolved.

I spent 2 entire days working on this issue and fixed it in less than 2 minutes once I'd found this article. I was such a pain in the ass to figure out what was happening. Eventually I did realize that something was messed up with DNS but I spent 6 hours trying to find a problem with the UFW that didn't exist. So stressful...

  • I'm sorry to hear that! If you are a DO customer, please don't hesitate to reach out to us when something like that happens, we're happy to help!

    • I am, I believed it was something I had done because I was testing wordfence then I also had whitelisted a ton of IPs for cloudflare, MAXCDN, and ManageWP and disabled 80 and 443 to my hosts. I then had thought I somehow broke the UFW because I could never get back to a stable place after those changes. Even though I had removed them afterwards.
      At this point, all my UFW are working right with only 22 only and big list of whitelisted IP addresses.

I had to edit the /etc/resolve.conf file to add name servers as recommended above.

That gave me the opportunity to upgrade Ubuntu. As suggested above, I am seeing the proper results.

sudo dpkg -l | grep "GNU C Library" | awk '{print $3}'
2.23-0ubuntu7
2.23-0ubuntu7
2.23-0ubuntu7
2.23-0ubuntu7
2.23-0ubuntu7

Unfortunately, after a few hours the problem returns. Is there a fix for this situation?

  • Sometimes applications will be holding an old version of the libraries and won't let go of them until that application is restarted. As it's tough to tell which ones are still using it, the easiest way is to just reboot. Could you try that and let me know if the problem comes back?

    • The problem has returned. /etc/resolve.conf is now empty. Changes to it no longer solve the issue.

I didn't realise that automatic updates were on that could break my server like this. How do I turn these updates off for 16.04??

Have another answer? Share your knowledge.