[Arm-dev] Customizing Chronyd for no battery

Sun Apr 23 18:11:23 UTC 2017
Robert Moskowitz <rgm at htt-consult.com>


On 04/22/2017 07:43 PM, Jim Perrin wrote:
>
> 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.

I did not like changing postfix.service, but I have not found how to 
modify the After= instructions through /etc/systemd/system.

Can you point me to instructions?  I looked at

/etc/systemd/system/multi-user.target.wants/postfix.service

And the change I made to /usr/lib/systemd/system/postfix.service carried 
over, and the timestamp in /etc/systemd did not change. Strange.

thanks

>
>> 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