Ftp – Error installing pure-ftpd

ftpubuntu-12.04

I'm getting a very weird error when installing pure-ftpd on my Ubuntu 12.04.04 LTS server.

I'm running this command, with a sudo user.

sudo apt-get install pure-ftpd

and I get this error

Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up pure-ftpd (1.0.35-1) ...
Starting ftp server: File/Basename.pm did not return a true value at /usr/sbin/pure-ftpd-wrapper line 23.
BEGIN failed--compilation aborted at /usr/sbin/pure-ftpd-wrapper line 23.
invoke-rc.d: initscript pure-ftpd, action "start" failed.
dpkg: error processing pure-ftpd (--configure):
 subprocess installed post-installation script returned error exit status 5
Errors were encountered while processing:
 pure-ftpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

and then it just aborts the installation. I've installed pure-ftpd on my other machine just fine this way.

Best Answer

Preliminary Steps

Clean up your packages and update the cache:

sudo apt-get purge pure-ftpd
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update

Then try again:

sudo apt-get install pure-ftpd

If reinstalling PureFtpd doesn't work

This is line 23 of /usr/sbin/pure-ftpd-wrapper:

use File::Basename;

File::Basename is a Perl module. I tried installing it using:

$ cpan
cpan[1]> install File::Basename

But the install failed with the error:

Make had returned bad status, install seems impossible

However, it did mention that File::Basename is part of the perl-5.18.2 distribution.
So I upgraded Perl:

sudo apt-get upgrade perl --no-install-recommends

After that I could verify that it was installed using:

$ cpan
cpan[1]> i File::Basename

If you cannot install the Perl module

Question: When you use cpan and type i File::Basename, what comes up?

Response:

autouse.pm did not return a true value at /usr/share/perl/5.14/App/Cpan.pm line 182. BEGIN failed--compilation aborted at /usr/share/perl/5.14/App/Cpan.pm line 182. Compilation failed in require at /usr/bin/cpan line 8. BEGIN failed--compilation aborted at /usr/bin/cpan line 8.

Next Step:

Reinstall perl with

sudo apt-get install Perl --reinstall

OR

sudo apt-get purge Perl
sudo apt-get install Perl

(WARNING: Purging Perl can affect a LOT of dependencies and other applications)