Bug#880047: postgrey doesn't start because it can't write its pid

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#880047: postgrey doesn't start because it can't write its pid

Paul Lockaby
Package: postgrey
Version: 1.36-3
Severity: grave
Justification: renders package unusable

Dear Maintainer,

The default init script that comes with Postgrey on Debian 9 fails to start after a reboot. The installer creates /var/run/postgrey and writes its pid there but /var/run is a tmpfs file system and so on a reboot /var/run/postgrey ceases to exist. The init script for Postgrey does not attempt to create /var/run/postgrey and just fails to start when it can't write to /var/run/postgrey. When postgrey fails to start then Postfix starts complaining that it is misconfigured and begins bouncing emails. I was able to fix this by adding these lines to the do_start function in the init script:

        # Assure that /var/run/postgrey exists
        [ -d /var/run/postgrey ] || mkdir -p /var/run/postgrey

        if [ "$DAEMON_USER" != "root" ]; then
                chown "$DAEMON_USER" /var/run/postgrey
        fi


-- System Information:
Debian Release: 9.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages postgrey depends on:
ii  adduser                3.115
ii  debconf [debconf-2.0]  1.5.61
pn  libberkeleydb-perl     <none>
pn  libnet-dns-perl        <none>
pn  libnet-server-perl     <none>
pn  libnetaddr-ip-perl     <none>
ii  perl                   5.24.1-3+deb9u2
ii  ucf                    3.0036

Versions of packages postgrey recommends:
pn  libnet-rblclient-perl  <none>
pn  libparse-syslog-perl   <none>
ii  postfix                3.1.6-0+deb9u1

postgrey suggests no packages.

Reply | Threaded
Open this post in threaded view
|

Bug#880047: postgrey doesn't start because it can't write its pid

Lee Garrett-5
Hi,

I triaged this bug on a fresh stretch VM. Installing postgrey 1.36-3 and
rebooting did not trigger the bug. I tried with both systemd and sysvinit.
Looking at /etc/init.d/postgrey, I see the following:

PIDFILE=/var/run/$DAEMON_NAME.pid

So the above init script shipped in stretch does not require
/var/run/postgrey/ to be created, since it is not used. But wait! Since the
init script is a conffile, it could be that the reporter upgraded from jessie.
However, postgrey 1.35-1 also has the following line:

PIDFILE=/var/run/$DAEMON_NAME.pid

As such, I don't think this bug ever existed in stretch or jessie, but was a
result of users trying to fix #756813. It may be possible that the init script
was inherited from wheezy or earlier, I did not check those releases. If that
was the case, I think the bug would have been noticed earlier.

Greetings from the Chemnitz BSP,
Lee

Reply | Threaded
Open this post in threaded view
|

Bug#880047: postgrey: Regression - Postgrey doesn't start after installing new stable proposed-update

Roger Lynn-3
In reply to this post by Paul Lockaby
Package: postgrey
Version: 1.36-3+deb9u1
Followup-For: Bug #880047

On a Stable system installed about a year ago, Postgrey 1.36-3 has always run
fine. When installing 1.36-3+deb9u1 I get:

Setting up postgrey (1.36-3+deb9u1) ...
Installing new version of config file /etc/init.d/postgrey ...
[....] Starting postfix greylisting daemon: postgreymkdir: cannot create directory ‘/var/run/postgrey/’: File exists
invoke-rc.d: initscript postgrey, action "start" failed.

# /etc/init.d/postgrey stop
[....] Stopping postfix greylisting daemon: postgreystart-stop-daemon: unable to open pidfile /var/run/postgrey/postgrey.pid (Not a directory)

# /etc/init.d/postgrey start
[....] Starting postfix greylisting daemon: postgreymkdir: cannot create directory ‘/var/run/postgrey/’: File exists

$ ls -al /var/run/postgrey
srw-rw-rw- 1 postgrey postgrey 0 Oct 27 23:14 /var/run/postgrey

After deleting /var/run/postgrey Postgrey will start, although subsequent
restarts give:

# /etc/init.d/postgrey start
[....] Starting postfix greylisting daemon: postgreyPid_file "/var/run/postgrey/postgrey.pid" already exists.  Overwriting!
. ok

Thanks,

Roger

-- System Information:
Debian Release: 9.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages postgrey depends on:
ii  adduser                3.115
ii  debconf [debconf-2.0]  1.5.61
ii  libberkeleydb-perl     0.55-1+b2
ii  libnet-dns-perl        1.07-1
ii  libnet-server-perl     2.008-3
ii  libnetaddr-ip-perl     4.079+dfsg-1+b1
ii  perl                   5.24.1-3+deb9u4
ii  ucf                    3.0036

Versions of packages postgrey recommends:
ii  exim4                  4.89-2+deb9u3
ii  libnet-rblclient-perl  0.5-3
ii  libparse-syslog-perl   1.10-2

postgrey suggests no packages.

-- debconf information:
  postgrey/1.32-3_changeport:
Reply | Threaded
Open this post in threaded view
|

Bug#880047: postgrey: Regression - Postgrey doesn't start after installing new stable proposed-update

Adrian Bunk-3
Control: reopen -1
Control: found -1 1.36-5

On Mon, Nov 05, 2018 at 09:53:24PM +0000, Roger Lynn wrote:

> Package: postgrey
> Version: 1.36-3+deb9u1
> Followup-For: Bug #880047
>
> On a Stable system installed about a year ago, Postgrey 1.36-3 has always run
> fine. When installing 1.36-3+deb9u1 I get:
>
> Setting up postgrey (1.36-3+deb9u1) ...
> Installing new version of config file /etc/init.d/postgrey ...
> [....] Starting postfix greylisting daemon: postgreymkdir: cannot create directory ‘/var/run/postgrey/’: File exists
> invoke-rc.d: initscript postgrey, action "start" failed.
>
> # /etc/init.d/postgrey stop
> [....] Stopping postfix greylisting daemon: postgreystart-stop-daemon: unable to open pidfile /var/run/postgrey/postgrey.pid (Not a directory)
>
> # /etc/init.d/postgrey start
> [....] Starting postfix greylisting daemon: postgreymkdir: cannot create directory ‘/var/run/postgrey/’: File exists
>
> $ ls -al /var/run/postgrey
> srw-rw-rw- 1 postgrey postgrey 0 Oct 27 23:14 /var/run/postgrey
>
> After deleting /var/run/postgrey Postgrey will start, although subsequent
> restarts give:
>
> # /etc/init.d/postgrey start
> [....] Starting postfix greylisting daemon: postgreyPid_file "/var/run/postgrey/postgrey.pid" already exists.  Overwriting!
> . ok

Tanks a lot for trying stretch-proposed-updates and reproting bugs you find!

This is a regression that is also in 1.36-5 in unstable.

The proposed 1.36-3+deb9u1 update has now been dropped from the upcoming
stretch point release.

> Thanks,
>
> Roger

cu
Adrian

--

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

Reply | Threaded
Open this post in threaded view
|

Bug#880047: postgrey: Regression - Postgrey doesn't start after installing new stable proposed-update

Adrian Bunk-3
In reply to this post by Paul Lockaby
On Sat, Nov 10, 2018 at 01:37:20PM +0000, Roger Lynn wrote:

> On 08/11/18 19:34, Adrian Bunk wrote:
> > Tanks a lot for trying stretch-proposed-updates and reproting bugs you find!
> >
> > This is a regression that is also in 1.36-5 in unstable.
> >
> > The proposed 1.36-3+deb9u1 update has now been dropped from the upcoming
> > stretch point release.
>
> Thank you for your work on this package. I think the reason my system was
> badly affected by the new release is because I had used the example unix
> socket location given in /usr/share/doc/postgrey/README.exim, which
> conflicted with the new directory created in the init script (although to be
> fair, the README does warn that the socket location might need to be
> changed).

I'd guess for stretch this just means that I'll prepare a 1.36-3+deb9u2
update that will revert to the situation 1.36-3 - I don't see any way
to make this change in a safe way for stable then.

> Regards,
>
> Roger

Thanks again for reporting this issue
Adrian

--

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

Reply | Threaded
Open this post in threaded view
|

Bug#880047: proposed nmu to revert change

Peter Palfrader
In reply to this post by Paul Lockaby
I plan to revert the -5 change from this bug which has also been
reverted in the stretch upload.

It seems to be unnecessary.

diff -Nur postgrey-1.36-5/debian/changelog postgrey-1.36-5.1/debian/changelog
--- postgrey-1.36-5/debian/changelog 2017-11-25 11:18:01.000000000 +0100
+++ postgrey-1.36-5.1/debian/changelog 2019-05-09 13:35:38.000000000 +0200
@@ -1,3 +1,14 @@
+postgrey (1.36-5.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Revert the 1.36-5 change due to a regression, discussed in #880047#.
+    The same patch has also been included in 1.36-3+deb9u1 and reverted
+    in 1.36-3+deb9u2.
+    There is no point in creating a /var/run/postgrey/ to hold the pidfile
+    as using /var/run/postgrey.pid seems to work just fine.
+
+ -- Peter Palfrader <[hidden email]>  Thu, 09 May 2019 13:35:38 +0200
+
 postgrey (1.36-5) unstable; urgency=medium
 
   * debian/postgrey.init: create /var/run/postgrey if it
diff -Nur postgrey-1.36-5/debian/postgrey.init postgrey-1.36-5.1/debian/postgrey.init
--- postgrey-1.36-5/debian/postgrey.init 2017-11-25 11:18:01.000000000 +0100
+++ postgrey-1.36-5.1/debian/postgrey.init 2019-05-09 13:35:08.000000000 +0200
@@ -26,7 +26,7 @@
 DESC="postfix greylisting daemon"
 DAEMON_USER=postgrey
 
-PIDFILE=/var/run/postgrey/$DAEMON_NAME.pid
+PIDFILE=/var/run/$DAEMON_NAME.pid
 SCRIPTNAME=/etc/init.d/$DAEMON_NAME
 
 # Gracefully exit if the package has been removed.
@@ -55,14 +55,6 @@
         #   0 if daemon has been started
         #   1 if daemon was already running
         #   2 if daemon could not be started
-   if [ ! -d /var/run/postgrey/ ]
-   then
-                mkdir /var/run/postgrey/
-                chown $DAEMON_USER: /var/run/postgrey/
-                chmod 0755 /var/run/postgrey/
-                # Restore selinux context
-                [ -x /sbin/restorecon ] && /sbin/restorecon /var/run/postgrey/
-   fi
         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
                 || return 1
         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \


Cheers,
--
                            |  .''`.       ** Debian **
      Peter Palfrader       | : :' :      The  universal
 https://www.palfrader.org/ | `. `'      Operating System
                            |   `-    https://www.debian.org/

Reply | Threaded
Open this post in threaded view
|

Bug#880047: proposed nmu to revert change

Peter Palfrader
On Thu, 09 May 2019, Peter Palfrader wrote:

> I plan to revert the -5 change from this bug which has also been
> reverted in the stretch upload.

uploaded to delayed 5.
--
                            |  .''`.       ** Debian **
      Peter Palfrader       | : :' :      The  universal
 https://www.palfrader.org/ | `. `'      Operating System
                            |   `-    https://www.debian.org/

Reply | Threaded
Open this post in threaded view
|

Bug#880047: closed by Peter Palfrader <weasel@debian.org> (Re: Bug#880047: postgrey doesn't start because it can't write its pid)

Helmut Grohne
In reply to this post by Paul Lockaby
On Wed, May 15, 2019 at 08:12:07AM +0000, Debian Bug Tracking System wrote:
> It seems to me that the default init script that ships with Debian 9
> does not use the directory /var/run/postgrey.

postgrey/1.36-3+deb9u2 has worked just fine for me on Debian 9. I didn't
experience any problems related to the init script.

Peter asked me to try postgrey/1.36-5.1 and when installing that on
Debian 9 it continues to work for me across reboots.

Helmut