Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 369159

Summary: mail-filter/postgrey init script fails startup under sys-apps/openrc-0.8.2-r1
Product: Gentoo Linux Reporter: Giampaolo Tomassoni <giampaolo>
Component: [OLD] ServerAssignee: Andreis Vinogradovs ( slepnoga ) <andreis.vinogradovs>
Status: RESOLVED NEEDINFO    
Severity: normal CC: hasufell, lists, net-mail+disabled, proxy-maint, qnikst
Priority: Normal Keywords: STABLE
Version: 10.0   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=500174
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: A patch to the /etc/init.d/postgrey init script to fix this

Description Giampaolo Tomassoni 2011-05-29 09:45:48 UTC
Created attachment 275005 [details, diff]
A patch to the /etc/init.d/postgrey init script to fix this

Starting postgrey on a system working in a recent openrc model, result in the following error:

/etc/init.d/postgrey[6712]: start-stop-daemon: caught an interrupt
/etc/init.d/postgrey[6712]: start-stop-daemon: /usr/sbin/postgrey died
/etc/init.d/postgrey[6703]: ERROR: postgrey failed to start

However, the process is correctly started and running.

The reason for this seems related to the fact that the start-stop-daemon function can't find the process' pid file after starting it. This is due to two fact:

1) the init script starts the postgrey daemon invoking 'start-stop-daemon --background', while the daemon is instead able to fork and detach by itself, thereby the start-stop-daemon is waiting for the wrong child;

2) the postgrey daemon is quite slow in creating/updating its pid file, such that start-stop-daemon may occasionally fail even when the --background option is removed from its runstring.

Attached to this you'll find a patch to the /etc/init.d/postgrey init script, which relies on the daemon's own capability to fork and detach, and which uses the --wait option to wait for a valid pid file to be created.

Please note that the --wait option in start-stop-daemon seems to be introduced by some recent version of the script, so this init script may not work on baselayout-1 systems.

Also, the patch works around a (to me) unusual way of fixing the /var/spool/postfix/private/postgrey socket permissions, which was previously made by forking a sh job.
Comment 1 Eray Aslan gentoo-dev 2011-06-08 14:20:02 UTC
I cannot reproduce this with openrc-0.8.2-r1 (even under load) and I'd like to stay backward compatible with baselayout-1 if possible (even though the init script is too hacky for my taste as well).
Comment 2 Stefan G. Weichinger 2014-08-12 18:33:41 UTC
I get issues with the pidfile as well. 
Will report as soon as I sorted it out.

Mentioned patch does not work for me (openrc 0.12.4)
Comment 3 Julian Ospald 2014-08-13 13:22:14 UTC
is the maintainer still active?
Comment 4 Julian Ospald 2014-08-13 13:37:08 UTC
check if bug #500174 fixes it for you
Comment 5 Stefan G. Weichinger 2014-08-13 14:51:21 UTC
postgrey 1.35 works for me
Comment 6 Julian Ospald 2014-08-13 15:05:14 UTC
(In reply to Stefan G. Weichinger from comment #5)
> postgrey 1.35 works for me

which one?

postgrey-1.35 or postgrey-1.35-r1? Did you test postgrey-1.34-r3?
Comment 7 Stefan G. Weichinger 2014-08-14 08:37:32 UTC
(In reply to Julian Ospald (hasufell) from comment #6)
> (In reply to Stefan G. Weichinger from comment #5)
> > postgrey 1.35 works for me
> 
> which one?
> 
> postgrey-1.35 or postgrey-1.35-r1? Did you test postgrey-1.34-r3?

1.35

1.34.r3 wasn't there back then.
Comment 8 Julian Ospald 2014-08-14 11:00:28 UTC
(In reply to Stefan G. Weichinger from comment #7)
> (In reply to Julian Ospald (hasufell) from comment #6)
> > (In reply to Stefan G. Weichinger from comment #5)
> > > postgrey 1.35 works for me
> > 
> > which one?
> > 
> > postgrey-1.35 or postgrey-1.35-r1? Did you test postgrey-1.34-r3?
> 
> 1.35
> 
> 1.34.r3 wasn't there back then.

again: Did you test postgrey-1.34-r3?
Comment 9 Stefan G. Weichinger 2014-08-14 12:17:01 UTC
(In reply to Julian Ospald (hasufell) from comment #8)

> again: Did you test postgrey-1.34-r3?

again: no