chiark / gitweb /
time-wait-sync: use watchfile to coordinate with timesyncd
authorPeter A. Bigot <pab@pabigot.com>
Mon, 9 Apr 2018 18:39:16 +0000 (13:39 -0500)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
Systems that have an accurate real-time clock may have an initial
unsynchronized time that is close enough to the synchronized time that
the final adjustment doesn't trigger a waking "clock set" event.  Have
timesyncd touch a file in its runtime directory as a secondary signal
for synchronization.  Continue to support the timerfd-based trigger as a
sufficient condition when the watchfile is not present.

Closes issue #8683

man/elogind-time-wait-sync.service.xml

index 559379b2e566dd491f07e5c9ecf20a440f7e7959..b3e158ce61c5344bdc73c1449fa9dbe7c1ae2ace 100644 (file)
     <title>Description</title>
 
     <para><filename>elogind-time-wait-sync</filename> is a system service that delays the start of units that depend on
-    <filename>time-sync.target</filename> until <filename>elogind-timesyncd.service</filename> or something else has
-    set the system time and marked it as synchronized.  Reaching this state generally requires synchronization with an
-    external source, such as an NTP server.</para>
+    <filename>time-sync.target</filename> until the system time has been synchronized with an accurate time source by
+    <filename>elogind-timesyncd.service</filename>.</para>
 
-    <para>When this unit is not enabled the <filename>time-sync.target</filename> synchronization point may be reached
-    as soon as the system time is advanced by <filename>elogind-timesyncd.service</filename> to the time stored at the
-    last shutdown.  That time may not meet the expectations of dependent services that require an accurate
-    clock.</para>
+    <para><filename>elogind-timesyncd.service</filename> notifies on successful synchronization.
+    <filename>elogind-time-wait-sync</filename> also tries to detect when the kernel marks the time as synchronized,
+    but this detection is not reliable and is intended only as a fallback for other servies that can be used to
+    synchronize time (e.g., ntpd, chronyd).</para>
 
   </refsect1>
 
   <refsect1>
-    <title>Notes</title>
+    <title>Files</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><filename>/run/systemd/timesync/synchronized</filename></term>
+
+        <listitem>
+          <para>The presence of this file indicates to this service that the system clock has been synchronized.</para>
+        </listitem>
+
+      </varlistentry>
+    </variablelist>
 
-    <para>This service works correctly with a time synchronization service like
-    <filename>elogind-timesyncd.service</filename> that uses the same protocol as NTP to set the time from a
-    synchronized source.  When used with time synchronization services that follow a different protocol the event of
-    setting synchronized time may not be detected in which case this service will not complete.</para>
   </refsect1>
 
   <refsect1>