Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-20 Thread Alexander Moisseev

On some FreeBSD 6.2 systems I was solved this problem just by adding to crontab:
@hourly/sbin/sysctl `/sbin/sysctl -e machdep.adjkerntz` >/dev/null 2>&1

For some explanation, see:
http://lists.freebsd.org/pipermail/freebsd-hackers/2005-August/013383.html

Quote follows:

... It seems that CMOS clock is updated using resettodr(9) function. There
seem to be only a few occasions when this function is called:

1. clock_settime(ClOCK_REALTIME) // through kern_time.c:settime()
2. settimeofday() // through kern_time.c:settime()
3. machdep.adjkerntz sysctl is set

I believe that ntpd calls *settime-family* functions *only* if time offset
is *larger* than *128ms* (or maybe I am thinking about ntpdate), but
normally it uses ntp_adjtime() to adjust time keeping. Obviosuly, a
system running ntpd with good enough hardware clock and good enough
connection to good enough ntp server(s) would use the latter method all
of the time after some initial stabilization period. But it seems that
time changes are *never propagated to CMOS* in this case, ...

Alexander


Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Adam McDougall
On Sat, Jan 19, 2008 at 11:07:58AM -0500, Charles Marcus wrote:

  On 1/19/2008 Luigi Rosa wrote:
>> On one hand we have Dovecot that kill itself until someone kicks it back 
>> on, on the other hand we have just some errors on the logfile.
>> 
>> Well, IMHO at least there could be a configuration parameter that allows 
>> me to choose between a service that kills itself and some errors on a 
>> logfile and maybe a temporary service failure.
>> 
>> Each SysAdmin could weight the consequences and choose the option he/she 
>> thinks is more appropriate to his/her server. 
  
  Accurate time is CRITICAL for a mail server (and most any other server as 
  well).
  
  I think the current behavior is reasonable. Fix the actual problem (server 
  time being incorrect at boot time), and this is not an issue.
  
Even without this problem, it may be wise to add a script to check often 
if dovecot is running, and start it if it is not.  That way your downtime
caused by this issue will be minimal.  and/or add more servers so users won't
notice any downtime except possibly being disconnected once.


Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Charles Marcus

On 1/19/2008 Luigi Rosa wrote:
On one hand we have Dovecot that kill itself until someone kicks it 
back on, on the other hand we have just some errors on the logfile.


Well, IMHO at least there could be a configuration parameter that 
allows me to choose between a service that kills itself and some 
errors on a logfile and maybe a temporary service failure.


Each SysAdmin could weight the consequences and choose the option 
he/she thinks is more appropriate to his/her server. 


Accurate time is CRITICAL for a mail server (and most any other server 
as well).


I think the current behavior is reasonable. Fix the actual problem 
(server time being incorrect at boot time), and this is not an issue.


Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Luigi Rosa

Gunter Ohrner said the following on 19/01/08 16:51:

That's why I suggested to use ntpdate to force the correct time to be set 
before ntpd even starts and the ntp init script returns.
Admittedly, this won't work if you have no network connectivity during 
boot up, but if you have, this paticular problem is most likely solved.


I don't remember if there already is an ntpdat on that particular machine, but 
many ntpd startup script have an ntpdate entry. I'll check.


But I don't think that this is the point.

According to Dovecot Wiki, "If all else fails, you can just go and remove the 
error checking code from src/lib/ioloop.c. It's unlikely that anything will 
break badly, but you might get some errors logged once in a while."


On one hand we have Dovecot that kill itself until someone kicks it back on, on 
the other hand we have just some errors on the logfile.


Well, IMHO at least there could be a configuration parameter that allows me to 
choose between a service that kills itself and some errors on a logfile and 
maybe a temporary service failure.


Each SysAdmin could weight the consequences and choose the option he/she thinks 
is more appropriate to his/her server.





Ciao,
luigi

--
/
+--[Luigi Rosa]--
\

Success is 99% failure.
--Soichiro Honda


Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Luigi Rosa

Karsten Bräckelmann said the following on 19/01/2008 13.26:


But the system clock was 45 minutes ahead, so:

No. :)


You'r right, my mistake.


Exactly one hour. Doesn't strike me as a coincidence...


Don't know. That machine had a very long uptime. The system is
configured to have the hardware clock on GMT.





Ciao,
luigi


Ciao,
luigi

--
/
+--[Luigi Rosa]--
\

We must acknowledge once and for all that the purpose of diplomacy
is to prolong a crisis.
--Spock, "The Mark of Gideon"



Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Luigi Rosa

Gunter Ohrner said the following on 19/01/08 16:47:

Mh, sounds as if the system clock is set to "local time", including DST 
changes, and the system clock had not yet been adjusted... I know why I 
use UTC for the system clock on my machines... ;)


Probably. As I said the server lost power without a clean shutdown and its 
uptime was very high.




Ciao,
luigi

--
/
+--[Luigi Rosa]--
\

If it's working, the diagnostics say it's fine.
If it's not working, the diagnostics say it's fine.


Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Luigi Rosa

Ralf Hildebrandt said the following on 19/01/2008 13.16:


Solution: Start ntpdate/ntpd FIRST.


It's what I did, but it could not solve this specific issue.

Unfortunately, server and ADSL modem router went back online together 
and the ADSL router takes more time to go online than the server 
(blame it on Linux and fast processor :)


I was able to replicate this scenario: the ADSL modem/router connects 
to Internet few second after I get the login on Linux, so even 
starting ntpd right after the network and dovecot as last service 
could not help.



Ciao,
luigi

--
/
+--[Luigi Rosa]--
\

Q: And this, I'm particularly proud of - behind the headlights, 
stinger missiles!
James Bond: Excellent, just the thing for unwinding after a rough day 
at the office.
Q: Need I remind you, 007, that you have a license to kill, not to 
break traffic laws.

--007 Goldeneye


Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Karsten Bräckelmann
On Sat, 2008-01-19 at 12:46 +0100, Luigi Rosa wrote:
> Scenario: server PC abruptly switched off due to power cable problems 
> (an UPS cannot solve this issue), so during shutdown Linux was not 

This sounds like rather extreme, exceptional circumstances. And actually
an infrastructure problem, rather than software. ;)

> able to resinchronize the system clock. After a few hours the server 
> come back on, Linux booted and the services (ntpd, dovecot and many 
> others) started
> 
> But the system clock was 45 minutes ahead, so:

No. :)

> Jan 19 11:13:39 gw ntpd[2112]: synchronized to LOCAL(0), stratum 10
> Jan 19 11:13:39 gw ntpd[2112]: kernel time sync disabled 0041
> Jan 19 11:14:43 gw ntpd[2112]: synchronized to 62.48.35.100, stratum 2
> Jan 19 10:31:55 gw ntpd[2112]: time reset -3600.221385 s
> Jan 19 10:31:55 gw ntpd[2112]: kernel time sync enabled 0001
> Jan 19 10:31:55 gw dovecot: Time just moved backwards by 3600 seconds. 
> This might cause a lot of problems, so I'll just kill myself now. 
> http://wiki.dovecot.org/TimeMovedBackwards

Exactly one hour. Doesn't strike me as a coincidence...

  guenther


-- 
char *t="[EMAIL PROTECTED]";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}



Re: [Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Ralf Hildebrandt
* Luigi Rosa <[EMAIL PROTECTED]>:
> Scenario: server PC abruptly switched off due to power cable problems (an 
> UPS cannot solve this issue), so during shutdown Linux was not able to 
> resinchronize the system clock. After a few hours the server come back on, 
> Linux booted and the services (ntpd, dovecot and many others) started
>
> But the system clock was 45 minutes ahead, so:
>
> Jan 19 11:13:39 gw ntpd[2112]: synchronized to LOCAL(0), stratum 10
> Jan 19 11:13:39 gw ntpd[2112]: kernel time sync disabled 0041
> Jan 19 11:14:43 gw ntpd[2112]: synchronized to 62.48.35.100, stratum 2
> Jan 19 10:31:55 gw ntpd[2112]: time reset -3600.221385 s
> Jan 19 10:31:55 gw ntpd[2112]: kernel time sync enabled 0001
> Jan 19 10:31:55 gw dovecot: Time just moved backwards by 3600 seconds. This 
> might cause a lot of problems, so I'll just kill myself now. 
> http://wiki.dovecot.org/TimeMovedBackwards

Solution: Start ntpdate/ntpd FIRST.

-- 
Ralf Hildebrandt ([EMAIL PROTECTED]) [EMAIL PROTECTED]
Postfix - Einrichtung, Betrieb und Wartung   Tel. +49 (0)30-450 570-155
http://www.arschkrebs.de
I realise computers suck. The only reason why they are a hobby of mine
is because I enjoy pain! 


[Dovecot] Time just moved backwards error even with ntpd

2008-01-19 Thread Luigi Rosa
Scenario: server PC abruptly switched off due to power cable problems 
(an UPS cannot solve this issue), so during shutdown Linux was not 
able to resinchronize the system clock. After a few hours the server 
come back on, Linux booted and the services (ntpd, dovecot and many 
others) started


But the system clock was 45 minutes ahead, so:

Jan 19 11:13:39 gw ntpd[2112]: synchronized to LOCAL(0), stratum 10
Jan 19 11:13:39 gw ntpd[2112]: kernel time sync disabled 0041
Jan 19 11:14:43 gw ntpd[2112]: synchronized to 62.48.35.100, stratum 2
Jan 19 10:31:55 gw ntpd[2112]: time reset -3600.221385 s
Jan 19 10:31:55 gw ntpd[2112]: kernel time sync enabled 0001
Jan 19 10:31:55 gw dovecot: Time just moved backwards by 3600 seconds. 
This might cause a lot of problems, so I'll just kill myself now. 
http://wiki.dovecot.org/TimeMovedBackwards





Ciao,
luigi

--
/
+--[Luigi Rosa]--
\

Spoon boy: Do not try and bend the spoon. That's impossible. 
Instead... only try to realize the truth.

Neo: What truth?
Spoon boy: There is no spoon.
Neo: There is no spoon?
Spoon boy: Then you'll see, that it is not the spoon that bends, it is 
only yourself.

--The Matrix