Koozali.org: home of the SME Server

A way to handle problems with ntp drift after reboot

Offline holck

  • *
  • 322
  • +1/-0
A way to handle problems with ntp drift after reboot
« 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

......

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: A way to handle problems with ntp drift after reboot
« Reply #1 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..

Offline Daniel B.

  • *
  • 1,700
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: A way to handle problems with ntp drift after reboot
« Reply #2 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
C'est la fin du monde !!! :lol:

Offline holck

  • *
  • 322
  • +1/-0
Re: A way to handle problems with ntp drift after reboot
« Reply #3 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
......

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: A way to handle problems with ntp drift after reboot
« Reply #4 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