[BUGS] Dovecot not starting on startup

John Marshall john.marshall at riverwillow.com.au
Tue Apr 22 18:30:02 EST 2008


On Tue, 22 Apr 2008, 16:55 +1000, Edwin Groothuis wrote:
> On Tue, Apr 22, 2008 at 01:45:54PM +1000, Jerahmy Pocott wrote:
> > A few times now I'v had this server reboot (for unknown reasons likely  
> > involving someone pulling its plug out) and dovecot has failed to  
> > start on reboot. Manually starting it using the rc.d script and it  
> > runs fine, no error messages. I have dovecot_enable="YES" in the /etc/ 
> > rc.conf, so I had a look at the /usr/local/etc/rc.d/dovecot script and  
> > noticed the following:
> > 
> > # PROVIDE: dovecot
> > # REQUIRE: LOGIN ntpdate
> > # KEYWORD: shutdown
> > 
> > It requires ntpdate? Does this mean I need to have run ntpdate prior  
> > to starting it? I no longer use ntpdate because ntpd provides the same  
> > function for initially setting the time and then maintains it and  
> > ntpdate is now depreciated. I'm not used to this new rc script  
> > format.. The whole script used to be in these files =p
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/117894
> 
> Feel free to submit a new PR against the issue.

I think that ntpdate may be a red herring if Jerahmy is not seeing the "time
went backwards" messages being logged by dovecot. The PR quoted above is the
one responsible for adding ntpdate to the REQUIRE line - but that would only
solve the submitter's problem if ntpdate was actually enabled in rc.conf.

The PROVIDE/REQUIRE/BEFORE lines are used for determining the order in which
the rc scripts will run - that's all. If a script (like ntpdate) runs and
discovers that ntpdate_enable="NO", then nothing happens and we move on to
the next rc script - and may well end up starting dovecot before the system
time has synchronized.

> The ntpdate thing is funny, it should be ran as the first thing
> because afterwards you get different times in everything is very
> confusing for life, the universe and everything else.
> 
> Personally I have ntpd enabled and not ntpdate, but if you run both
> (ntpdate first, to make sure your time is right, and then ntpd to
> make sure your computer stays in sync) I'm not going to attack you
> on that.

I don't understand why ntpdate is being depracated. Running ntpd with the
"-g" flag (which is what ntpd_sync_on_start="YES" does) is not the same
thing. ntpdate -b sets synchronizes the time immediately - and then the rc
continues. ntpd -g allows ntpd to synchronize instead of panic if the offset
is big, but it can take several minutes to decide to do that - by which time
the system has been running for a couple of minutes and the time will go
backwards (or forwards).

> When to start it? No idea. I believe that it should be removed and
> that the time needs to be taken care of properly on that machine:
> always run ntpd. You can quote me on this when you submit the PR.

I've just checked. The current rcorder results in ntpdate running well
before LOGIN anyway (LOGIN requires DAEMON, DAEMON requires NETWORKING,
ntpdate requires NETWORKING). dovecot already requires LOGIN, so requiring
ntpdate doesn't change the order at all. I guess whoever actioned that PR
didn't do his homework!

I would add, "Always run ntpdate" unless someone can show me that ntpd does
the same thing (I'm willing to be taught!).

All that to one side, I am running dovecot 1.0.13 on a couple of servers
(both 6.3) and have not ever seen a problem with dovecot failing to start
when a server reboots. I'd be looking harder at error logging. Perhaps
checking debug logs or switching on extra logging in dovecot?

-- 
John Marshall


More information about the BUGS mailing list