[Arm-dev] Customizing Chronyd for no battery

Sat Apr 22 23:43:11 UTC 2017
Jim Perrin <jperrin at centos.org>


On 04/21/2017 06:03 AM, Robert Moskowitz wrote:
> 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
> 

You're not going to want to do this here. Because systemd has a concept
of overrides, administrator modifications should go in
/etc/systemd/system, rather than directly modifying /usr/lib/systemd/*
files. This will keep your changes across updates.

> 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.
> 
> 
> _______________________________________________
> Arm-dev mailing list
> Arm-dev at centos.org
> https://lists.centos.org/mailman/listinfo/arm-dev

-- 
Jim Perrin
The CentOS Project | http://www.centos.org
twitter: @BitIntegrity | GPG Key: FA09AD77