Problems with apt-get update (-11 -System error) and GitHub

I am having some problems when running apt-get update:

W: Failed to fetch http://br.archive.ubuntu.com/ubuntu/dists/raring/Release.gpg
Something wicked happened resolving 'br.archive.ubuntu.com:http' (-11 - System error)
E: Some index files failed to download. 
They have been ignored, or old ones used instead.

Also, when I try to push something to GitHub I receive this error:

error: Couldn't resolve host 'github.com' 
while accessing https://github.com/lapl/HardL1.git/info/refs?service=git-receive-pack
fatal: HTTP request failed

When I am at University it works fine. Any help on fixing this?


Solution 1:

Configure your network to use another name server (DNS server) as the current one is failing to resolve the hostnames. Typically your home router has configured a DNS server which it uses to relay the DNS queries to. I can recommend using Google Public DNS services (8.8.8.8 and 8.8.4.4) to check out.

Preferably, try to change this setting in your router. If this fails, try setting it on a host-basis. I've described this earlier in another answer (an excerpt below).

I would recommend configuring your PC properly using Network Manager. I'm assuming you're using DHCP on your network here (most common). Then do this to perform the same as equivalent to the command you were using:

  1. Open Edit connections:

    enter image description here

  2. Edit the connection profile you're using.

    enter image description here

  3. On the IPv4 Settings tab:

    • Method: Automatic (DHCP) addresses only

      This setting makes it doing a regular DHCP request for IP address configuration of your host, but it will ignore other non-mandatory options like DNS servers suggested.

    • DNS Servers: 8.8.8.8
    • Hit Save

    enter image description here

Done.