Bug 436666

Summary: dovecut master.pid isn't removed on system startup, occasionally causing dovecot not to start up
Product: [Fedora] Fedora Reporter: Mads Kiilerich <mads>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 8CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Fedora 9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-27 22:40:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mads Kiilerich 2008-03-08 23:37:09 UTC
Description of problem:


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

How reproducible:
hard but explainable

Steps to Reproduce:
1. crash machine, leaving it with /var/run/dovecot/master.pid
2. start machine, let /etc/rc.sysinit remove /var/run/dovecot/*/*
3. let ntp start and let it get the pid from master.pid

Actual results:
Error: Dovecot is already running with PID 1835 (read from
/var/run/dovecot/master.pid)
Fatal: Invalid configuration in /etc/dovecot.conf

- which is pretty fatal if you are running an imap server...

Expected results:
Starting Dovecot Imap:                                     [  OK  ]


Additional info:
Seems to be fixed by
-               */dovecot)      rm -f $afile/*/* ;;
+               */dovecot)      rm -f $afile/*/* $afile/* ;;

Comment 1 Mads Kiilerich 2008-03-09 01:19:09 UTC
In my case selinux seems to have prevented dovecot from killing ntp:

host=localhost.localdomain type=AVC msg=audit(1205017755.529:33): avc: denied {
kill } for pid=6452 comm="dovecot" capability=5
scontext=unconfined_u:system_r:dovecot_t:s0
tcontext=unconfined_u:system_r:dovecot_t:s0 tclass=capability
host=localhost.localdomain type=SYSCALL msg=audit(1205017755.529:33):
arch=40000003 syscall=37 success=no exit=-1 a0=72b a1=0 a2=72b a3=9970030
items=0 ppid=6451 pid=6452 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0
sgid=0 fsgid=0 tty=pts0 comm="dovecot" exe="/usr/sbin/dovecot"
subj=unconfined_u:system_r:dovecot_t:s0 key=(null) 

So an alternative decription of the problem could be "dovecot kills random
process when started after crash"

Comment 2 Mads Kiilerich 2008-05-27 22:40:10 UTC
Seems to be solved in initscripts-8.76.2-1.i386 in Fedora 9 by using
    find -L /var/lock /var/run ! -type d -exec rm -f {} \;