[Arm-dev] Customizing Chronyd for no battery

Fri Apr 21 13:03:57 UTC 2017
Robert Moskowitz <rgm at htt-consult.com>

Fellow armv7-without-rtc-battery users.  Maybe you have already learned 
this, but I THINK I have completed my education on this thanks to 
Miroslav Lichvar on the Chrony list.

There are two issues here:  It takes time for chronyd to set the system 
time.  And if it fails to reach the ntp servers, well, it failed to set 
the time.

For the first, we need to delay some services from starting until 
chronyd is successful.  Postfix is one of them.  So we need the 
following commands:

systemctl enable chrony-wait
systemctl start chrony-wait
sed -i '/^After=/ s/$/ time-sync.target/w /dev/stdout' 
/usr/lib/systemd/system/postfix.service

There are some possible instances where you also want to do this to 
httpd.service, but I have been advised on the postfix list NOT to run 
postfix if the systemtime is earlier than the postfix build date

$ postconf -dh mail_release_date
20130622

Plus the postfix.service runs aliases.db which will mess up your 
aliases.db timestamp.

Next there is that pesky issue about what if no ntp servers reached?

First:

cat <<EOF>/etc/sysconfig/chronyd || exit 1
OPTIONS=" -s"
EOF

Since Centos7 has Chronyd 2.1.1, not 2.2, we have extra work to do in 
chronyd.conf:

cat <<EOF>>/etc/chrony.conf || exit 1
rtcdevice /dev/doesnotexist
EOF


I am adding this to my basic server howto page.