Ubuntu – 111: Connection refused when trying apt update

16.04aptdependenciesnetworkingupdates

I am using Ubuntu 16.04. Whenever I try to run sudo apt update, nothing gets updated, and the output is as follows:

Err:1 http://dl.google.com/linux/chrome/deb stable InRelease Could not connect to 213.192.64.75:41258 (213.192.64.75). - connect (111: Connection refused) 
Err:2 http://gb.archive.ubuntu.com/ubuntu xenial InRelease Could not connect to 213.192.64.75:41258 (213.192.64.75). - connect (111: Connection refused) 
Err:3 http://security.ubuntu.com/ubuntu xenial-security InRelease Could not connect to 213.192.64.75:41258 (213.192.64.75). - connect (111: Connection refused) 
Err:4 http://gb.archive.ubuntu.com/ubuntu xenial-updates InRelease Unable to connect to 213.192.64.75:41258: 
Err:5 http://gb.archive.ubuntu.com/ubuntu xenial-backports InRelease Unable to connect to 213.192.64.75:41258: 
Err:6 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial InRelease Unable to connect to 213.192.64.75:41258: 
Reading package lists... Done 
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/xenial/InRelease Could not connect to 213.192.64.75:41258 (213.192.64.75). - connect (111: Connection refused) 
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Unable to connect to 213.192.64.75:41258: 
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Unable to connect to 213.192.64.75:41258: 
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Could not connect to 213.192.64.75:41258 (213.192.64.75). - connect (111: Connection refused) 
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease Could not connect to 213.192.64.75:41258 (213.192.64.75). - connect (111: Connection refused) 
W: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/xenial/InRelease Unable to connect to 213.192.64.75:41258: 
W: Some index files failed to download. They have been ignored, or old ones used instead.

No proxy running. No active firewall. Pinging the server in question works fine.

I am also unable to install any software packages due to unmet dependencies. My package manager seems to be completely messed up; not sure if the two are linked in any way so I made a separate question here for this: askubuntu.com/questions/1081041/apt-get-unmet-dependencies

Best Answer

The port you are trying to connect to is not open on the IP address that you are trying to connect to for one of the following reasons.

  1. You are connecting to the wrong IP address. Use nmap on the server with hostname of localhost (nmap localhost) to check if the server is running properly in the port you want, and on the client with your server's public IP address to check if the destination port is open.

  2. You did not open the port on your firewall(s) successfully.

  3. Your system is configured to use a local HTTP proxy for apt connections, and no such proxy is running (included in this answer for the sake of completeness although you commented that no proxy is running). Many companies and higher education institutions have restrictions in place which includes a policy to control the types of websites you can access.