Solved: zypper fails if proxy is disabled but proxy environment variables still persist

I hope this helps someone to troubleshoot a possible online update issue.
After a long search I figured out the reason for intermittent update problems.
Symptom is that network is running fine, I can access the repo files in the web browser, but zypper will refuse to connect with timeout or other messages.

The situation is that I’m running my machine in differing environments, sometimes behind a proxy. My setups change the /etc/sysconfig/proxy to


(also yast2 shows proxy as disabled) but this doesn’t do the job completely.

Trying a

env|grep -i proxy

returns a bunch of variables which all contain the previous proxy URL and port

Changing all of them to empty strings with e.g.

export HTTP_PROXY=

solves the problem. Be sure to fix both uppercase and lowercase spellings of the variables!

Remaining headache: when changing the network environment without rebooting the machine, how do I get rid of all these env vars in all existing open shells? Even opening a new shell creates the wrong variable settings if the boot-time setup contained a proxy, as it seems.

So, I don’t think anything is going to change an open shell as it got set when you opened the session. What files did you edit to make your changes by chance? A logout and a login would start using the new settings I would think, but an open terminal session do not get updated as far as I know.

Thank You,

In principle a reboot would do it if the laptop has been reconfigured to use no proxy before reboot. Since I never succeeded to use NetworkManager, wicd or other helpers for my needs, I maintain a set of scripts and file copies to change the config, for example

# cat config_home
cp /root/configs/proxy.none /etc/sysconfig/proxy
cp /root/configs/resolv.conf.home /etc/resolv.conf
ifconfig eth0 down
cp /root/configs/ifcfg-wlan0.home /etc/sysconfig/network/ifcfg-wlan0
/etc/init.d/network restart
ifconfig eth0 up
source /root/configs/

In the proxy.none I only set the PROXY_ENABLED to “no” which seems to be sufficient for almost everything.
The last line I added recently, using the idea from

with some modification to include lower and upper case variables. My version looks like this:

# care for proxy related environment variables in the form (set or clear variables)
# HTTP_PROXY=http://user:pass@proxy:port
# Give no argument to clear proxy setting
echo "use: source <user:pass@proxy:port>"
# Source: <>

if test -z "$1"
for i in \
  export $i=$HTTP_PROXY
  nn=`echo $i | tr -t :upper:] :lower:]`
  export $nn=$HTTP_PROXY
unset i
unset nn

And so, does this work as you require then?

Thank You,

The general setup (e.g. config_home) works for the overall system even with complex setups (e.g. some interfaces enforced enabled for license daemons) while the last line (source only cleans the variables in the root shell where I run the script. From there I can use yast2 or zypper as desired in any network. As you say, there’s probably no way to unset existing variables in other shells. Actually I never tried to start yast from the KDE menu, I don’t know if this would be affected or not.

I don’t know what the clean solution (from Suse point of view) could be. Perhaps the processing of the /etc/sysconfig/proxy could be optimized, or, if yast and zypper are the only affected programs (that’s how it looks like), they should perhaps first check the system setting PROXY_ENABLED (which is not among the created environment variables BTW).