FS#32546 - [inetutils] systemd service unit for ftpd is missing PIDFile

Attached to Project: Arch Linux
Opened by Jan (DosAmp) - Thursday, 08 November 2012, 15:04 GMT
Last edited by Eric Belanger (Snowman) - Saturday, 14 December 2013, 23:02 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Eric Belanger (Snowman)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Service unit file doesn't reference ftpd's pidfile /var/run/ftpd.pid, service doesn't start because of this.

Package version: 1.9.1-4

Steps to reproduce:
0. (stop any other FTP daemon)
1. systemctl start ftpd.service -> journal says "Started FTPD Daemon", daemon is not running
2. add "PIDFile=/var/run/ftpd.pid" to [Service] section of /usr/lib/systemd/system/ftpd.service
3. systemctl --system daemon-reload
4. repeat step 1 -> daemon is running

Further thoughts:
* pidfile remains after service is stopped, triggering "PID ... read from file /var/run/ftpd.pid does not exist.".
* Adding "ExecStopPost=/bin/rm -f /var/run/ftpd.pid" leads to "PID file /var/run/ftpd.pid not readable (yet?) after start." instead.
This task depends upon

Closed by  Eric Belanger (Snowman)
Saturday, 14 December 2013, 23:02 GMT
Reason for closing:  Fixed
Comment by Eric Belanger (Snowman) - Thursday, 08 November 2012, 23:52 GMT
Can't reproduce here:
$ systemctl start ftpd.service
$ systemctl status ftpd.service
ftpd.service - FTPD Daemon
Loaded: loaded (/usr/lib/systemd/system/ftpd.service; disabled)
Active: active (running) since Thu, 2012-11-08 18:50:05 EST; 7s ago
Process: 23720 ExecStart=/usr/sbin/ftpd -D (code=exited, status=0/SUCCESS)
Main PID: 23722 (ftpd)
CGroup: name=systemd:/system/ftpd.service
└ 23722 /usr/sbin/ftpd -D

Nov 08 18:50:05 ovide systemd[1]: Starting FTPD Daemon...
Nov 08 18:50:05 ovide systemd[1]: Started FTPD Daemon.
Comment by Dave Reisner (falconindy) - Thursday, 08 November 2012, 23:58 GMT
Note that if PIDFile is missing, GuessMainPID is assumed true. For most services, this is sufficient. It'd be useful to see what the actual error in the journal is...
Comment by Jan (DosAmp) - Friday, 09 November 2012, 00:53 GMT
This is the output and journal entries (without any errors) here with original unit file. Service is "dead" right from the beginning.

# systemctl start ftpd.service
# pidof ftpd; echo $?
1
# systemctl status ftpd.service
ftpd.service - FTPD Daemon
Loaded: loaded (/usr/lib/systemd/system/ftpd.service; enabled)
Active: inactive (dead) since Fri, 2012-11-09 01:41:09 CET; 7s ago
Process: 2697 ExecStart=/usr/sbin/ftpd -D (code=exited, status=0/SUCCESS)
Main PID: 2698 (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/ftpd.service

Nov 09 01:41:09 sonic systemd[1]: Starting FTPD Daemon...
Nov 09 01:41:09 sonic systemd[1]: Started FTPD Daemon.
Comment by Dave Reisner (falconindy) - Friday, 09 November 2012, 01:43 GMT
And logging for _PID=2697 and _PID=2698?
Comment by Jan (DosAmp) - Friday, 09 November 2012, 11:28 GMT
# systemctl start ftpd.service
$ systemctl status ftpd.service | grep -E '^\s+(Process|Main PID):'
ftpd.service - FTPD Daemon
Process: 3303 ExecStart=/usr/sbin/ftpd -D (code=exited, status=0/SUCCESS)
Main PID: 3304 (code=exited, status=0/SUCCESS)
$ journalctl -u ftpd.service
-- Logs begin at Wed, 2012-11-07 13:00:29 CET, end at Wed, 2012-11-07 13:44:39 CET. --
$ journalctl _PID=3303
-- Logs begin at Wed, 2012-11-07 13:00:29 CET, end at Wed, 2012-11-07 13:44:39 CET. --
$ journalctl _PID=3304
-- Logs begin at Wed, 2012-11-07 13:00:29 CET, end at Wed, 2012-11-07 13:44:39 CET. --

Something is really borked here, reference system doesn't show this symptoms either.
Comment by Dave Reisner (falconindy) - Saturday, 10 November 2012, 00:35 GMT
Does it start if you run it outside of a service? I suspect it doesn't.
Comment by Jan (DosAmp) - Saturday, 10 November 2012, 11:33 GMT
It does start fine manually:

# systemctl stop ftpd
# /usr/sbin/ftpd -D
$ pidof ftpd
1128
$ cat /var/run/ftpd.pid
1128

The service unit works fine on my host, but neither on this box (thinclient with 512 MB CF card as root filesystem and external /var and /home) nor the VM I set up prior to test this space-limited environment. Following packages are missing from the base group:

$ pacman -Sg base | awk '{print $2}' > base.txt
$ pacman -Q | awk '{print $1}' > installed.txt
$ comm -23 base.txt installed.txt
cryptsetup
gettext
jfsutils
less
licenses
man-db
man-pages
mdadm
pcmciautils
ppp
reiserfsprogs
texinfo
usbutils
xfsprogs

The exact same symptom occurs with other daemons like bftpd which has GuessMainPID explicitly set (but upon closer inspection doesn't create or write to a pidfile at all, probably due to root privilege dropping, unlike ftpd).
Comment by Jan (DosAmp) - Saturday, 10 November 2012, 12:42 GMT
Update: This also happens on a fresh test installation with only (full) base + syslinux as per the Installation Guide, so it's most likely a systemd-related issue. ftpd (and bftpd, where the script does all the work of creating the pidfile) work fine using their initscripts.
Comment by ... (spider007) - Thursday, 04 April 2013, 18:14 GMT
Could this be related to #32258 where the same problem occurs?
Comment by Jan (DosAmp) - Thursday, 04 April 2013, 18:27 GMT
This is what the journal says when I add the PIDFile statement (still doesn't work without):

Apr 04 20:22:45 sonic systemd[1]: PID file /var/run/ftpd.pid not readable (yet?) after start.
Apr 04 20:22:45 sonic systemd[1]: Started FTPD Daemon.

Maybe this keeps systemd from guessing the correct pid file on its own?
Comment by Cédric M. Campos (cedricmc) - Sunday, 07 April 2013, 15:59 GMT
I am using a Raspberry Pi board with a fully updated Arch Linux system where, apart of the base system, only transmission-cli has been installed.

Systemd is not able of loading 'ftpd -D' properly. Issuing 'ftpd -D' on the command line works though.
Comment by Eric Belanger (Snowman) - Monday, 15 April 2013, 05:07 GMT
Try adding the options "--debug --logging" to the ExecStart. Maybe that will give us a clear error message.
Comment by Richard Jackson (richjn) - Wednesday, 05 June 2013, 09:56 GMT
I have the same issue noted above so added the "--debug --logging" to ExecStart, but no usefull additional information in the logs.
I needed to reboot the server for the /bin > /usr/bin move (just to make sure everything was ok) and was surprised to see the ftpd daemon running. I stoped / started the service
which failed again. Rebooted and it works. I have no idea what is going on but hope this additional info helps
Comment by Eric Belanger (Snowman) - Sunday, 08 December 2013, 00:24 GMT
Should be fixed in inetutils-1.9.1.341-2 in [testing]. Let me know if it work or not.

Loading...