# Solved: Ubuntu: Package Installers "Fail to fetch"



## snorkytheweasel (May 3, 2006)

I'm trying to use aptitude (from the terminal) and synaptic (from Gnome) to install programs (in this case, VLC Media Player).

Using either package manager, the installation fails immediately and throws this error message:

'W: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/a/a52dec/liba52-0.7.4_0.7.4-7_i386.deb
Could not resolve "10.1.1.3:3128" '

Interestingly, I can fetch the file http://archive.ubuntu.com/ubuntu/pool/universe/a/a52dec/liba52-0.7.4_0.7.4-7_i386.deb if I use the address bar in Firefox.

I infer that the package managers cannot get past the proxy server - which *IS* 10.1.1.3 port 3128.

"Ah-ha!" I said to myself. "While Firefox reads its own configuration file to deal with the proxy, synaptic and aptitude do not use their own configuration files. They must be reading a system-wide configuration file."

Then I added, "Self (I call myself 'Self'), you'll have to configure the system-wide proxy settings using System -> Preferences -> Network Proxy"

So Self (that would be I) tried to do so. The configuration panel says that the proxy for http is "10.1.1.3:3128" _*AND*_ that the port is "3128". Hence the error condition when package managers try to do their jobs.

The bad news is that when I attempt to correct my OOPSIE! using System -> Preferences -> Network Proxy, I get this error:

'The application "gnome-network-preferences" attempted to change an aspect of your configuration that your system administrator or operating system vendor does not allow you to change. Some of the settings you have selected may not take effect, or may not be restored next time you use the application.'

For most, if not all, other restricted actions, Ubuntu prompts me for the password required for performing administrative tasks. Since I know both the password (I created it) AND the secret handshake, I should be able to perform this fix. In this case, The password prompt never appears. Knowing the password (and secret handshake), and being ready to use them, doesn't mean anything.

Note: I tried the old Windows do-it-all tactic: rebooting. That didn't help.

The quandry:

Gnome blocks me from making needed changes
Gnome doesn't ask for a password to enable making those changes
Gnome won't let me use sudo to make the changes
Gnome won't let me log on as root
Gnome won't let me change to root
Note the interesting quirk in this: clearly, I configured that proxy setting at some point in time. At that time 

I must have assumed that "10.1.1.3:3128" was the correct syntax... in some applications that IS a syntactally correct statement (probably something in our old nemesis, Windows)
Gnome must have allowed me to do said configuration
Now what do I (aka 'Self') do? I'm quite content to do this from the Command Line Interface, if that's what it takes.

PS: this smells like a bug, _nicht wahr_?

If so, whose bug is it? Gnome? Ubuntu?

Thanks in advance, and have a great August


----------



## lotuseclat79 (Sep 12, 2003)

Ok, you manged to use the address bar to get the .deb file. Did you install it?

Here is how if you have not:

$ sudo dpkg -i package_file.deb (i.e. substitute the real package name of the .deb)

-- Tom


----------



## lotuseclat79 (Sep 12, 2003)

Note: your inference that the package managers cannot get past the proxy server do not exactly follow.

For example, firefox can get past the proxy server because it properly has the proxy server interface specified in Preferecnces>Advanced>Network>Settings>Manual Proxy Configuration

Issuing the wget command from a command line terminal window is a different interface than either Synaptic Package Manager or aptitude - ask Self to be sure about that! 

Issue:
$ sudo apt-get update

Then from a root account try to issue:
export http_proxy="XXX.XXX.XXX.XXXort"
export ftp_proxy="XXX.XXX.XXX.XXXort"

it works fine in some console apps(wget ....)
Ref: https://answers.launchpad.net/ubuntu/+source/epiphany-browser/+question/5466

-- Tom

P.S. I hate when the php software issues the  symbol in the middle of something, so it does not include the space character in the following wrt port
export http_proxy="XXX.XXX.XXX.XXX: port"
export ftp_proxy="XXX.XXX.XXX.XXX: port"


----------



## snorkytheweasel (May 3, 2006)

Well, actually, it threw 24 "failed to fetch errors". I only listed the first one. I guess I could do this the hard way and download 23 more files via firefox... and then dpkg all of them.

I'd rather fix the real problem: how to get the package managers through the proxy server. 

Then anything I want to install should work as intended.


----------



## lotuseclat79 (Sep 12, 2003)

I take it the export commands did not work?

Verify with the env command and they should show up when done successfully.

-- Tom


----------



## snorkytheweasel (May 3, 2006)

This is why so many people "try" linux, thern run, screaming, back to windows.

export http_proxy="XXX.XXX.XXX.XXXort"
sudo: export: command not found

Do I have an "export" command on my system?
slocate export | grep bin
( null response )
I used " | grep bin " because that filters out the non-binary files

"Then from a root account try to issue...."

If you mean something other than sudo ...., I don't know to use a root account. On my older linux boxes, I could issue an "su" and then enter the root password to become root. On this one, however, when I enter the administrative password, I get 
su: Authentication failure
Sorry.

So, 
- export doesn't work because I have no export binary on the system
- the administrative password works with "sudo" but not with "su"

Maybe it's just me, but it seems to this noob that fixing the real problem - the proxy configuration - thereby enabling me to use a package manager with one command, is a better solution that using http or ftp 24 times before issuing who knows how many - and in what order - dpkg commands. 

Sorry to be so difficult. the meds haven't kicked in yet.


----------



## lotuseclat79 (Sep 12, 2003)

Ok, time for a tutorial.

export is a builtin command for the bash shell.

From the ubuntu user account /home/ubuntu directory:
$ cd
$ echo export http_proxy="10.1.1.3:3128" >> .bashrc
$ echo export ftp_proxy="10.1.1.3:3128" >> .bashrc
$ tail .bashrc

That should verify that both export statements were appended to the .bashrc file.

Then issue the command: $ . .bashrc 
[Note: there are two . . separated by a space before the bashrc]

Then retry the wget command. Did it work?

-- Tom


----------



## snorkytheweasel (May 3, 2006)

To make a long story short, this worked
export http_proxy=http://10.1.1.3:3128

"Worked" means that aptitude liked the environment as shown in export -p

"Worked" does not mean, however, that 
System -> Preferences -> Network Proxy"
is fixed.

It also does not mean that aptitude will continue to work after logout/login or after reboot. Time will tell.


----------



## lotuseclat79 (Sep 12, 2003)

If you have an installed system, and the export string as give above worked, then be sure to install it as with the echo command in both the root account .bashrc and the regualar user's .bashrc file in each user's home directory, i.e. /root/.bashrc for the root account and /home/ubuntu/.bashrc in the regular ubuntu user's account.

Then it should survive logout/login and reboot.

-- Tom


----------

