<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 10 Jan 2020, at 18:37, Gerben Wierda <<a href="mailto:gerben.wierda@rna.nl" class="">gerben.wierda@rna.nl</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">postfix is started during boot on my macOS system. This fails with:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">Jan 10 18:00:08 mail postfix/master[488]: fatal: bind 0.0.0.0 port 25: Address already in use</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">Jan 10 18:00:10 mail /postfix-script[511]: fatal: mail system startup failed</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class="">but when I shortly thereafter launch it it just starts fine.</div><div class=""><br class=""></div><div class="">It seems something in the postfix/macOS combo makes this happen. Probably a weirdness in macOS if postfix starts when the system is still in some startup state (there have been more issues like this with macOS), so what I could use is a way to make postfix a bit more persistent in trying to start on a fatal.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">startupitem.create      yes</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">startupitem.start       "${prefix}/sbin/${name} start"</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">startupitem.stop        "${prefix}/sbin/${name} stop"</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Given that postfix writes a pid file in </span><span style="font-family: Menlo; font-size: 11px;" class="">/opt/local/var/spool/postfix/pid/master.pid </span>would it be possible to use a startupitem.pidfile entry that triggers daemondo to try to relaunch when this happens? Note: postfix is started by a program running  script which then starts the master process that writes the pid file.</div><div class=""><br class=""></div></div></div></blockquote><br class=""></div><div>It is not necessary as the cause has (probably) been found.</div><br class=""><div class="">macOS still contains a postfix and it is launched at boot time during 60 seconds with a launchdaemon plist /System/Library/LaunchDaemons/com.apple.postfix.master.plist:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><?xml version="1.0" encoding="UTF-8"?></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "<a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd" class="">http://www.apple.com/DTDs/PropertyList-1.0.dtd</a>"></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><plist version="1.0"></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><dict></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <key>Label</key></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> <span class="Apple-tab-span" style="white-space:pre">    </span><string>com.apple.postfix.master</string></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <key>Program</key></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <string>/usr/libexec/postfix/master</string></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <key>ProgramArguments</key></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <array></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                <string>master</string></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                <string>-e</string></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                <string>60</string></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        </array></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span><key>QueueDirectories</key></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <array></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                <string>/var/spool/postfix/maildrop</string></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        </array></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <key>AbandonProcessGroup</key></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">        <true/></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></dict></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></plist></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div></div><div class="">This runs master for 60 seconds during boot to clear any queue created by Apple’s sendmail and when something is dropped in that queue. This creates a race condition with MacPorts postfix (hence the remark in the mail-server Port that launching postfix after boot is unreliable).</div><div class=""><br class=""></div><div class="">Apple’s postfix master is steered by /etc/postfix/master.cf, which contains entries for smtpd (2x) and postscreen. Commenting these out:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""># ==== Begin auto-generated section ========================================</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""># This section of the master.cf file is auto-generated by the Server Admin</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">#  Mail backend plugin whenever mails settings are modified.</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><font color="#ff2600" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""># GW: Commented postscreen, smtpd commands </span>as Apple's postfix master gets run for 60 sec at boot</font></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#ff2600" class="">#smtp      inet  n<span class="Apple-tab-span" style="white-space:pre">  </span> -<span class="Apple-tab-span" style="white-space:pre">  </span> n<span class="Apple-tab-span" style="white-space:pre">  </span> -<span class="Apple-tab-span" style="white-space:pre">  </span> 1<span class="Apple-tab-span" style="white-space:pre">  </span> postscreen</font></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#ff2600" class="">#smtpd     pass  -       -       n       -       -       smtpd</font></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">dnsblog   unix  -<span class="Apple-tab-span" style="white-space:pre">     </span>-<span class="Apple-tab-span" style="white-space:pre">   </span>n<span class="Apple-tab-span" style="white-space:pre">   </span>-<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>dnsblog</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">tlsproxy  unix  -       -       n     <span class="Apple-tab-span" style="white-space:pre">  </span>-<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>tlsproxy</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#ff2600" class="">#submission inet n<span class="Apple-tab-span" style="white-space:pre">      </span> -<span class="Apple-tab-span" style="white-space:pre">  </span> n<span class="Apple-tab-span" style="white-space:pre">  </span> -<span class="Apple-tab-span" style="white-space:pre">  </span> -<span class="Apple-tab-span" style="white-space:pre">  </span> smtpd</font></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#ff2600" class="">#  -o smtpd_tls_security_level=encrypt</font></span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">Will result in Apple’s postfix not starting to listen on ports 25 and 587 for 60 seconds during boot or when anything is dropped in its queue by sendmail. (Actually, the second line doesn’t need to be as it doesn’t listen on inet)</div><div class=""><br class=""></div><div class="">Maybe the postfix port should issue a warning about /etc/postfix/master.cf or even better, uncomment these lines (not-commented lines that end in ’smtpd' or ‘postscreen’ and every non-empty-non-comment line that starts with whitespace immediately after. Multiline edit, so a job for awk and beyond my comfort zone.)</div><div class=""><br class=""></div><div class="">G</div></body></html>