Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1253840 - sendmail startup complains "sendmail.pid not readable (yet?) after start"
sendmail startup complains "sendmail.pid not readable (yet?) after start"
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sendmail (Show other bugs)
All Linux
unspecified Severity low
: rc
: ---
Assigned To: Jaroslav Škarvada
Depends On:
Blocks: 1298243
  Show dependency treegraph
Reported: 2015-08-14 17:02 EDT by Joseph D. Wagner
Modified: 2017-01-05 09:28 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1057879
Last Closed: 2017-01-05 09:28:20 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Joseph D. Wagner 2015-08-14 17:02:48 EDT
+++ 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 17:03:44 EDT
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 Monteiro Basto 2016-05-27 08:43:58 EDT

"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 12:31:47 EDT
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 09:28:20 EST
Closing per comment 4.

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