9

When I attempt to install packages through sudo apt-get install, no matter what I try to install, it returns a 111: Connection Refused error.

The web browser appears to work, but not sudo apt-get install. I attempted to install Ruby, PHP, and open-shift RHC tools, and I also attempted to use Synaptic to update/install packages, and I was unable to.

I get errors similar to the following, every time:

W: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main          /liby/libyaml  > /libyaml-0-2_0.1.4-3ubuntu3.1_i386.deb
Could not connect to 155.238.4.87:8080 (155.238.4.87). - connect (111: Connection refused)

I am using Ubuntu 14.04.1 LTS.

I connect to my adsl router via wireless, and am running an image that i got from my university running on vmware, using Windows 10. The university used a proxy but I edited it out in the M2 setting file and edited firefox to auto detect proxy to get my internet working

Please can someone help me figure out how to fix this?

0

8 Answers 8

5

See if there's a proxy set in /etc/apt/apt.conf (or somewhere in /etc/apt/apt/apt.conf.d).

There'll be a file with a line something like: Acquire::http::Proxy "http://155.238.4.87:8080";

Comment the line(s) by putting a # at the beginning of it and try again.

4
  • I dont have either of those files, I only have one apt folder
    – Lance
    Sep 25, 2015 at 15:03
  • think it was using a maven proxy before
    – Lance
    Sep 25, 2015 at 15:04
  • I doubt apt-get was using a maven proxy - or at least I've never heard of such a thing...
    – ssta
    Sep 25, 2015 at 15:42
  • I had to remove proxy setting in mavens settings.xml and change firefox to auto-detect proxy settings in order to access the internet but still get the same error when trying to download a package
    – Lance
    Sep 26, 2015 at 7:48
3

Could not connect to x.x.x.x:8080

Connection to IP:8080 indicates that you're using proxy.

Here are few suggestions:

  • Check by: apt-config dump | grep -i proxy.
  • If proxy is used, edit /etc/apt/apt.conf file or check for config files in /etc/apt/apt.conf.d/ or find by grep -ri proxy /etc/apt/, then adjust or remove the proxy.
  • To check the direct connection to security.ubuntu.com, run:

    curl http://security.ubuntu.com/ && echo Works
    

    To test the connection through proxy, run:

    curl -x http://PROXYIP:8080/ http://security.ubuntu.com/ && echo Works
    
  • To debug networking for apt-get command, you can run:

    strace -f -e network apt-get update 2>&1 | grep -C10 refused
    
  • Check your firewall rules and network configuration.

1

I solve this error by removing network settings.

I do :

cat /etc/apt/apt.conf 

If I see this

Acquire::http::proxy "http://macth-with-your-ip-or-dns-setting:8080/";
Acquire::https::proxy "https://macth-with-your-ip-or-dns-setting:9999/";

I go to network system settings and choose network then select Network Proxy Method see drop-down menu, choose manual then DELETE all settings there. Click Apply to save the setting or configuration that you made.

In the terminal do

cat /etc/apt/apt.conf

if there is no output, you have finished and you can apt-get update

1
  1. First check /etc/apt/apt.conf: if you found Acquire::http::proxy "http://x.x.x.x:8080/" just commented it with (#) at the beginning of the line.

  2. Then check /etc/environment: if you found http_proxy="http://x.x.x.x:8080/" just commented it with (#) on the beginning of the line.

0

If you are using the WSL(Windows Subsystem for Linux) version of Ubuntu, make sure you don't have any 3rd party Antivirus/firewalls enabled.

Try deactivating them and see if the connection goes back to normal.

There are known issues regarding 3rd party firewalls that do not behave well with WSL.

See the WSL GitHub issues 475 and 1720 for more details.

0

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 successfully.

  3. Your system is configured to use a local HTTP proxy for apt connections, and no such 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.

0

Old post, I know, but had this same issue on 18.04 and none of the posts I found had the solution that eventually worked for us. Adding it to the collective...

Err:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.88.161). - connect (111: Connection refused)

No proxy/Not using a proxy. Ping out okay. resolv.conf only has internal nameserver entries.

Issue was resolved by removing a manual entry:

91.189.88.161    security.ubuntu.com

in /etc/hosts

Good luck!

-1
  1. In command prompt, enter sudo nano /etc/apt/apt.conf
  2. Delete (or comment out) the contents of the file, press Ctrl+O and then Ctrl+X
  3. Enter sudo apt update
  4. Resume doing what you were previously doing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .