Koozali.org: home of the SME Server

Contribs.org Forums => General Discussion => Topic started by: holck on July 11, 2014, 10:38:12 AM

Title: A way to handle problems with ntp drift after reboot
Post by: holck on July 11, 2014, 10:38:12 AM
I think I have a problem with the RTC (real time clock) on my small HP ProLiant Server. If the server has been down for more than a few minutes, ntp apparently has great problems synchronizing with external ntp-servers, when the server starts up again. I have found a simple way to handle the problem, and will post it here so that others can benefit from it - and I can find the solution again, if I forget it...

You need to install the package adjtimex:
# yum install adjtimex

Stop ntp
# sv stop ntpd

Remove the ntp drift file
# rm /etc/ntp/drift

Run ntpdate to set the correct time
# ntpdate pool.ntp.org

Let adjtimex find reasonable values for drift, this will take a few minutes
# adjtimex -a

Start ntp again
# sv start ntpd

Title: Re: A way to handle problems with ntp drift after reboot
Post by: Stefano on July 11, 2014, 10:40:40 AM
can you share some details about your server? I have many HP proliant and never had such an issue..
Title: Re: A way to handle problems with ntp drift after reboot
Post by: Daniel B. on July 11, 2014, 11:31:57 AM
Another, simpler way to handle this:

Code: [Select]
db configuration setprop ntpd SupportLargeDrift enabled
signal-event timeserver-update

With this set, ntpd will accept big jumps in time. It was made mainly for VM, where you can suspend/resume a VM which results in big time drifts, but can also help in cases like your
Title: Re: A way to handle problems with ntp drift after reboot
Post by: holck on July 12, 2014, 11:09:33 AM
Thanks for your replies and suggestions -

@Stefano:

It's a HP ProLiant MicroServer N36L. Here's some output from lshw
Code: [Select]
computer
    description: Tower Computer
    product: ProLiant MicroServer (633724-421)
    vendor: HP
    serial: [REMOVED]
    width: 32 bits
    capabilities: smbios-2.6 dmi-2.6 smp-1.4 smp
    configuration: boot=normal chassis=tower cpus=2 sku=633724-421 uuid=[REMOVED]
  *-core
       description: Motherboard
       physical id: 0
     *-firmware
          description: BIOS
          vendor: HP
          physical id: 0
          version: O41
          date: 07/29/2011
          size: 64KiB
          capacity: 1984KiB

@Daniel:

I do have SupportLargeDrift enabled, but it hasn't solved the problem for me.

Thank you,
Jesper
Title: Re: A way to handle problems with ntp drift after reboot
Post by: mmccarn on July 12, 2014, 01:24:17 PM
You could try putting an entry in crontab like this:
Code: [Select]
@reboot /sbin/ntpdate -u pool.ntp.org >/dev/null 2>&1