Bug 1253840 - sendmail startup complains "sendmail.pid not readable (yet?) after start"
Summary: sendmail startup complains "sendmail.pid not readable (yet?) after start"
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sendmail
Version: 7.3
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: qe-baseos-daemons
Depends On:
Blocks: 1298243
TreeView+ depends on / blocked
Reported: 2015-08-14 21:02 UTC by Joseph D. Wagner
Modified: 2020-04-01 00:58 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1057879
Last Closed: 2017-01-05 14:28:20 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Joseph D. Wagner 2015-08-14 21:02:48 UTC
+++ This bug was initially created as a clone of Bug #1057879 +++

+++ This bug impacts Red Hat Enterprise Linux 7. +++

Description of problem:

sendmail does start automatically but leaves in logs these:

-- Subject: Unit sendmail.service has begun with start-up
-- Unit sendmail.service has begun starting up.
Jan 25 09:55:36 yyyy systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start.
Jan 25 09:55:35 yyyy sendmail[1060]: starting daemon (8.14.7): SMTP+queueing@01:00:00

(Yes, reversed timestamps are straigth from journalctl output.)

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. run 'systemctl restart  sendmail.service' and read this "pid line" from 'systemctl -l status sendmail.service'

Additional info:
/run/sendmail.pid after a restart has a content like this:

/usr/sbin/sendmail -bd -q1h

Is it possible that whatever tries to read sendmail.pid runs an 'smmsp' user while /run/sendmail.pid has "-rw------- 1 root smmsp" access permits?
On this test installation selinux is turned off so, at least at this stage, it is not involved in blocking that read.

Comment 1 Joseph D. Wagner 2015-08-14 21:03:44 UTC
Permissions on /run/sendmail.pid are not set correctly.  At a minimum, group (smmsp) should be able to read.  Not sure if group needs write.

Comment 3 Sergio Basto 2016-05-27 12:43:58 UTC

"Please set PIDFile= accordingly. Note that the daemon should write
that file before finishing with its initialization. Otherwise, systemd
might try to read the file before it exists."

So it looks like sendmail creates pid file before exit ... (makes sense
since sendmail have 2 processes) , editing
/usr/lib/systemd/system/sendmail.service and comment out PIDFile entry
[1], solves the problem, I don't known if it's worth report it, but
seems still works correctly and don't report any warning.   


Comment 4 Jaroslav Škarvada 2016-10-25 16:31:47 UTC
The core of this problem is that sendmail main process fork the child (the server) and the main process then immediately exits without writing the PID. The PID file is written later at some non-deterministic moment. This is flow of the design. The cleanly written daemon should write the PID in the main process before it exits. Unfortunately this is not easy to fix in sendmail. We tried in the past, but we was not successful to get the fix upstream - the change in behaviour could also break others. Fortunately systemd can cope with this problem and the only drawback is the harmless warning in the journal stating that the PID file wasn't there in time it should be.

Comment 5 Jaroslav Škarvada 2017-01-05 14:28:20 UTC
Closing per comment 4.

Note You need to log in before you can comment on or make changes to this bug.