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

Thursday, June 3, 2010 posted by Till

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

Be Sociable, Share!


7 Responses to “How to build a pure-ftpd Debian package for OpenVZ virtual machines (without capabilities enabled)”

  1. Flo says:

    Thank you so much! Worked perfect!!!
    For me i had to add source and update sys. Than it worked.
    nano /etc/apt/sources.list
    added:
    deb-src http://ftp.de.debian.org/debian lenny main contrib non-free
    deb-src http://security.debian.org/ 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.

  2. Brooks Swinnerton says:

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

  3. vunte says:

    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:
    pure-ftpd-mysql
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    E: Failed to process build dependencies
    ??
    any help will be great

  4. GospoD says:

    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:
    pure-ftpd-mysql

    Any help?

  5. Khayo says:

    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

    • Till says:

      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!

  6. Alessandro says:

    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?

Leave a Reply