0% found this document useful (0 votes)
18 views

Why Is Apt-Get Always Using Proxy, Although No Proxy Is Configured - Ask Ubuntu

The document discusses why apt-get is always using a proxy even when no proxy is configured. It provides answers from community members on how to disable the proxy setting for apt-get by emptying or removing the proxy configuration file, setting proxy values to false, or unsetting any proxy environment variables.

Uploaded by

Sergio Acuna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Why Is Apt-Get Always Using Proxy, Although No Proxy Is Configured - Ask Ubuntu

The document discusses why apt-get is always using a proxy even when no proxy is configured. It provides answers from community members on how to disable the proxy setting for apt-get by emptying or removing the proxy configuration file, setting proxy values to false, or unsetting any proxy environment variables.

Uploaded by

Sergio Acuna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Why is apt-get always using proxy, although no proxy is... https://askubuntu.com/questions/344802/why-is-apt-get...

Anybody can ask a question


Ask Ubuntu is a question and answer site for
Ubuntu users and developers. It only takes a
minute to sign up. Anybody can answer

Sign up to join this community


The best answers are voted up and
rise to the top

Why is apt-get always using proxy, although no proxy is


configured?
Asked 10 years, 5 months ago Modified 11 months ago Viewed 76k times

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
50 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?

apt proxy

Share Improve this question edited Sep 12, 2013 at 19:50 asked Sep 12, 2013 at 19:27
Follow Alaa Ali Ahatius
31.4k 11 94 105 2,097 6 24 25

8 Answers Sorted by: Highest score (default)

1 of 6 2/16/24, 16:01
Why is apt-get always using proxy, although no proxy is... https://askubuntu.com/questions/344802/why-is-apt-get...

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
59 empty apt.conf file, which apt then ignored.

Works for current latest Ubuntu as well.

If the proxy conf does not exist, create it:

$ sudo touch /etc/apt/apt.conf.d/95proxy.conf

Then add the following two lines:

Acquire::http::Proxy "false";
Acquire::https::Proxy "false";

Share Improve this answer edited Aug 30, 2021 at 4:43 answered Sep 13, 2013 at 18:11
Follow kaiser Ahatius
107 6 2,097 6 24 25

1 It`s work! Disabled the Proxy with apt.conf. – Chu-Siang Lai Nov 3, 2014 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, 2015 at 2:27

where is this apt.conf file? – Lost Crotchet Oct 16, 2018 at 21:00

@LostCrotchet /etc/apt/apt.conf – Ahatius Oct 18, 2018 at 19:30

This worked like a charm on Ubuntu 20.04. Somehow my apt proxy setting was changed even though
the network proxy was unchanged. This solution is the only way out. – Pagol Jun 15, 2022 at 16:49

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

27 sudo apt-get -o Acquire::http::proxy=false <update/install>

Share Improve this answer edited Aug 7, 2018 at 21:55 answered Aug 7, 2018 at 19:43
Follow Stephen Rauch Prashant Adlinge
1,156 6 14 20 615 7 10

Most underrated answer ever. – Buhake Sindi Nov 10, 2020 at 15:33

Best if you just want a temporary one-time solution. – Marty Feb 7, 2022 at 17:34

2 of 6 2/16/24, 16:01
Why is apt-get always using proxy, although no proxy is... https://askubuntu.com/questions/344802/why-is-apt-get...

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

To find out, do the following command:


19
env | grep proxy

If you see some output, for example:

http_proxy=http://127.0.0.1:1234/

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 .

Share Improve this answer Follow answered Sep 12, 2013 at 19:54
Alaa Ali
31.4k 11 94 105

1 Thanks for the hint, unfortunately both the http and the https proxy are empty :\ – Ahatius Sep 13,
2013 at 8:45

1 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, 2013 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, 2013 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, 2013
at 18:09

Maype the proxy env has setting in /etc/environment , so we can looking for here. – Chu-Siang Lai
Nov 3, 2014 at 3:59

3 of 6 2/16/24, 16:01
Why is apt-get always using proxy, although no proxy is... https://askubuntu.com/questions/344802/why-is-apt-get...

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
7 (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";

Share Improve this answer edited Oct 11, 2019 at 14:02 answered Sep 15, 2013 at 1:32
Follow Braiam
67.6k 32 179 269

3 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, 2019 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)
2
Share Improve this answer Follow answered Sep 12, 2013 at 19:53
Aviran
1,161 2 7 9

4 of 6 2/16/24, 16:01
Why is apt-get always using proxy, although no proxy is... https://askubuntu.com/questions/344802/why-is-apt-get...

Stupid way of making it work is disable the proxy for a while using system settings >
Network .
2
Or remove the proxy config from /etc/environment and /etc/apt/apt.conf

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

Share Improve this answer Follow answered Sep 23, 2016 at 18:30
prayagupa
387 2 4 16

This worked and is really simple to follow :) – Ankit Shubham May 15, 2017 at 11:56

For me, no proxy variables were set in the environment, and no proxy was set at the system
level. However, a file 01proxy was present in /etc/apt/apt.conf.d/ which contained the line
1 Acquire::http::Proxy "http://PROXY:PORT"; . Commenting the line with # (or deleting the
file) worked for me. This means that other files in apt.conf and apt.conf.d may contain
proxy settings and I'd suggest greping proxy (with -i flag) information from those two
folders to know if the apt service uses one.

Note that @Prashant Adlinge answer always works in that case as it bypasses any
configuration file.

Share Improve this answer Follow answered Dec 10, 2021 at 8:45
Flewer47
121 4

5 of 6 2/16/24, 16:01
Why is apt-get always using proxy, although no proxy is... https://askubuntu.com/questions/344802/why-is-apt-get...

you should bypass all proxy settings:

0 sudo apt-get -o Acquire::http::proxy=false -o Acquire::https::proxy=false -o


Acquire::ftp::Proxy=false update
sudo apt-get -o Acquire::http::proxy=false -o Acquire::https::proxy=false -o
Acquire::ftp::Proxy=false install xxx

Share Improve this answer Follow answered Mar 17, 2023 at 4:51
shuhui geng
1

6 of 6 2/16/24, 16:01

You might also like