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[1120]: 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>
into:
<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<key>Disabled</key>
.
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.
- No related posts
March 2nd, 2007 at 7:52 pm
Richard:
I’m having similar problems, but not quite of the same type.
I’m still using the Apple-provided postfix (I’ll soon upgrade…), and every so often I stop getting mail for one account (usually mine, but sometimes others…).
The log tells me that postfix could not get a lock on the mailbox file (it’s a real OS/X user account – not a virtual mailbox).
postfix stop doesn’t work – the daemon just restarts with 10.4.8, so I end up restarting the mac. Not a really good solution, especially when I’m not there to do it…(and I don’t have access..).
I”m not really sure where to look for a solution to this. I’ve tried googling to no avail, and the usual resources are not much help.
There are no visible lock files (even as root).
Do you have any ideas? I’d appreciate it,..
–Jeff
March 2nd, 2007 at 7:59 pm
You mailprogram, possibly mail.app, get’s access to your mail via the default imap server. I think it’s a cyrus one… Your local mailbox is a mbox file (one big file with everything). If mail.app looks for new mail the mbox file is locked and postfix can’t write to it. Usually you’ll get the email at a later moment.
The problem is fundamental to having an mbox file. That’s my best guess…
February 3rd, 2008 at 7:41 pm
I had the same problem, but Time Machine was the source of the problem. I use a restored Time Machine backup (I restored from TM after a harddisk upgrade), but the non-backupped directories weren’t re-created as empty directories. I had to manually create the following dirs in /var/spool/postfix:
- active
- deferred
- incoming
- maildrop
- pid
- private
- public
I created them as root:wheel and chmodded them to 777. I think they should be owned by _postfix:wheel and have 755 permissions or so, but I don’t really care since my MacBook is just a single-user box
I also had similar problems with Apache.