0

For some reason I cannot install new applications and also not run apt-get update on ubuntu 14 server

When i run apt-get update i get the following:

apt-get update
Err http://gb.archive.ubuntu.com trusty InRelease

Err http://security.ubuntu.com trusty-security InRelease

Err http://gb.archive.ubuntu.com trusty-updates InRelease

Err http://gb.archive.ubuntu.com trusty-backports InRelease

Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://gb.archive.ubuntu.com trusty Release.gpg
  Could not resolve 'gb.archive.ubuntu.com'
Err http://gb.archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'gb.archive.ubuntu.com'
Err http://gb.archive.ubuntu.com trusty-backports Release.gpg
  Could not resolve 'gb.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/trusty/InRelease

W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease

W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease

W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'gb.archive.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'gb.archive.ubuntu.com'

W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Could not resolve 'gb.archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.

I have a net connection as pinging various IPs works.. is there a safe way of resetting the factory default (although i have not modified the list) the /etc/apt/source list?

Thanks, john

John
  • 225
  • ... you say that you can ping "various ip's", but can you ping hosts by name - specifically gb.archive.ubuntu.com and/or security.ubuntu.com? – steeldriver Jan 11 '15 at 23:35
  • gb.archive.ubuntu.com is a normal archive address. This would be more in line with DNS resolution failing out. – Stephen Michael Kellat Jan 12 '15 at 00:42
  • It was indeed a dns issue. IP's would resolve and domain names would not. Previously we had the server's network/interface set to satic. The new router however did not like this, when i changed the interface to dhcp, and set a reserved ip at the router the machine could then resolve domain names again. – John Jan 12 '15 at 13:35

2 Answers2

3
  1. Ensure the nameserver IPs in /etc/resolv.conf file are pinging from your machine.
  2. If not try using a reliable name server like the Google's 8.8.8.8 and 8.8.4.4.
  3. Try putting the nameserver IP found in resolv.conf in your /etc/network/interfaces file as nameserver <IP of the DNS server> and restart the network by running /etc/init.d/networking restart and see if that works.
  4. If none of them works, try changing the order in /etc/nsswitch.conf, line host: put the dns first. hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4

You can find the discussion on a similar question here.

  • I don't know why but my router was not liking the /network/interface set to static ip. Instead i had to reserver the ip for the mac address of the machine at the router instead and all started working again. Thank you for the help :) – John Jan 12 '15 at 13:37
  • In that case, make sure you're machine's default gateway is right by running route -n. Also have the clarity of the IP address pool and excluded IP addresses in your DHCP server, ie.,the router. – Deepak D Jan 12 '15 at 14:10
-1

If you have a firewall such as UFW, you can either add an exception, or temporarily disable the firewall. Sometimes the firewall will block outgoing requests, so no matter what you change about the nameserver config, it won't work unless outgoing traffic is allowed by the firewall or the firewall is disabled.