Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 328575 - net-ftp/pure-ftpd-1.0.29 doesn't create pid file when uploadscript is enabled
Summary: net-ftp/pure-ftpd-1.0.29 doesn't create pid file when uploadscript is enabled
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-16 09:13 UTC by Marcin Mirosław
Modified: 2011-05-03 23:03 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output of strace -ff #1 (pure.pid.25364,11.96 KB, text/plain)
2010-07-19 11:10 UTC, Marcin Mirosław
Details
output of strace -ff #2 (pure.pid.25365,91.15 KB, text/plain)
2010-07-19 11:10 UTC, Marcin Mirosław
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Mirosław 2010-07-16 09:13:33 UTC
$ cat /etc/conf.d/pure-ftpd
IS_CONFIGURED="yes"
SERVER="-S 21"
MAX_CONN="-c 30"
MAX_CONN_IP="-C 10"
DAEMON="-B"
DISK_FULL="-k 90%"
AUTH="-l unix"
UPLOADSCRIPT="/bin/ls"
MISC_OTHER="-A -x -j -R -Z"

# /etc/init.d/pure-ftpd start
pure-ftpd          | * Starting Pure-FTPd ...
pure-ftpd          | * start-stop-daemon: did not create a valid pid in `/var/run/pure-ftpd.pid'
pure-ftpd          | * Could not launch Pure-FTPd                                                                                                                                 [ !! ]
pure-ftpd          | * ERROR: pure-ftpd failed to start

But:
# ps aux|grep pure
root     19139  0.0  0.0   8576   588 ?        Ss   11:08   0:00 /usr/sbin/pure-ftpd --pidfile /var/run/pure-ftpd.pid -S 21 -c 30 -C 10 -B -k 90% -l unix -A -x -j -R -Z --uploadscript
# cat /var/run/pure-ftpd.pid
cat: /var/run/pure-ftpd.pid: No such file or directory

I'm starting pure-ftpd manunally:
# /usr/sbin/pure-ftpd --pidfile /var/run/pure-ftpd.pid -S 21 -c 30 -C 10 -B -k 90% -l unix -A -x -j -R -Z --uploadscript
cat /var/run/pure-ftpd.pid
cat: /var/run/pure-ftpd.pid: No such file or directory

Now i'm removing options "--uploadscript":
# /usr/sbin/pure-ftpd --pidfile /var/run/pure-ftpd.pid -S 21 -c 30 -C 10 -B -k 90% -l unix -A -x -j -R -Z               
# cat /var/run/pure-ftpd.pid
22270

When option "--uploadscript" is enabled, pure-ftpd doesn't create file with his own pid. This is reason init scripts fails.

Reproducible: Always
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-17 09:39:21 UTC
I'm not able to reproduce the problem you're reporting. Even when I use your /etc/conf.d/pure-ftpd file the init script simply starts both daemons without any errors.

Could you please post the output of "emerge --info pure-ftpd"?
Comment 2 Marcin Mirosław 2010-07-17 13:04:58 UTC
I don't have access to host which trigger this bug.
On diffrent host (and with version net-ftp/pure-ftpd-1.0.28 ) i notice a little diffrent problem. Config file is the same as above,
# /etc/init.d/pure-ftpd start
 * Starting Pure-FTPd                  [ ok ]
 * Starting Pure-FTPd upload script    [ !! ]

Let's look on ps and pids witten in /var/run/:
# ps x|grep pure-
18155 ?        Ss     0:00 pure-ftpd (SERVER)
18159 ?        Ss     0:00 /usr/sbin/pure-uploadscript -B -r /bin/ls
# cat /var/run/pure-ftpd.pid
18155
# cat /var/run/pure-uploadscript.pid
18158

As we can see, pid of uploadscript doesn't match to pid written in /var/run/pure-uploadscript.pid . 
 # emerge --info pure-ftpd
Portage 2.1.8.3 (hardened/linux/x86/10.0, gcc-4.4.4, glibc-2.11.2-r0, 2.6.32-hardened-r10 i686)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.32-hardened-r10-i686-Pentium-R-_Dual-Core_CPU_E6300_@_2.80GHz-with-gentoo-1.12.13
Timestamp of tree: Sat, 17 Jul 2010 08:15:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.5-r2, 3.1.2-r3
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -mfpmath=sse -fpeel-loops -pipe -fprefetch-loop-arrays -ftracer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -mfpmath=sse -fpeel-loops -pipe -fprefetch-loop-arrays -ftracer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache collision-protect distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/"
LANG="pl_PL"
LC_ALL="pl_PL.ISO-8859-2"
LDFLAGS="-Wl,-O1,--as-needed"
LINGUAS="pl"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="-6"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise /usr/portage/local/layman/gnustep /usr/portage/local/layman/steev /usr/portage/local /usr/local/portage/miro/staging /usr/local/portage/miro/portage"
SYNC="rsync://trumpetti.atm.tut.fi/gentoo-portage/"
USE="acl acpi adns aio apache2 ares bash-completion bcmath berkdb bzip2 caps cgi chroot clamav clamdtop cli cracklib crypt cups curl custom-cflags cxx dkim dri dsn enscript exiscan exiscan-acl fam fastcgi force-cgi-redirect gdbm gnutls graphite hardened iconv idn imap iproute2 ipv6 libssh2 logrotate lzo maildir mmap mmx modules mudflap ncurses network-cron nls nptl nptlonly objc objc++ objc-gc openmp openssl pam pcre perl pic pppd profiling python readline reflection sctp server session sharedmem sieve spell spl srs sse sse2 sse3 ssl ssse3 subversion suhosin sysfs syslog threads threadsafe tools unicode urandom vhosts vim vim-pager vim-syntax x86 xattr xml xorg zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m       maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon auth_digest authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user cache cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif status unique_id usertrack vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="pl" NGINX_MODULES_HTTP="access auth_basic browser charset fastcgi gzip limit_req limit_zone map proxy referer rewrite stub_status upstream_ip_hash userid" RUBY_TARGETS="ruby18" USERLAND="GNU" XTABLES_ADDONS="geoip ipset psd tarpit"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

=================================================================
                        Package Settings
=================================================================

net-ftp/pure-ftpd-1.0.28 was built with the following:
USE="caps pam ssl -anondel -anonperm -anonren -anonres -charconv -ldap -mysql -noiplog -paranoidmsg -postgres (-selinux) -vchroot -xinetd"

I'll supply missing emerge --info pure-ftpd on monday.
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-17 13:45:18 UTC
(In reply to comment #2)
> On diffrent host (and with version net-ftp/pure-ftpd-1.0.28 ) i notice a little
> diffrent problem. Config file is the same as above,
> # /etc/init.d/pure-ftpd start
>  * Starting Pure-FTPd                  [ ok ]
>  * Starting Pure-FTPd upload script    [ !! ]
> 
> Let's look on ps and pids witten in /var/run/:
> # ps x|grep pure-
> 18155 ?        Ss     0:00 pure-ftpd (SERVER)
> 18159 ?        Ss     0:00 /usr/sbin/pure-uploadscript -B -r /bin/ls
> # cat /var/run/pure-ftpd.pid
> 18155
> # cat /var/run/pure-uploadscript.pid
> 18158
> 
> As we can see, pid of uploadscript doesn't match to pid written in
> /var/run/pure-uploadscript.pid . 

Indeed, this is a real problem as pure-uploadscript doesn't create a pid file even when being invoked with "--pidfile /var/run/pure-uploadscript.pid". This is definitely a bug in pure-uploadscript which should be reported upstream.
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-18 13:04:52 UTC
+  18 Jul 2010; Lars Wendler <polynomial-c@gentoo.org>
+  -pure-ftpd-1.0.29.ebuild, +pure-ftpd-1.0.29-r1.ebuild,
+  files/pure-ftpd.rc7, files/pure-ftpd.rc9:
+  Fixed bug in init scripts. pure-uploadscript doesn't create a pidfile on
+  its own and s-s-d only creates a valid pidfile when the started program
+  doesn't put itself into background. Thanks to Marcin Mirosław for
+  pointing this out in bug #328575.
+

Please try the fixed init script and report if it works or not.
Comment 5 Marcin Mirosław 2010-07-19 08:32:31 UTC
baselayout-1: it looks everything works correctly,
openrc: problem still appears

# /etc/init.d/pure-ftpd start
pure-ftpd          | * Starting Pure-FTPd ...
pure-ftpd          | * start-stop-daemon: did not create a valid pid in `/var/run/pure-ftpd.pid'
pure-ftpd          | * Could not launch Pure-FTPd     [ !! ]
pure-ftpd          | * ERROR: pure-ftpd failed to start

Comment 6 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-19 08:44:13 UTC
Please still provide the output of 

  emerge --info pure-ftpd

from the machine where the error happens.
Comment 7 Marcin Mirosław 2010-07-19 08:46:40 UTC
I forgot it :/

# emerge --info pure-ftpd
Portage 2.1.8.3 (default/linux/x86/10.0/desktop/kde, gcc-4.4.4, glibc-2.11.2-r0, 2.6.34-zen1 i686)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.34-zen1-i686-Intel-R-_Celeron-R-_CPU_E1500_@_2.20GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 19 Jul 2010 05:30:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p7
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.8.5-r3, 1.9.6-r2, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.3.5, 4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
virtual/os-headers:  2.6.34
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10.1 PUEL Q3AEULA skype-eula dlj-1.1"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -mfpmath=sse -pipe -fpeel-loops -fprefetch-loop-arrays -ftracer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -mfpmath=sse -pipe -fpeel-loops -fprefetch-loop-arrays -ftracer"
DISTDIR="/usr/portage/distfiles"
FEATURES="XXXmetadata-transfer assume-digests ccache collision-protect distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="pl_PL"
LC_ALL="pl_PL.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="pl en es"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/sunrise /usr/local/portage/miro-overlay/portage /usr/local/portage/miro-overlay/in_sunrise /usr/local/portage/miro-overlay/staging"
SYNC="rsync://192.168.138.254/gentoo-portage"
USE="X a52 aac acl acpi adns alsa apache2 async bash-completion bittorrent branding bzip2 cairo caps cdr chroot clamdtop cli community consolekit cracklib crypt cups custom-cflags custom-optimization cxx dbus diskio dlz dmx dri dts dvd dvdr emboss encode exif extras fam firefox flac fortran ftp fts3 gd gif gpm graphite hal hash iconv idn iproute2 ipv6 ithreads jpeg kde lcms ldap libnotify lightning logrotate lzo mad mikmod mmap mmx mmxext mng modules mp3 mp4 mpeg mtp mudflap mysql mysqli ncurses network-cron nls nptl nptlonly nsplugin objc ogg opengl openmp openssl optimization optimized-qmake pam pango pch pcre pdf perl phonon png ppds pppd profile profiling python qt3support qt4 readline reflection replytolist rss samba sdl semantic-desktop session sharedmem smp spell spl sqlite sqlite3 sse sse2 sse3 ssl ssse3 startup-notification strong-optimization subversion svg sysfs threads threadsafe tiff tools truetype unicode urandom usb vim vim-pager vim-syntax vim-with-x vorbis watchdog x264 x86 xattr xcb xinerama xml xorg xulrunner xv xvid zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm  authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cgid dav deflate dir env expires ext_filter  filter headers include info log_config logio mime mime_magic negotiation  rewrite setenvif speling status unique_id usertrack vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="pl en es" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel vesa nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

net-ftp/pure-ftpd-1.0.29-r1 was built with the following:
USE="caps ldap mysql pam ssl -anondel -anonperm -anonren -anonres -charconv -noiplog -paranoidmsg -postgres (-selinux) -vchroot -xinetd" 
Comment 8 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-19 10:45:33 UTC
I still cannot reproduce your problem. I now use the same conf.d file you posted in your initial comment and even recompiled pure-ftpd tio use the same set of USE flags. But for me startup of pure-ftpd still succeeds on my ~x86 system with openrc.
Did you verify that your system is using the latest init script? If yes, does it help to increase the value of the WAIT variable at line 26 of the init script?
Comment 9 Marcin Mirosław 2010-07-19 11:09:36 UTC
Init srcipt should be correct:
$ grep "Header" /etc/init.d/pure-ftpd 
# $Header: /var/cvsroot/gentoo-x86/net-ftp/pure-ftpd/files/pure-ftpd.rc9,v 1.2 2010/07/18 13:04:34 polynomial-c Exp $

I've changed value ov variable WAIT to 1000 and it doesn't change anything.
It looks pure-ftpd doesn't create pid, if i start it manually:
pure-ftpd --pidfile /var/run/pure-ftpd.pid -S 21 -c 30 -C 10 -B -k 90% -l unix -A -x -j -R -Z --uploadscript
I don't get pid file (option -g instead --pidfile doesn't change anything).
I show output of strace, pure-ftpd doesn't try to create those file, it only tries unlink, after kill.

Comment 10 Marcin Mirosław 2010-07-19 11:10:24 UTC
Created attachment 239365 [details]
output of strace -ff #1
Comment 11 Marcin Mirosław 2010-07-19 11:10:53 UTC
Created attachment 239367 [details]
output of strace -ff #2
Comment 12 Marcin Mirosław 2010-07-19 11:36:57 UTC
Pure-ftpd-1.0.29 creates pid on host x86 . Looks like compiler error?
On host where error appears i tried compile with CFLAGS="-march=pentium -O0", i tried gcc-4.3.5 and pure-ftpd still doesn't create pid. Glibc?
I'll try with chrooted enviroment, and i'll uprade it partially to ~x86. And i'll be trying to trigger error.
Comment 13 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-19 11:53:48 UTC
Please also try with ccache being disabled...
Comment 14 Marcin Mirosław 2010-07-20 07:54:18 UTC
Disabling ccache doesn't change anything. I made emerge -ave system and nothing changed.
On other host (~x86) i tried pure-ftpd-1.0.29-r1 and it works correctly, so problem with missing pid file is local problem. I'm closing bug as fixed, thank you for help. BTW, what about init script in stable version? Are you gonna to backport one?
Comment 15 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-07-20 08:09:34 UTC
(In reply to comment #14)
> BTW, what about init script in stable version? Are you gonna to
> backport one?

I added the fix for comment #2 to both stable and testing init scripts. The only difference of stable/testing scripts are that on openrc systems we can let the start-stop-daeom wait a couple of milliseconds for startup of pure-ftpd. This is necessary when you want to use pure-ftpd in TLS mode but did not create an ssl certifiate. Without the wait s-s-d would see pure-ftpd as started but the server exits immediately after being started (see bug #310177).

Comment 16 loopx 2010-07-28 19:36:26 UTC
I just got the same problem ... and I found what was my problem ... I just play with vsftpd before .. I unmerged it, but I've not stop the deamon ... a "ps aux | grep ftp" show me the process still running ... Kill it and then, retry-pure-ftpd and now, it start without the error with the pid problem :)

May be it's a missing test on the listening port which show a wrong error message ... Try to look if there is no other process already listening on the FTP port set in pure-ftpd ...
Comment 17 Dustin 2011-05-03 23:03:30 UTC
Thanks for that comment, loopx.  I ran into the same scenario, and killing vsftpd did it for me.