[arch-general] Systemd and time synchronisation problems

mike cloaked mike.cloaked at gmail.com
Tue Sep 11 17:22:32 EDT 2012


On Tue, Sep 11, 2012 at 8:06 PM, mike cloaked <mike.cloaked at gmail.com> wrote:
> On Tue, Sep 11, 2012 at 7:51 PM, Jan Steffens <jan.steffens at gmail.com> wrote:
>> On Tue, Sep 11, 2012 at 8:27 PM, Thomas Bächler <thomas at archlinux.org> wrote:
>>> 2) When chrony is not running, systemd-timedated runs periodically to
>>> adjust the hardware clock for drift (AFAIK, not sure that is the job
>>> that timedated does).
>>
>> No. When chrony isn't running, the hwclock isn't getting adjusted at
>> all. The only thing systemd does on startup is warp the system clock
>> if and only if the RTC is running in localtime.
>>
>> systemd-timedated's job is to provide a DBus interface to change
>> system time and date settings:
>>   SetTime, SetTimezone, SetLocalRTC (whether RTC is in localtime),
>> SetNTP (whether NTP is enabled)
>> It's used by gnome-control-center, at least. The SetNTP call uses the
>> ntp-units.d directory to select an implementation.
>
> Thank you for all the information - it seems that the key to this was
> that the RTC was too far out from correct time at boot - now that I
> manually set the RTC to correct time it comes up close to correct -
> and then chrony synchronises a few minutes after startup.  At present
> tracking shows it is about 0.1 microsecs from NTP time:
> System time     : 0.000000106 seconds fast of NTP time
>
> What  I don't understand is why the hardware clock was not re-written
> with the correctly synchronised time previously, since chrony has been
> running every time I booted the system for ages?


By the way I also found another way to write the hardware clock from
within chrony which does not need the chronyd daemon to be stopped
(after spending this evening reading the detailed chrony docs!)  that
you can run chronyc in a terminal, and then enter "password
mypasswordforchrony"  (where the argument is the password from the
chrony keys file) and then issue the "trimrtc" command once the chrony
password has been accepted - this will then write the current system
time to the RTC, only sensible if time has been synchronised - though
the RTC is only accurate to within a second or so I believe.

I guess it would be nice to have more complete information on the
archwiki though there is full documentation on the chrony main web
page.

-- 
mike c


More information about the arch-general mailing list