Getting clocks synchronized on OpenRemote eBox

In the real time application, which OpenRemote usually is, it is very important to have clocks synchronized so they do not drift away too much. Nowadays, computers have usually a cheap real time clock hardware which can easily drift even few seconds in 24h! You can check easily how your machines are in sync with the date command. Below is example of running this command on my LAN:

michal@rutek06 ~> date; ssh ds date; ssh root@orb date;
Mon Oct 6 11:35:21 CEST 2014
Mon Oct 6 11:35:21 CEST 2014
Mon Oct 6 11:35:21 CEST 2014

It is run from my Mac, I have a Synology NAS with alias ds and OpenRemote eBox with alias orb. As you can see, all they are pretty good in sync. To achieve this the Network Time Protocol (NTP) is used. Follow these steps in order to configure ntp on the OpenRemote eBox (NAS configuration is quite similar):

  1. Login to ebox with:
    # ssh root@orb
  2. Install ntp:
    # apt-get update

    # apt-get install ntp
    This will run ntpd. However there is a problem as the ntpd can sometimes exit due to the following: once the clock has been set an error grater than 1000s will cause ntpd to exit anyway.

  3. Therefore edit ntp.conf and add tinker panic 0 line to it:
    # vi /etc/ntp.conf
    itinker panic 0[Enter][ESC]:w
    q
  4. By default eBox is configured to sync its time once when the network interface comes up using ntpdate. This can can cause racing with ntpd resulting in intermittent shutting down of ntpd. To get rid of this you can either uninstall ntpdate or add exit 0 as 2nd line to the startup configuration file:
    # vi /etc/network/if-up.d/ntpdate
    jiexit 0[Enter][ESC]:wq
  5. Now it time to check the date:
    # date
    Sometimes a time zone need to be set correctly. For setting the time zone to Central European Time (CET) please do the following:
    # ln -sf /usr/share/zoneinfo/CET /etc/localtime
    In case the time zone is still not correct:
    # apt-get install tzdata

After this you would never worry again about clock synchronization across controllers. IMHO this should be the default OpenRemote eBox configuration.