Unable to resolve server for apt-get

April 15, 2015 1.2k views
DNS DigitalOcean

When trying to update or install a package from apt-get i get.
Err http://security.ubuntu.com trusty-security Release.gpg
Could not resolve 'security.ubuntu.com'
Err http://mirrors.digitalocean.com trusty Release.gpg
Could not resolve 'mirrors.digitalocean.com'

When i use dig it says there are no errors but it seems to ignore the first 2 nameservers (which I'm guessing are digitaloceans?) listed in /etc/resolv.conf and default to google dns. However ping says unknown host . I have had this sort of thing happen before when raspibian changed their repository servers.

; <<>> DiG 9.9.5-3ubuntu0.2-Ubuntu <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47974
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 512
;. IN NS

. 19376 IN NS b.root-servers.net.
. 19376 IN NS a.root-servers.net.
. 19376 IN NS g.root-servers.net.
. 19376 IN NS f.root-servers.net.
. 19376 IN NS j.root-servers.net.
. 19376 IN NS e.root-servers.net.
. 19376 IN NS l.root-servers.net.
. 19376 IN NS m.root-servers.net.
. 19376 IN NS h.root-servers.net.
. 19376 IN NS i.root-servers.net.
. 19376 IN NS c.root-servers.net.
. 19376 IN NS k.root-servers.net.
. 19376 IN NS d.root-servers.net.

;; Query time: 9 msec
;; WHEN: Wed Apr 15 19:08:30 EDT 2015
;; MSG SIZE rcvd: 239

1 Answer

It seems that when i created the server i enabled ipv6 and apt-get only seems to be able to use ipv6 even tho it has ipv4 dns servers listed I guess apt-get doesn't just have domain names it has ip addresses too? When i disabled ipv6 in /etcd/efualt/ufw it stopped working and after enabling it i can update again.

Have another answer? Share your knowledge.