Tuesday, August 04, 2009

Updating a Linux box behind proxy server

Recently I had to update a Linux (Fedora 9 to be precise) box, which was behind a proxy server. To get through the proxy server I configured relevant environment variables as described here. After executing 'sudo yum update' command system seems to be hanged after emitting following line on the console-

Loaded plugins: refresh-packagekit

After a long wait yum failed with following error message on console-

[vinod@localhost ~]# sudo yum update
Loaded plugins: refresh-packagekit
Could not retrieve mirrorlist http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-9&arch=i386 error was
[Errno 4] IOError: <urlopen error (110, 'Connection timed out')>
Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again


OK, so yum was not able to get through proxy, but when I tried to access the same URL using wget-

[vinod@localhost ~]# wget http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-9&arch=i386

it was able to access it. Then what could be wrong :-/

After pondering for sometime, I realized that proxy configuration was done using a non-root user while yum was running as root (due to sudo). Environment variables configured for a user are not carried forwarded (to another user) by Linux when user is changed using su or sudo command. Configuring the proxy as root solved the problem and yum successfully updated system.

0 Comments: