Question

Can't apt-get update, "temporary failure resolving mirrors.digitalocean.com".

Hey, I’m using a newly rebuilt Debian 9 image and I can’t successfully execute apt-get update. I’ve seen several similar questions asked here, none helped me. I can ping to google.com or other websites, even mirrors.digitalocean.com; 8.8.8.8 is present in my /etc/resolv.conf, but still, right after having rebuilt the droplet, ssh-ed into it and changed the root password, the command doesn’t work.

Here’s the exact error message I get:

root@whatever:~# apt-get update
Err:1 http://mirrors.digitalocean.com/debian stretch InRelease
  Temporary failure resolving 'mirrors.digitalocean.com'
Err:2 http://mirrors.digitalocean.com/debian stretch/updates InRelease
  Temporary failure resolving 'mirrors.digitalocean.com'
Err:3 http://mirrors.digitalocean.com/debian stretch-updates InRelease
  Temporary failure resolving 'mirrors.digitalocean.com'
Reading package lists... Done
W: Failed to fetch http://mirrors.digitalocean.com/debian/dists/stretch/InRelease  Temporary failure resolving 'mirrors.digitalocean.com'
W: Failed to fetch http://mirrors.digitalocean.com/debian/dists/stretch/updates/InRelease  Temporary failure resolving 'mirrors.digitalocean.com'
W: Failed to fetch http://mirrors.digitalocean.com/debian/dists/stretch-updates/InRelease  Temporary failure resolving 'mirrors.digitalocean.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Seems that /etc/resolv.conf have wrong permissions

-rw-rw---- 1 root root 19 Jan 11 18:16 /etc/resolv.conf

this file must have +r for all users, execute following command to fix them:

chmod 644 /etc/resolv.conf

the result must be:

-rw-r--r-- 1 root root 19 Jan 11 18:16 /etc/resolv.conf

I just had this same problem and for me it was because I set up a firewall to limit all incoming & outgoing traffic to just my IP. Removing that firewall fixed the issue.

This comment has been deleted