This seems to be an issue with Apache2 and possibly resolv.conf from what I've read around so far.

We have a PHP-based web API running on Ubuntu 14.04 LTS which in turn sometimes talks to another web API. This has been happily running along for over a year now - until yesterday.

Yesterday (Wednesday) morning, we started getting exceptions with the second connection - PHP is producing the error:

getaddrinfo "No address associated with hostname"

This is PHP's way of saying it cannot resolv the hostname through DNS.

I logged into the server and ran an nslookup for the domain being requested by the PHP script: it resolved.

I entered into PHP interactive mode and called dns_get_record() for the domain being requested by the PHP script: it resolved.

After casting about on the internet a bit, all I could find was an obscure post saying that someone else had the problem because Apache was loading before resolv.conf so it was fixed by restarting/reloading Apache. I reloaded the Apache service and everything was working fine.

We've just had the same problem this morning... reloading fixed the problem again.

Now - the server has been up for 23 days now. The Apache service was restarted on Sunday morning, probably after some automatic updates. The problem first presented Wednesday morning and repeated Thursday morning (this morning).

Why is Apache suddenly forgetting how to resolve this web service domain name that it has been using for a year?

  • Ubuntu 14.04.5 LTS
  • PHP 5.5.9-1ubuntu4.21
  • Apache/2.4.7

Sounds like you're experiencing USN-3239-2: GNU C Library Regression where an Ubuntu security update broke DNS lookups.

The problem can be corrected by updating your system to the following package version:

Ubuntu 16.04 LTS: libc6 2.23-0ubuntu7

Ubuntu 14.04 LTS: libc6 2.19-0ubuntu6.11

Ubuntu 12.04 LTS: libc6 2.15-0ubuntu10.17

To update your system, please follow these instructions: https://wiki.ubuntu.com/Security/Upgrades.

After a standard system update you need to reboot your computer to make all the necessary changes.

See also glibc update caused NSS ABI break on Launchpad.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.