Monday, April 08, 2013

Dovecot doesn't restart after software update & power fail

Impatient? click here
Yesterday afternoon, the patio door slid open and the lovely Carol appeared. "Before I restart the computer, should I close everything?" she asked.

That's right, it was a software update operation. I suggested that she quit NeoOffice, Firefox and Mail[.app]; it turned out that there was one other question to answer, but I gave it no further thought. For a while.

About 1:30 a.m., the power came back on. It hadn't been off for long, because the microwave oven's clock had the correct time when we got up later this morning. Other electronic clocks, though, were blinking. And the computers were off.

Actually mine, some lease-return IBM/Lenovo desktop from the previous decade, was already on. I guess that's what happens on power-fail-recovery. The Mac Mini, though, was silent. I fumbled around for the button and it came up.

I returned from walking the dog, to discover that thunderbird (on my Linux pee-cee) wasn't able to connect to the server—that is, dovecot on the mac mini (our setup is described further here).

I'm embarrassed to tell you that my first thought was to blame the software upgrade. "Shoulda checked to see if I needed a new rev of dovecot too," I muttered to myself. But then I came to my senses. Nope, everything was fine last night, after the upgrade (and supper).

I mused upon this while chewing my cereal. This might take some time to run down, I thought, and I tried to imagine how annoying it would be for the lovely Carol to have to do without email access.

"Bah—it musta been the power-failure!" I thought. Looked for /var/run/dovecot.pid -- no such file. Hurmpf, I said, and next typed grep dovecot /var/log/system.log, which revealed that dovecot was supposedly already running. The pid file (which was in /opt/local/var/run/dovecot.pid or something like this) claimed dovecot was running as PID 30. Of course "ps p30" told me the awful truth -- that was cron running there.

So it was a stale pid file. Becoming root, I "rm"ed the file, and in fairly short order some nice system process had re-spawned dovecot, and all was well.


update 2015-10-17

The filename is actually /opt/local/var/run/dovecot/master.pid
This is on Mac OS X 10.10.5