I have an Ubuntu 12.04 server edition which I ssh into.

I am running Perl scripts on this server but it fails when I load

'use LWP::UserAgent;' with error message:
Can't locate LWP/UserAgent.pm in @INC (@INC contains: /home/hermann/scripts/modules/ /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at 1_standalone line 5.
BEGIN failed--compilation aborted at 1_standalone line 5.

So in order to fix that I am trying to install LWP::UserAgent, which I am told is by: sudo apt-get install libwww-perl

But when I run that command i get the following error:

Failed to fetch http://is.archive.ubuntu.com/ubuntu/pool/main/libf/libfont-afm-perl/libfont-afm-perl_1.20-1_all.deb  Size mismatch
Failed to fetch http://is.archive.ubuntu.com/ubuntu/pool/main/libh/libhtml-tagset-perl/libhtml-tagset-perl_3.20-2_all.deb  Size mismatch
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Now I have tried doing sudo apt-get update, which appears to run fine but doesn't change anything. And I have also done 'sudo apt-get install libwww-perl --fix-missing', which also fails.

How do I install libwww-perl?

2 Answers 2


First, I would strongly advise against the direct 'perl way' installs, they will only make the mess bigger. You don't need these in Ubuntu. libwww-perl exists as a standard Ubuntu package.

Since this doesn't work. You should start by cleaning up your installation which seems to be broken. First, try cleaning-up your package installs like this:

sudo apt-get install -f
sudo apt-get update --fix-missing

and only when you don't get errors, move on to installing libwwww-perl, using:

sudo apt-get install libwww-perl


You seem to have a very unusual (non-standard) list of directories perl is searching libraries in. For example, there shouldn't be a /etc/perl in the places to look for libraries, and on Ubuntu you don't need anything starting with /usr/local.

To check whether the package is installed, you may check the output of:

dpkg-query -S libwww-perl

Check your env for bad forced perl paths:

env | grep PERL

If this gives any output, I would remove it from the environment before running perl: Look at your startup files (~/.bashrc in particular end comment these non standard settings out)

Good luck!


Try changing the download server. Software sources -> Ubuntu Software -> Download from: select the nearest geo from the list.


Try the Perl way of installion

perl -MCPAN -e 'install Bundle::LWP'


wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/libwww-perl-6.04.tar.gz
tar xzf libwww-perl-6.04.tar.gz
cd libwww-perl-6.04
perl Makefile.PL
sudo make install

(My download source picked one of the India server to download the file http://perlmirror.indialinks.com/authors/id/G/GA/GAAS/libwww-perl-6.04.tar.gz )

If you are downloading the LWP module in your home directory then don't forget to add the path to your perl @INC

  • As this server is located at a distance from where I am, I am justing ssh-ing into it and therefore can't enter the gui. Which eliminates the first possibility. As for the latter, the Perl way, I tried it but received error: 'could not make: Unknown error'.
    – john-jones
    Aug 26, 2012 at 15:12
  • somehow messed up ubuntu's pkg list, fsck did not help, reinstalling all packages resulted in LWP::User Agent not found (albeit libwww-perl being installed). This worked! thanks
    – Gotschi
    Mar 26, 2016 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .