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

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.

Submit an Answer
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.