Arno Wald
2009-Jun-06 18:19 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Hallo, I am running dovecot on a PC (a workstation) to have a mail client independent storage for my mails. Now I would like to have the system clock set correctly by using ntpd or ntpdate (using debian/sid). The problem is, that the PC is not online at boot time, but is set online on demand manually using "pon" to start the pppd later. So ntpd cannot sync the time on boot time before dovecot gets started. First I was using ntpdate that was started in ppp's if.up.d/ directory. This tool does set the time very hard instead of just slightly shifting some milliseconds. So dovecot did stop itself, reporting: "Fatal: Time just moved backwards by 118 seconds. This might cause a lot of problems, so I'll just kill myself now." So I have tried ntpd as I thought it shifts the time in smaller time deltas. But this takes much time (several seconds) when booting, giving up on all configured servers, because they are not reachable when booting (as going online later manually). This turns off ntp functionality because ntpd does think that all servers are unreachable for ever. (I have tried a command "dynamic" in ntp.conf but this did not change anything and ntpd reports it to be obsolete.) My idea now is to not start ntpd on system boot, but only on if-up. But this brings up the same fatal error of dovecot as ntpd seems to hardly set the time, too. The only idea I have left is to stop dovecot, start ntpd and then start dovecot again on if-up. Is there a more elegant way to use dovecot and ntpd on a manually dialed in PC? Thanks, Arno
John Gateley
2009-Jun-06 18:26 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Arno Wald wrote:> Is there a more elegant way to use dovecot and ntpd on a manually dialed > in PC?2 things might help: 1, run ntpd in cron every 10 minutes or so. That should avoid the startup issue. 2, sync your hardware clock every time. That should keep your clock closer to accurate. You may want to write a script that checks to see if the 'net is up, and only if it is does ntp. j
Timo Sirainen
2009-Jun-06 18:27 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Jun 6, 2009, at 11:19 AM, Arno Wald wrote:> My idea now is to not start ntpd on system boot, but only on if-up. > But this brings up the same fatal error of dovecot as ntpd seems to > hardly set the time, too. The only idea I have left is to stop > dovecot, start ntpd and then start dovecot again on if-up. > > Is there a more elegant way to use dovecot and ntpd on a manually > dialed in PC?Wonder if http://cr.yp.to/clockspeed.html would work better than ntpd?
Scott Haneda
2009-Jun-06 18:50 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Sorry for the top post and lack of snipping this email down, I'm using a mobile phone. Can you explain why the system clock gets so far out of time? I certainly struggle with crime drifting even on an always network connected machine, but I'm not understanding why your machine can not maintain time within a very small margin of error even if turned off for months. -- Scott Iphone says hello. On Jun 6, 2009, at 11:19 AM, Arno Wald <arno.wald at netcologne.de> wrote:> Hallo, > > I am running dovecot on a PC (a workstation) to have a mail client > independent storage for my mails. Now I would like to have the > system clock set correctly by using ntpd or ntpdate (using debian/ > sid). > > The problem is, that the PC is not online at boot time, but is set > online on demand manually using "pon" to start the pppd later. So > ntpd cannot sync the time on boot time before dovecot gets started. > > First I was using ntpdate that was started in ppp's if.up.d/ > directory. This tool does set the time very hard instead of just > slightly shifting some milliseconds. So dovecot did stop itself, > reporting: > > "Fatal: Time just moved backwards by 118 seconds. This might cause a > lot of problems, so I'll just kill myself now." > > So I have tried ntpd as I thought it shifts the time in smaller time > deltas. But this takes much time (several seconds) when booting, > giving up on all configured servers, because they are not reachable > when booting (as going online later manually). This turns off ntp > functionality because ntpd does think that all servers are > unreachable for ever. (I have tried a command "dynamic" in ntp.conf > but this did not change anything and ntpd reports it to be obsolete.) > > My idea now is to not start ntpd on system boot, but only on if-up. > But this brings up the same fatal error of dovecot as ntpd seems to > hardly set the time, too. The only idea I have left is to stop > dovecot, start ntpd and then start dovecot again on if-up. > > Is there a more elegant way to use dovecot and ntpd on a manually > dialed in PC? > > Thanks, > Arno
Arno Wald
2009-Jun-06 19:00 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Scott Haneda wrote:> Can you explain why the system clock gets so far out of time?No, I cannot, I do not know. Is it possible that the clock is out of order? I did compare the times with another PC that is ntpd controlled. And after 1 hour the times differ for 1 second again. It seems that my PC is too fast :) After some days (I do not know when the last ntp-sync did really happen because of the problems with ntpd that I have described) my PC was about 2 minutes in the future. --
Arno Wald
2009-Jun-06 19:22 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Timo Sirainen wrote: > Wonder if http://cr.yp.to/clockspeed.html would work better than ntpd? This is interesting, thank you. I will give it a try if ntpd or ntpdate will be no solution for me. But as there is no package for this in debian I would like to use the ntp stuff instead first. Arno
Arno Wald
2009-Jun-06 19:25 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
John Gateley wrote: > 2 things might help: Thank you for your suggestions. This reminded me of an ntpdate option: ntpdate can be configured to change the time not in a big step on startup by using the option -B Force the time to always be slewed using the adjtime() system call, even if the measured offset is greater than +-128 ms... I try if this will help. (I just do not understand if ntpdate keeps changing the time until it is correct or if it only is changing it a bit each time it is executed.) Arno
Juergen Daubert
2009-Jun-06 20:12 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Sat, Jun 06, 2009 at 08:19:14PM +0200, Arno Wald wrote:> Hallo, > > I am running dovecot on a PC (a workstation) to have a mail client > independent storage for my mails. Now I would like to have the system > clock set correctly by using ntpd or ntpdate (using debian/sid). > > The problem is, that the PC is not online at boot time, but is set > online on demand manually using "pon" to start the pppd later. So ntpd > cannot sync the time on boot time before dovecot gets started.Chrony is what you are looking for, see http://chrony.sunsite.dk/ Greetings Juergen -- Juergen Daubert | mailto:jue at jue.li Korb, Germany | http://jue.li/crux
Arno Wald
2009-Jun-06 21:43 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Juergen Daubert wrote:> Chrony is what you are looking for, see http://chrony.sunsite.dk/chrony does exactly look like what I need. But there is one big disadvantage when using it on manual dial up PCs: You have to configure the NTP-servers by IP-address instead of there names. I do not like to hardcode IP-addresses in a config file. (Also server-pools will not work (if I am right) where one server name returns different IP addresses each time for better load balancing or whatever.) It would be much better if chrony would look up the server addresses again when it does recieve the "online" state command. It seems that there is no option to turn on such a functionality. Thanks, Arno
Arno Wald
2009-Jun-09 06:40 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Timo Sirainen wrote:> Hmm. I suppose I could change Dovecot master so that if no imap/pop3 > processes have been created yet, it would silently ignore the clock move.Also it might be an idea to just restart dovecot instead of completely stopping it. If this happens to often in a certain time interval it still could be stopped to avoid too many restarts in a loop if there is an error situation somehow. Bye, Arno
Hi Timo,> Date: Tue, 9 Jun 2009 09:40:20 -0700 > From: Timo Sirainen <tss at iki.fi> > > On Jun 8, 2009, at 11:40 PM, Arno Wald wrote: > >> Timo Sirainen wrote: >>> Hmm. I suppose I could change Dovecot master so that if no imap/ >>> pop3 processes have been created yet, it would silently ignore the >>> clock move. >> >> Also it might be an idea to just restart dovecot instead of >> completely stopping it. If this happens to often in a certain time >> interval it still could be stopped to avoid too many restarts in a >> loop if there is an error situation somehow. > > http://wiki.dovecot.org/TimeMovedBackwards bottom answers this. A > restart isn't much better than just ignoring the time change.But really, all this leads is that admin has to detect the dovecot termination and simply go and restart it manually -- after some bad thoughts. I think that a config option to restart silently (or simply kill all connected imap/pop3 instances) would be quite reasonable. Basically it is the only thing I don't like in Dovecot... and was even planning to hack the time check out of the code =)) Best wishes Eugene
Timo Sirainen
2009-Jun-09 20:51 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Jun 9, 2009, at 1:03 PM, Eugene wrote:> But really, all this leads is that admin has to detect the dovecot > termination and simply go and restart it manually -- after some bad > thoughts.Or the admin actually permanently fixes the time.
Harlan Stenn
2009-Jun-09 20:54 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Timo wrote:> On Jun 9, 2009, at 1:03 PM, Eugene wrote: > > > But really, all this leads is that admin has to detect the dovecot > > termination and simply go and restart it manually -- after some bad > > thoughts. > > Or the admin actually permanently fixes the time.This is usually a startup issue and the fact that so many OSes get this wrong and that dovecot complains about it so strongly points out this "rough edge". H
Timo Sirainen
2009-Jun-09 21:02 UTC
[Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Jun 9, 2009, at 1:54 PM, Harlan Stenn wrote:> Timo wrote: >> On Jun 9, 2009, at 1:03 PM, Eugene wrote: >> >>> But really, all this leads is that admin has to detect the dovecot >>> termination and simply go and restart it manually -- after some bad >>> thoughts. >> >> Or the admin actually permanently fixes the time. > > This is usually a startup issue and the fact that so many OSes get > this > wrong and that dovecot complains about it so strongly points out this > "rough edge".And I already mentioned in this thread that I could try to get that fixed:> Hmm. I suppose I could change Dovecot master so that if no imap/pop3 > processes have been created yet, it would silently ignore the clock > move.