I'm trying to disable the proxy for apt-get but it seems like apt-get gets it's proxy configuration from somewhere else other than /etc/apt/apt.conf, because although the apt.conf file is empty (and the system proxy set to None) it's still trying to connect to the proxy.

Anyone got an idea?


I'm using a script to replace different configuration files in order to easily switch between proxy and non-proxy environements. The problem was that I replaced the proxy apt.conf file with an empty apt.conf file, which apt then ignored.

After writing Acquire::http::Proxy "false"; into the apt.conf it worked without proxy :)

  • 1
    It`s work! Disabled the Proxy with apt.conf. – Chu-Siang Lai Nov 3 '14 at 3:57
  • 1
    Im my case worked simply removing 95proxy.conf file from /etc/apt/apt.conf.d/ but better to explicit :D thank you. – m3nda Jun 23 '15 at 2:27
  • where is this apt.conf file? – Lost Crotchet Oct 16 '18 at 21:00
  • @LostCrotchet /etc/apt/apt.conf – Ahatius Oct 18 '18 at 19:30

Sometimes, there are proxy environment variables that are still set.

To find out, do the following command:

env | grep proxy

If you see some output, for example:


Then you'll need to unset this variable.

To do so, execute the following command:

unset http_proxy

Follow the same approach for all the other entries, such as https_proxy.

  • 1
    Thanks for the hint, unfortunately both the http and the https proxy are empty :\ – Ahatius Sep 13 '13 at 8:45
  • Hmm. Interesting. Although I doubt it, but maybe the variable is HTTP_PROXY (all caps), so try env | grep -i proxy (-i meaning "case insensitive"), and see if there's any output; it's worth a try =/. Also, can you do grep -iR proxy /etc/apt/? This searches for the word proxy in all files under /etc/apt/, because the proxy is sometimes set in a file under /etc/apt/apt.conf.d/. – Alaa Ali Sep 13 '13 at 9:24
  • It also doesn't have to do with proxy being all caps. Executing the grep command also didn't reveal any other file that contains a proxy configuration. – Ahatius Sep 13 '13 at 18:01
  • Ok, I think I got it. I'm using a script to switch all configuration files for proxies. The problem was that I replaced the apt.conf with an empty file. Apt then obviously always loaded the last proxy configuration, because the proxy value was not set to false. Thanks anyway for your efforts! – Ahatius Sep 13 '13 at 18:09
  • Maype the proxy env has setting in /etc/environment , so we can looking for here. – Chu-Siang Lai Nov 3 '14 at 3:59

If you do not want apt-get to use a proxy, use apt-get as:

sudo apt-get -o Acquire::http::proxy=false <update/install> 
  • Most underrated answer ever. – Buhake Sindi Nov 10 '20 at 15:33

There isn't only one place where apt-get read configuration files. You should run grep -i proxy /etc/apt/apt.conf.d/* and it will give you the exact file that has the proxy settings (this is just an example running with update instead proxy:

grep -i update /etc/apt/apt.conf.d/*
/etc/apt/apt.conf.d/20apt-show-versions:// When Apt's cache is updated (i.e. apt-cache update)
/etc/apt/apt.conf.d/20packagekit:// Whenever dpkg is called we might have different updates
/etc/apt/apt.conf.d/20packagekit:// i.e. if an user removes a package that had an update
/etc/apt/apt.conf.d/20packagekit:"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 1 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
/etc/apt/apt.conf.d/20packagekit:// When Apt's cache is updated (i.e. apt-cache update)
/etc/apt/apt.conf.d/20packagekit:"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 1 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
  • 1
    This is not enough, the file /etc/apt/apt.conf also can contain Proxy information. Also it may be written with capital letter. – kap Oct 11 '19 at 13:47

It's possible the environment variable http_proxy is set to some proxy. try clearing the variable (or at least look if it has a value)


Stupid way of making it work is disable the proxy for a while using system settings > Network .

Or remove the proxy config from /etc/environment and /etc/apt/apt.conf

enter image description here

And add the manual proxy config back once you need proxy back.

  • This worked and is really simple to follow :) – Ankit Shubham May 15 '17 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.