Knowledgebase
Search:     Advanced search
Browse by category:
Glossary | Contact Us

Apt Get Error While Updating: Could Not Connect to localhost:4001 (111 connection refused)

Views: 552
Votes: 0
Posted: 04 Oct, 2007
by: Saunders T.
Updated: 22 Jan, 2008
by: Saunders T.
I found came across this error on one of our machines running Etch, It was running the exact same sources.list file as the rest of the systems, but apt-get refused to update, giving this error

            Could not connect to localhost:4001 (111 Connection Refused)

When I finally noticed that it was trying to connect to itself (Was paying to much attention to the 'Connection Refused' portion at first) I went looking and found this useful thread on the debian.net's forum

Debian User Forums :: View topic - apt-get: Could not connect to localhost:4001 (127.0.0.1)

It turns out that somewhere in there we triggered Anon-proxy and it was reconfiguring the http_proxy variable (/etc/environment) to the following...

            # +ANON_MARK+ Don't change this while anon-proxy manages this variable.
            # +ANON_MARK+ To take back control of it run dpkg-reconfigure and tell
            # +ANON_MARK+ debconf not to set this variable for you.
            HTTP_PROXY=http://localhost:4001 # +ANON_MARK+
            http_proxy=http://localhost:4001 # +ANON_MARK+


I chose the suggestion to simply reconfigure anon to leave /etc alone

            dpkg-reconfigure anon-proxy

I then removed the values set to http_proxy and entered the configuration via grep

As root, just do 'grep -r http_proxy /etc', and as your user yourself, do 'grep -r http_proxy $HOME/.*', that will simply search on both the system-wide config area (/etc) and your user-specific stuff to this setting.


A quick reboot and there you have it.... Problem solved.
Others in this Category
document Apt Commands, Resources, & Finding Binary Packages for Linux
document Complete Apt Repository Sources.list



RSS