| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-timesyncd.service" conditional='ENABLE_TIMESYNCD' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-timesyncd.service</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-timesyncd.service</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-timesyncd.service</refname> |
| 21 |
<refname>systemd-timesyncd</refname> |
| 22 |
<refpurpose>Network Time Synchronization</refpurpose> |
| 23 |
</refnamediv> |
| 24 |
|
| 25 |
<refsynopsisdiv> |
| 26 |
<para><filename>systemd-timesyncd.service</filename></para> |
| 27 |
<para><filename>/usr/lib/systemd/systemd-timesyncd</filename></para> |
| 28 |
</refsynopsisdiv> |
| 29 |
|
| 30 |
<refsect1> |
| 31 |
<title>Description</title> |
| 32 |
|
| 33 |
<para><filename>systemd-timesyncd.service</filename> is a system service that may be used to synchronize |
| 34 |
the local system clock with a remote Network Time Protocol (NTP) server. It also saves the local time to |
| 35 |
disk every time the clock has been synchronized and uses this to possibly advance the system realtime |
| 36 |
clock on subsequent reboots to ensure it (roughly) monotonically advances even if the system lacks a |
| 37 |
battery-buffered RTC chip.</para> |
| 38 |
|
| 39 |
<para>The <filename>systemd-timesyncd.service</filename> service implements SNTP only. This minimalistic |
| 40 |
service will step the system clock for large offsets or slowly adjust it for smaller deltas. Complex use |
| 41 |
cases that require full NTP support (and where SNTP is not sufficient) are not covered by |
| 42 |
<filename>systemd-timesyncd.service</filename>.</para> |
| 43 |
|
| 44 |
<para>The NTP servers contacted are determined from the global settings in |
| 45 |
<citerefentry><refentrytitle>timesyncd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, the |
| 46 |
per-link static settings in <filename>.network</filename> files, and the per-link dynamic settings |
| 47 |
received over DHCP. See |
| 48 |
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> for |
| 49 |
further details.</para> |
| 50 |
|
| 51 |
<para><citerefentry><refentrytitle>timedatectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s |
| 52 |
<command>set-ntp</command> command may be used to enable and start, or disable and stop this |
| 53 |
service.</para> |
| 54 |
|
| 55 |
<para><citerefentry><refentrytitle>timedatectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s |
| 56 |
<command>timesync-status</command> or <command>show-timesync</command> command can be used to show the |
| 57 |
current status of this service.</para> |
| 58 |
|
| 59 |
<para>Initialization of <filename>systemd-timesyncd.service</filename> delays the start of units that are |
| 60 |
ordered after <filename>time-set.target</filename> (see |
| 61 |
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry> for |
| 62 |
details) until the local time has been updated from <filename>/var/lib/systemd/timesync/clock</filename> |
| 63 |
(see below) in order to make it roughly monotonic. It does not delay other units until synchronization |
| 64 |
with an accurate reference time sources has been reached. Use |
| 65 |
<citerefentry><refentrytitle>systemd-time-wait-sync.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 66 |
to achieve that, which will delay start of units that are ordered after |
| 67 |
<filename>time-sync.target</filename> until synchronization to an accurate reference clock is |
| 68 |
reached.</para> |
| 69 |
|
| 70 |
<para><command>systemd</command> and <command>systemd-timesyncd</command> advance the system clock to |
| 71 |
the "epoch" (the lowest date above which the system clock time is assumed to be set correctly). See |
| 72 |
"System clock epoch" section in |
| 73 |
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> for details. |
| 74 |
<command>systemd</command> will set the clock when initializing, but |
| 75 |
<filename>/var/lib/systemd/timesync/clock</filename> might not yet be available at that point. |
| 76 |
<command>systemd-timesyncd</command> will advance the clock when it is started and notices that the |
| 77 |
system clock is before the modification time of <filename>/var/lib/systemd/timesync/clock</filename>. |
| 78 |
</para> |
| 79 |
</refsect1> |
| 80 |
|
| 81 |
<refsect1> |
| 82 |
<title>Files</title> |
| 83 |
|
| 84 |
<variablelist> |
| 85 |
<varlistentry> |
| 86 |
<term><filename>/var/lib/systemd/timesync/clock</filename></term> |
| 87 |
|
| 88 |
<listitem> |
| 89 |
<para>The modification time ("mtime") of this file is updated on each successful NTP |
| 90 |
synchronization or after each <varname>SaveIntervalSec=</varname> time interval, as specified in |
| 91 |
<citerefentry><refentrytitle>timesyncd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 92 |
</para> |
| 93 |
|
| 94 |
<para>If present, the modification time of this file is used for the epoch by |
| 95 |
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> and |
| 96 |
<filename>systemd-timesyncd.service</filename>.</para> |
| 97 |
|
| 98 |
<xi:include href="version-info.xml" xpointer="v219"/> |
| 99 |
</listitem> |
| 100 |
</varlistentry> |
| 101 |
|
| 102 |
<varlistentry> |
| 103 |
<term><filename>/run/systemd/timesync/synchronized</filename></term> |
| 104 |
|
| 105 |
<listitem> |
| 106 |
<para>A file that is touched on each successful synchronization to assist |
| 107 |
<citerefentry><refentrytitle>systemd-time-wait-sync.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 108 |
service and other applications in detecting synchronization to an accurate reference clock.</para> |
| 109 |
|
| 110 |
<xi:include href="version-info.xml" xpointer="v239"/> |
| 111 |
</listitem> |
| 112 |
|
| 113 |
</varlistentry> |
| 114 |
</variablelist> |
| 115 |
</refsect1> |
| 116 |
|
| 117 |
<refsect1> |
| 118 |
<title>See Also</title> |
| 119 |
<para><simplelist type="inline"> |
| 120 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 121 |
<member><citerefentry><refentrytitle>timesyncd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 122 |
<member><citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 123 |
<member><citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 124 |
<member><citerefentry><refentrytitle>systemd-time-wait-sync.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 125 |
<member><citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 126 |
<member><citerefentry><refentrytitle>timedatectl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 127 |
<member><citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 128 |
<member><citerefentry project='man-pages'><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 129 |
</simplelist></para> |
| 130 |
</refsect1> |
| 131 |
|
| 132 |
</refentry> |