Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Timo Sirainen wrote: http://wiki.dovecot.org/TimeMovedBackwards bottom answers this. A restart isn't much better than just ignoring the time change. In point 3 (you can use clockspeed as well) you could mention chrony, too: http://chrony.sunsite.dk/ Thank you, Arno
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Matthijs Kooijman wrote: but I think it's not so trivial to handle this properly, without risking data loss (as Timo pointed out, immediately restarting is not really helping, since you'll still be running in the past. It would be interesting (as I do not know anything about the dovecot internals) why the current time is so important for dovecot. In my simple thinking the mail server has to manage a set of mails that all have a time stamp. Why is the time that the mail server is running in important for this management? Thanks, Arno
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Hi Arno, http://wiki.dovecot.org/TimeMovedBackwards bottom answers this. A restart isn't much better than just ignoring the time change. In point 3 (you can use clockspeed as well) you could mention chrony, too: That page has an edit button, so feel free! Gr. Matthijs signature.asc Description: Digital signature
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On 6/9/2009, Eugene (ge...@geniechka.ru) wrote: 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 =)) That would not be a good idea. You are chasing a symptom (the way dovecot responds to a serious problem), instead of the problem. Maintaining correct time is absolutely critical on a server, *especially* a mail server. Fix the problem - why 'time just moved backwards' keeps happening - and the dovecot 'symptom' goes away. In most cases we talk about, it can't be fixed permanently because this happens after (cold or warm) system restart, when ntpd can take up to 15 minutes (and in most cases about 3-5 minutes) to actually resync the time. I see that Harlan already addressed why this is only true if you haven't done your homework. -- Best regards, Charles
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On 6/10/2009, Arno Wald (arno.w...@netcologne.de) wrote: Why is the time that the mail server is running in important for this management? No offense, but are you serious? If so, I certainly hope you aren't running a public mail server. -- Best regards, Charles
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Matthijs Kooijman wrote: In point 3 (you can use clockspeed as well) you could mention chrony, too: That page has an edit button, so feel free! Done. I hope I have not destroyed anything. Bye, Arno.
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Charles Marcus wrote: On 6/10/2009, Arno Wald (arno.w...@netcologne.de) wrote: Why is the time that the mail server is running in important for this management? No offense, but are you serious? Well, I really meant the question seriously. A server gets mails, stores them and delivers them again, regardless of the current time. The only thing that is logical for me in case of a wrong time setting is, that the retrieval time stamp will be wrong. But why has a mail server a problem in handling mails with a future time stamp? If so, I certainly hope you aren't running a public mail server. No I do not. Mail server/handling and network configuration is one of the big magics for me. --
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Backward time steps can cause real problems for Maildir, as its uniqueness algorithms can be ... theoretically correct. H
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Wed, Jun 10, 2009 at 01:01:28AM +0400, Eugene wrote: Hello From: Timo Sirainen t...@iki.fi 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. In most cases we talk about, it can't be fixed permanently because this happens after (cold or warm) system restart, when ntpd can take up to 15 minutes (and in most cases about 3-5 minutes) to actually resync the time. With chrony it can be fixed, almost. What chrony does, besides acting as an NTP client when online, is to compare the hw clock to the system clock (kept in time via ntp) and determine the offset and rate of the hardware clock. When you start up your computer with chrony's -r -s options, it reads the file, and corrects the time read from the harware clock according to the offset and rate error of the hardware clock. The hardware clock rate changes by ppm so this is not perfect, e.g. if the computer is off for a week, it may well be out by a second, but of course if you did not do the rate correction it could be out by 10-100 sec. regards Juergen -- Juergen Daubert | mailto:j...@jue.li Korb, Germany| http://jue.li/crux
Re: [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
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
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.
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
NTP comes with a script, ntp-wait, that is specifically designed to be used during the boot-sequence for the purpose of waiting until the clock is sync'd before starting time-sensitive applications. See http://support.ntp.org/bin/view/Support/StartingNTP4 for more information. BCP is: - Start ntpd as early as possible during the boot sequence - As late as possible during the boot sequence run ntp-wait, before starting things like Dovecot and database servers H
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Hi Timo, Date: Tue, 9 Jun 2009 09:40:20 -0700 From: Timo Sirainen t...@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
Re: [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.
Re: [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
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Hi Eugene, 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. During normal operation, on 99% of the hosts, the clock should never need to leap backwards. So if that ever happens, it seems fine for dovecot to stop and require admin intervention. This is perhaps not ideal, but it sure beats dovecot making mails disappear or doing other funky and undefined stuff. If you happen to have a system on which this is in fact common, then you should find some way to deal with this yourself, preferably by not making the time leap backwards :-) I'm not saying there shouldn't be any improvements to handle this in dovecot, but I think it's not so trivial to handle this properly, without risking data loss (as Timo pointed out, immediately restarting is not really helping, since you'll still be running in the past. AFAIU, dovecot should at least wait with restarting until the backwards leap time has passed again, which seems rather non-trivial to implement). Gr. Matthijs signature.asc Description: Digital signature
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Hello From: Timo Sirainen t...@iki.fi 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. In most cases we talk about, it can't be fixed permanently because this happens after (cold or warm) system restart, when ntpd can take up to 15 minutes (and in most cases about 3-5 minutes) to actually resync the time. And since people are forced to restart Dovecot anyway, despite terrible warnings, and then nothing bad happens, people get the feeling that the problem is really artificially complicated =) Regards Eugene
Re: [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.
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Eugene wrote: In most cases we talk about, it can't be fixed permanently because this happens after (cold or warm) system restart, when ntpd can take up to 15 minutes (and in most cases about 3-5 minutes) to actually resync the time. If you have a good drift file and use iburst (as discussed at http://support.ntp.org/bin/view/Support/StartingNTP4 and also at http://support.ntp.org/bin/view/Support/ConfiguringNTP) ntpd will have your clock sync'd in about 11 seconds' time. H
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
I have been running AIX, IBM's Unix on IBM hardware for years but am being forced into Lintel, mostly because of IBM hollowing out support, moving to a Fortune 500 only customer base and leaving the small shop increasingly SOL. One of the realities of Lintel is that the hardware is, compared to purpose built Unix hardware with a matching O/S, crap. Partially because it's based on commodity hardware, 'little' matters like time consistency don't necessarily work consistently. Another area is storage corruption. Interesting piece here: http://linuxmafia.com/faq/Filesystems/reiserfs.html Juergen wrote: I'm pretty familiar with ntp in particular and computer timekeeping in general. I've also seen a fair number of situations where the hardware clock is just wrong, especially after a reboot. In my world, it's about getting things to work right in as many cases as possible. -- Once upon a time, the Internet was a friendly, neighbors-helping-neighbors small town, and no one locked their doors. Now it's like an apartment in Bed-Stuy: you need three heavy duty pick-proof locks, one of those braces that goes from the lock to the floor, and bars on the windows Stewart Dean, Unix System Admin, Bard College, New York 12504 sd...@bard.edu voice: 845-758-7475, fax: 845-758-7035
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
on 6-6-2009 12:52 PM Arno Wald spake the following: Pascal Volk wrote: On Debian systems I'm very happy with the OpenBSD NTP daemon. Package: openntpd This ntpd adjusts the local time in little steps. Also on startup? ntpd uses little steps while running, too. But only at startup it seems to do a big step. Many startup scripts for ntp make a call to ntpdate or an equivalent to get the time close on startup, then call ntp to keep the clock synced. signature.asc Description: OpenPGP digital signature
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
on 6-6-2009 11:50 AM Scott Haneda spake the following: 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 (time?) 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. Over time the crystal that controls the system clock will degrade. So it will oscillate at slightly different frequencies and affect the clock. The less expensive systems seem to degrade faster, as will a system that gets hot often. No simple electronic circuit can be totally accurate, it would be too expensive. signature.asc Description: OpenPGP digital signature
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
on 6-6-2009 2:45 PM Harlan Stenn spake the following: Juergen wrote: Harlan wrote: There is no corrected version of the real-time clock before the PC goes online. I'd suggest to read chrony's manual. Chrony stores the reference values collected while running online for further use after reboot, even if we have no online connection at that point. I'm pretty familiar with ntp in particular and computer timekeeping in general. I've also seen a fair number of situations where the hardware clock is just wrong, especially after a reboot. In my world, it's about getting things to work right in as many cases as possible. Of course, this doesn't work if you never have synced with an NTP server. And more often than one might think, if one has just rebooted a machine. H I just read the crony manual, and it seems it was written for a use like this. Over time it looks at the difference between the system clock and the hardware clock and keeps track of the drift. It does need to sync occasionally to build the accuracy. Then at startup, it refers to its drift per time calculation and sets the time based on this estimate. Hopefully it would get fairly close over a short period of running, and at least close enough to keep dovecot from erroring. I suppose you could also write something that watches the logs for time moved backwards, and run ntpdate followed by dovecot start. signature.asc Description: OpenPGP digital signature
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Jun 8, 2009, at 11:28 AM, Scott Silva wrote: Many startup scripts for ntp make a call to ntpdate or an equivalent to get the time close on startup, then call ntp to keep the clock synced. 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.
Re: [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
Re: [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?
Re: [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. --
Re: [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
Re: [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
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Have you seen http://support.ntp.org/Support ? You said your clock is running fast, so it's not a clock interrupt issue. If your OS supports it, and you have a *steady* problem with your clock, you might be able to correct this problem with the tickadj program and then ntpd should be able to keep the clock in sync. H
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On 06/06/2009 09:22 PM Arno Wald wrote: 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. On Debian systems I'm very happy with the OpenBSD NTP daemon. Package: openntpd This ntpd adjusts the local time in little steps. Regards, Pascal -- The trapper recommends today: defaced.0915...@localdomain.org
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Pascal Volk wrote: On Debian systems I'm very happy with the OpenBSD NTP daemon. Package: openntpd This ntpd adjusts the local time in little steps. Also on startup? ntpd uses little steps while running, too. But only at startup it seems to do a big step. But as I have found in the Debian-Changelog ntpd should handle the unreachable server situation automatically in current versions. This is way the dynamic command is obsolete. Maybe I did not wait long enough when testing this. So I could try ntpd again. But good to know there is the alternative openntp From the openntp package description: Alternative packages which provide similar functionality are ntp and chrony. And chrony does what clockspeed seems to do. ;) `chronyd' determines the rate at which the computer gains or loses time, and compensates for this. Arno
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Pascal Volk wrote: On Debian systems I'm very happy with the OpenBSD NTP daemon. Package: openntpd This ntpd adjusts the local time in little steps. The last I checked openntpd was an SNTP implementation, not NTP. If it works for you, great. H
Re: [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:j...@jue.li Korb, Germany| http://jue.li/crux
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Juergen wrote: How will chrony help here if the PC is not online at boot time? From http://chrony.sunsite.dk/guide/chrony.html - chronyd can perform usefully in an environment where access to the time reference is intermittent. chronyd estimates both the current time offset and the rate at which the computer's clock gains or loses time, and can use that rate estimate to trim the clock after the reference disappears. Doesn't apply to the use case. This is *before* the PC goes online. - chronyd provides support to work out the gain or loss rate of the `real-time clock', i.e. the clock that maintains the time when the computer is turned off. It can use this data when the system boots to set the system time from a corrected version of the real-time clock. There is no corrected version of the real-time clock before the PC goes online. H
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
On Sat, Jun 06, 2009 at 05:06:50PM -0400, Harlan Stenn wrote: Juergen wrote: How will chrony help here if the PC is not online at boot time? From http://chrony.sunsite.dk/guide/chrony.html - chronyd can perform usefully in an environment where access to the time reference is intermittent. chronyd estimates both the current time offset and the rate at which the computer's clock gains or loses time, and can use that rate estimate to trim the clock after the reference disappears. Doesn't apply to the use case. This is *before* the PC goes online. - chronyd provides support to work out the gain or loss rate of the `real-time clock', i.e. the clock that maintains the time when the computer is turned off. It can use this data when the system boots to set the system time from a corrected version of the real-time clock. There is no corrected version of the real-time clock before the PC goes online. I'd suggest to read chrony's manual. Chrony stores the reference values collected while running online for further use after reboot, even if we have no online connection at that point. Of course, this doesn't work if you never have synced with an NTP server. -- Juergen Daubert | mailto:j...@jue.li Korb, Germany| http://jue.li/crux
Re: [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
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Juergen wrote: Harlan wrote: There is no corrected version of the real-time clock before the PC goes online. I'd suggest to read chrony's manual. Chrony stores the reference values collected while running online for further use after reboot, even if we have no online connection at that point. I'm pretty familiar with ntp in particular and computer timekeeping in general. I've also seen a fair number of situations where the hardware clock is just wrong, especially after a reboot. In my world, it's about getting things to work right in as many cases as possible. Of course, this doesn't work if you never have synced with an NTP server. And more often than one might think, if one has just rebooted a machine. H
Re: [Dovecot] dovecot and ntp: Fatal: Time just moved backwards
Arno Wald wrote: 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. For completeness, even if it is getting OT in this mailing list (Sorry): http://chrony.sunsite.dk/faq.php#question_5.2 The problem is that chronyd (currently) isn't designed in a way that allows hostname-IP address lookups during normal operation. I hope to work on this problem very soon. (How old is this entry? ;) ) The solution is to restart chrony at ppp ip-up: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=268289 My /etc/ppp/ip-up.d/chrony now is: - #!/bin/sh sleep 1 invoke-rc.d chrony restart sleep 1 ... the original unmodified script follows here ... - Arno