Running sudo apt-get commands when you have a system proxy set

zman58
  10 years ago
  5

When you run apt-get command to install software and you are behind a proxy, the elevated root account does not see the proxy envioronment variables. As a result, the command will stall trying to download the necessary files.

1. Set proxy as required in System Settings - control center

2. Start Terminal

sudo apt-get install dconf-tools

...will not work.

But if you instead use the -E option for sudo, then it will work.

sudo -E apt-get install dconf-tools

..works and will install the required components

Comments
kpearsonxyz 8 years ago

Thanks to xenopeek, I can run apt, and everything else, from behind the corporate firewall. Great addition.


zman58 9 years ago

xenopeek,
Thanks for the tip. The solution you cited looks good, I'll have to give it a try.

One thing I think is missing from the System Proxy settings in Mint is the setting for "No Proxy".

I was implementing proxy settings on some of my systems using entries in /etc/profile.d/custom.s, but those entries were not available in the root env profile--only in logged in user.


xenopeek 10 years ago

sudo -E may have unintended side-effects. Better to set up proxy in /etc/environment (as /etc/environment variables affect all users, so work with sudo) and configure apt to use the proxy, as like in this example:
http://www.ictsteps.com/2013/10/how-to-use-proxy-setting-with-linux-mint.html