The pure-ftpd package that comes with Debian 5.0 (Lenny) does not start in a OpenVZ virtual machine as it is compiled with "capabilities". This tutorial describes the steps to build a pure-ftpd Debian package with capabilities disabled:

Make a temporary directory

mkdir /usr/src/pure-ftpd
cd /usr/src/pure-ftpd

Download the source package for pure-ftpd

apt-get source pure-ftpd
apt-get build-dep pure-ftpd

Edit the rules file and add the switch "--without-capabilities"

cd pure-ftpd-1.0.21/debian
nano rules

Change the line:

optflags=--with-everything --with-largefile --with-pam --with-privsep --with-tls

to (one Line!):

optflags=--with-everything --with-largefile --with-pam --with-privsep --with-tls --without-capabilities

Build the Debian (.deb) package

cd ..
dpkg-buildpackage -uc -b

and install it

cd ..
dpkg -i pure-ftpd-common_1.0.21-11.4_all.deb pure-ftpd-mysql_1.0.21-11.4_i386.deb
/etc/init.d/pure-ftpd-mysql restart

To prevent that apt overwrites these manually compiled packages with the default packages from the Debian repositorys, execute these commands:

echo 'pure-ftpd-common hold' | dpkg --set-selections
echo 'pure-ftpd-mysql hold' | dpkg --set-selections

This tutorial is based on the german tutorial from planet_fox

Tagged on:

9 thoughts on “How to build a pure-ftpd Debian package for OpenVZ virtual machines (without capabilities enabled)

  • June 16, 2010 at 8:22 pm

    Thank you so much! Worked perfect!!!
    For me i had to add source and update sys. Than it worked.
    nano /etc/apt/sources.list
    deb-src lenny main contrib non-free
    deb-src lenny/updates main
    apt-get upgrade && apt-get update…

    But after that you can not use apt-get update to update pureftpd, the packages are keept back.

  • December 2, 2010 at 6:41 pm

    How would we go about updating Pureftpd after we’ve done this?

  • February 16, 2011 at 1:10 pm

    It didn’t solved my problem. I’ve removed the packages firstly and reinstalling the packages give me the error
    Setting up pure-ftpd-mysql (1.0.28-2) …
    update-rc.d: warning: pure-ftpd-mysql stop runlevel arguments (1) do not match LSB Default-Stop values (0 1 6)
    Starting ftp server: Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l mysql:/etc/pure-ftpd/db/mysql.conf -l pam -Y 1 -u 1000 -A -b -D -O clf:/var/log/pure-ftpd/transfer.log -8 UTF-8 -H -B
    invoke-rc.d: initscript pure-ftpd-mysql, action “start” failed.
    dpkg: error processing pure-ftpd-mysql (–configure):
    subprocess installed post-installation script returned error exit status 252
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    E: Failed to process build dependencies
    any help will be great

  • March 2, 2011 at 12:04 am

    root@vps:/usr/src/pure-ftpd# dpkg -i pure-ftpd-common_1.0.21-11.4_all.deb pure-ftpd-mysql_1.0.21-11.4_i386.deb
    dpkg: warning: downgrading pure-ftpd-common from 1.0.24-1 to 1.0.21-11.4.
    (Reading database … 36424 files and directories currently installed.)
    Preparing to replace pure-ftpd-common 1.0.24-1 (using pure-ftpd-common_1.0.21-11.4_all.deb) …
    Unpacking replacement pure-ftpd-common …
    Selecting previously deselected package pure-ftpd-mysql.
    Unpacking pure-ftpd-mysql (from pure-ftpd-mysql_1.0.21-11.4_i386.deb) …
    Setting up pure-ftpd-common (1.0.21-11.4) …
    Installing new version of config file /etc/pam.d/pure-ftpd …
    Processing triggers for man-db …
    Setting up pure-ftpd-mysql (1.0.21-11.4) …
    Starting ftp server: /usr/sbin/pure-ftpd-wrapper: Invalid configuration file /etc/pure-ftpd/conf/FSCharset: No corresponding directive
    invoke-rc.d: initscript pure-ftpd-mysql, action “start” failed.
    dpkg: error processing pure-ftpd-mysql (–install):
    subprocess installed post-installation script returned error exit status 255
    Errors were encountered while processing:

    Any help?

  • February 16, 2012 at 3:06 pm

    Had a problem in the last step

    echo ‘pure-ftpd-common hold’| dpkg -set-selections
    echo ‘pure-ftpd-mysql hold’ | dpkg -set-selections

    Appeared the following message after the command:

    root@servidor-DPW:/usr/src/pure-ftpd# echo ‘pure-ftpd-common hold’ | dpkg -selections
    dpkg: conflicting actions -e (–control) and -s (–status)

    Type dpkg –help for help about installing and deinstalling packages [*];
    Use `dselect’ or `aptitude’ for user-friendly package management;
    Type dpkg -Dhelp for a list of dpkg debug flag values;
    Type dpkg –force-help for a list of forcing options;
    Type dpkg-deb –help for help about manipulating *.deb files;
    Type dpkg –license for copyright license and lack of warranty (GNU GPL) [*].

    Options marked [*] produce a lot of output – pipe it through `less’ or `more’ !

    I searched on google and realized I was missing one “-” before “-set-selections”
    I used to work properly:

    echo ‘pure-ftpd-common hold’ | dpkg –set-selections
    echo ‘pure-ftpd-mysql hold’ | dpkg –set-selections

    • February 16, 2012 at 5:46 pm

      It were already 2 — in these commands in the tutorial, just some browsers display it wrong. I’ve changed the formatting now so that it should be more clear in other browsers as well. Thanks for pointing this out!

  • August 27, 2013 at 5:57 pm

    I’m trying to follow all steps in this tutorial with Wheezy 7.1 but when I do
    dpkg-buildpackage -uc -b
    the builder stucks in a loop and never stops…
    I tried it even without modifying the rules files, so with original source.
    Anybody has a clue?

    • June 29, 2014 at 12:01 pm

      do you solve the problem ?

  • June 29, 2014 at 11:53 am

    i have the same problem of Alessandro on Debian Wheezy , solution?


Leave a Reply

Your email address will not be published. Required fields are marked *