111: Connection Refused

28,884

Solution 1

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.

Solution 2

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.

Solution 3

  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.

Solution 4

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

Share:
28,884

Related videos on Youtube

Lance
Author by

Lance

Updated on September 18, 2022

Comments

  • Lance
    Lance over 1 year

    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?

  • Lance
    Lance over 8 years
    I dont have either of those files, I only have one apt folder
  • Lance
    Lance over 8 years
    think it was using a maven proxy before
  • ssta
    ssta over 8 years
    I doubt apt-get was using a maven proxy - or at least I've never heard of such a thing...
  • Lance
    Lance over 8 years
    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