Thanks Bill,

After some more research I found the bug and I think I've "fixed" it.  See 
below.

> > Option 1:  Use inet socket
> > ------------------------------------------------
> > /etc/default/mimedefang:
> >     SOCKET=inet:8899@localhost
> >
> > /etc/postfix/main.cf
> >     smtpd_milters = inet:localhost:8899
> >
> > This works for Ubuntu 14.04/MIMEDefang 2.73.
> > But it fails with Ubuntu 16.04/MIMEDefang 2.78.  If Postfix is already
> > running, and MIMEDefang is restarted, I get the following in
> > /var/log/mail.err:
> >
> >      mimedefang[27605]: MIMEDefang-2.78: Unable to bind to port
> > inet:8899@localhost: Address already in use
> >      mimedefang[27605]: MIMEDefang-2.78: Unable to create listening
> > socket on conn inet:8899@localhost
> 
> That's odd. Given your other options, I'd try to figure out what exactly
> is going on here and fix it. I.e. what process actually has taken that
> port.

Yes, odd.  

I've continued to research and just found this, which is my problem.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807078 

The problem occurs for me in MIMEDefang 2.78 (package for Ubuntu 16.04), which 
is the version reported in the above bug.  Apparently, the problem is that when 
using "systemctl restart mimedefang" it doesn't wait for itself to completely 
stop before it tries to start again.  And I can confirm that.  If I use 
"systemctl stop ...", then wait for it to stop, then "systemctl start ...", 
then it works.

The bug report says it's fixed in v2.79 and v2.79 is in the Ubuntu 17.04 
package.  
According to 
https://ubuntu.pkgs.org/17.04/ubuntu-universe-i386/mimedefang_2.79-2_i386.deb.html
 , on 2016-12-23 the init stop action was changed to always wait.

So here's what I did to "fix" it in Ubuntu 16.04/MIMEDefang 2.78:

In /etc/init.d/mimedefang, in the stop_it() function:

    #    if [ "$1" = "wait" ] ; then
    ....
    #    fi

In other words, just comment out the conditional wait so that the "waiting" 
part inside the IF statement always runs.

When I tried to run systemctl restart mimedefang, I got:
Warning: mimedefang.service changed on disk.  Run 'systemctl daemon-reload' to 
reload units.

So, I did that.  And then:  systemctl restart mimedefang seems to work just 
fine.

I'd appreciate it if any of the developers can verify that what I did shouldn't 
cause some other unintended consequence.

Thanks much,
Michael


_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to