Re: [chrony-users] Chrony.conf for RPI3 that loses power and doesn't have the internet

[ Thread Index | Date Index | More Archives ]

William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ unruh@xxxxxxxxxxxxxx
Canada V6T 1Z1 ____|____ and Gravity ______|_

On Fri, 4 Jan 2019, Catherine Newman wrote:

Thanks very much Miroslav & Robert - I find the little things just help so much!
A few follow ups:
      - I'm running: Raspbian Stretch Lite 4.14 (based on Debian Stretch) and Chrony 3.4-1 with
      the Adafruit PiRTC - PCF8523

      - Yes, the RPI & RTC dates are way off ... so, 

Does the RTC not remember its time when power goes off? If it does not then it
is pretty useless, since the only purpose of an RTC is transmit the true time
through poweroffs. Ie, it needs an internal battery. If you mean that the RTC is always way off, then you can use the chronyc
command writertc to write the system time to the rtc, using that command only
when you are sure that the system time is good.

            - How do I ensure that 'chronyd is started with the -s option'
            programmatically? (my RPI will just reboot when power is restored and I am
            not around for that)

I do not know how Raspberian Stretch sets up its init routines, systemd or
systemV. Something has to start chronyd. Just make sure it has the -s flag.
/etc/init.d/chrony for example, or /lib/systemd/system/chronyd.service . Both
have command which start up chronyd.


On Fri, Jan 4, 2019 at 1:23 AM Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
      On Thu, Jan 03, 2019 at 05:56:36PM -0800, Catherine Newman wrote:
      > I have enabled chrony and disabled systemd-timesyncd.service. Using rtcfile
      > works well when I reboot the RPI from the command line but when I do a hard
      > powercycle (abruptly unplug it and then plug it back in) both the system
      > time and the RTC time are funky (and not the same).

      Are they completely different, or just off by a whole number of hours?
      The former would indicate the kernel is not setting the system time
      from the RTC. chronyd -s should take care of that.

      > What directives can I play with / what chrony.conf might you recommend for
      > me to take my timekeeping to the next level? and hopefully give me the
      > robust timekeeping I so desire out in the field.

      I think a recommended configuration would look something like this:

      1) chronyd started with the -s option
      2) rtcfile and driftfile specified in chrony.conf
      3) rtcdevice specified in chrony.conf if /dev/rtc doesn't point to the
         right RTC
      4) "chronyc writertc" called few minutes after chronyd is started and
         has synchronized the clock (e.g. using chronyc waitsync) and then
         called periodically using a cron job (e.g. few times per day) to
         keep the rtcfile up to date in case the power is lost

      If that doesn't work well, it would help to see your config files,
      chronyd messages in the system log, and the chronyd's tracking and rtc

      Miroslav Lichvar

      To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
      with "unsubscribe" in the subject.
      For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
      with "help" in the subject.
      Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.

Mail converted by MHonArc 2.6.19+