Fatal: open lock file pid/master.pid
Posted in: PostFix
I encountered a strange error when I’d installed Postfix on someone else’s system. Everything installed without a hitch and looked to be running fine. But some time later strange errors were showing up in the logfile:
postfix/master: fatal: open lock file pid/master.pid unable to set exclusive lock: Resource temporarily unavailable
So I went looking for the file and found it in
/var/spool/postfix/pid/ and it looked fine. I stopped Postfix and the file disappeared and reappeared when I started it. Why ?
Next up, a quest for Google. The answer was strangely enough quite simple. There was another instance of Postfix running as one would expect. It was started by lauchd when new mail arrived. Somehow a leftover of trying to use the build-in Postfix application before we tried to install my version.
To make sure that the same problem is also generating errors on your machine, execute the following command:
sudo launchctl list
You would see a list like:
com.apple.dashboard.advisory.fetch com.apple.KernelEventAgent com.apple.mDNSResponder com.apple.nibindd com.apple.periodic-daily com.apple.periodic-monthly com.apple.periodic-weekly com.apple.portmap com.apple.syslogd
If in this list you see an item called:
org.postfix.master then the other running instance of Postfix is indeed you problem and you can try the following solution.
Edit the file
/System/Library/LaunchDaemons/org.postfix.master.plist with your favourite editor (as root or using sudo) and change the following block:
<dict> <key>Label</key> <string>org.postfix.master</string> </dict>
<dict> <key>Disabled</key> <key>Label</key> <string>org.postfix.master</string> </dict>
As you can see you can just disable it by adding the line
Please restart your Mac to restart the launchctl system. If it’s started check if your changes worked by sending yourself mail and check the logfile or run the command
sudo launchctl list again to see if the item still appears.
Note: I’ve also seen systems where the master.pid file wasn’t removed by a previous instance of Postfix (because of a possible crash). Just deleting the file if no known instance of Postfix is running and try to run your instance again might also work on your systems. I’ve encountered both possibilities.
Return to: Fatal: open lock file pid/master.pid