CHRONYC(1)

okay bestie, meet chronyc(1) โ€” the command-line interface for the chrony daemon. ๐Ÿ’…โœจ This is the manual, but make it make sense.

๐Ÿ’– NAME ๐Ÿ’–

chronyc โ€” command-line interface for chrony daemon ๐Ÿ•ฐ๏ธ๐Ÿ’ป

๐ŸŒธ SYNOPSIS ๐ŸŒธ

chronyc [OPTION]... [COMMAND]...

โœจ DESCRIPTION โœจ

chronyc is a command-line interface program, and itโ€™s literally your remote for chronyd: use it to monitor how chronyd is performing and to change various operating parameters while itโ€™s running. ๐Ÿ‘‘๐Ÿซถ

If no commands are specified on the command line, chronyc will expect input from the user. The prompt chronyc> will be displayed when it is being run from a terminal. If chronycโ€™s input or output are redirected from or to a file, the prompt will not be shown. ๐ŸŽ€

There are two ways chronyc can access chronyd. One is the Internet Protocol (IPv4 or IPv6) and the other is a Unix domain socket, which is accessible locally by the root or chrony user. By default, chronyc first tries to connect to the Unix domain socket. The compiled-in default path is /run/chrony/chronyd.sock. If that fails (e.g. because chronyc is running under a non-root user), it will try to connect to 127.0.0.1 and then ::1. ๐ŸŒˆ

Only the following monitoring commands, which do not affect the behaviour of chronyd, are allowed from the network by default: activity, manual list, rtcdata, smoothing, sourcename, sources, sourcestats, tracking, waitsync. The set of hosts from which chronyd will accept these commands can be configured with the cmdallow directive in the chronydโ€™s configuration file or the cmdallow command in chronyc. By default, the commands are accepted only from localhost (127.0.0.1 or ::1). ๐Ÿ”ฅ

Other monitoring commands can be enabled for network access by the opencommands directive. Monitoring commands with disabled network access and commands that affect the behaviour of chronyd are allowed only through the Unix domain socket. If they are sent over the network, chronyd will respond with a โ€˜Not authorisedโ€™ error, even if it is from localhost. ๐Ÿšซ๐Ÿ’€

Having full access to chronyd via chronyc is more or less equivalent to being able to modify the chronydโ€™s configuration file and restart it. So yeah โ€” main character energy, but with real consequences. ๐Ÿ‘‘๐Ÿ˜ญ

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -4 โ€” With this option hostnames will be resolved only to IPv4 addresses. ๐Ÿ’™
  • -6 โ€” With this option hostnames will be resolved only to IPv6 addresses. ๐Ÿ’œ
  • -n โ€” This option disables resolving of IP addresses to hostnames, e.g. to avoid slow DNS lookups. Long addresses will not be truncated to fit into the column. ๐Ÿš€
  • -N โ€” This option enables printing of original hostnames or IP addresses of NTP sources that were specified in the configuration file, or chronyc commands. Without the -n and -N option, the printed hostnames are obtained from reverse DNS lookups and can be different from the specified hostnames. ๐Ÿซถ
  • -c โ€” This option enables printing of reports in a comma-separated values (CSV) format. Reverse DNS lookups will be disabled, time will be printed as number of seconds since the epoch, and values in seconds will not be converted to other units. ๐Ÿ“Šโœจ
  • -e โ€” With this option each chronyc response will end with a line containing a single dot. ๐Ÿ”ด
  • -d โ€” This option enables printing of debugging messages if chronyc was compiled with debugging support. ๐Ÿ›
  • -m โ€” Normally, all arguments on the command line are interpreted as one command. With this option multiple commands can be specified. Each argument will be interpreted as a whole command. ๐Ÿงš
  • -h host โ€” This option specifies the host to be contacted by chronyc. It can be specified with a hostname, IP address, or path to the local Unix domain socket. Multiple values can be specified as a comma-separated list to provide a fallback. ๐ŸŒ

The default value is /run/chrony/chronyd.sock,127.0.0.1,::1, i.e. the host where chronyc is being run. First, it tries to connect to the Unix domain socket and if that fails (e.g. due to running under a non-root user), it will try to connect to 127.0.0.1 and then ::1. ๐Ÿ’ซ

  • -p port โ€” This option allows the user to specify the UDP port number which the target chronyd is using for its monitoring connections. This defaults to 323; there would rarely be a need to change this. ๐Ÿ”Œ
  • -u user โ€” This option sets the name of the user to which chronyc will switch when it is started under the root user in order to drop its privileges. chronyc will not try to change its identity if the option is set to root, or the effective user ID of the started process is not 0. The compiled-in default value is root. ๐Ÿ›ก๏ธ
  • -f file โ€” This option is ignored and is provided only for compatibility. ๐Ÿ™ˆ
  • -a โ€” This option is ignored and is provided only for compatibility. ๐Ÿ™ˆ
  • -w โ€” This option sets the output width to 94 columns, from the standard 80, for the commands authdata, clients, selectdata, sources, and sourcestats. ๐Ÿ“
  • -v, --version โ€” With this option chronyc displays its version number on the terminal and exits. ๐Ÿท๏ธ
  • --help โ€” With this option chronyc displays a help message on the terminal and exits. ๐Ÿ†˜

๐Ÿฆ‹ COMMANDS ๐Ÿฆ‹

This section describes each of the commands available within the chronyc program. ๐Ÿ’…

๐Ÿ•ฐ๏ธ System clock ๐Ÿ•ฐ๏ธ

tracking

The tracking command displays parameters about the systemโ€™s clock performance. An example of the output is shown below. ๐Ÿ‘‡

Reference ID    : CB00710F (ntp1.example.net)
Stratum         : 3
Ref time (UTC)  : Fri Jan 27 09:49:17 2017
System time     : 0.000006523 seconds slow of NTP time
Last offset     : -0.000006747 seconds
RMS offset      : 0.000035822 seconds
Frequency       : 3.225 ppm slow
Residual freq   : -0.000 ppm
Skew            : 0.129 ppm
Root delay      : 0.013639022 seconds
Root dispersion : 0.001100737 seconds
Update interval : 64.2 seconds
Leap status     : Normal

The fields are explained as follows: ๐Ÿง

Reference ID โ€” This is the reference ID and name (or IP address) of the server to which the computer is currently synchronised. For IPv4 addresses, the reference ID is equal to the address and for IPv6 addresses it is the first 32 bits of the MD5 sum of the address. ๐Ÿ†”

If the reference ID is 7F7F0101 and there is no name or IP address, it means the computer is not synchronised to any external source and that you have the local mode operating (via the local command in chronyc, or the local directive in the configuration file). ๐Ÿ 

The reference ID is printed as a hexadecimal number. Note that in older versions it used to be printed in quad-dotted notation and could be confused with an IPv4 address. โš ๏ธ

Stratum โ€” The stratum indicates how many hops away from a computer with an attached reference clock we are. Such a computer is a stratum-1 computer, so the computer in the example is two hops away (i.e. ntp1.example.net is a stratum-2 and is synchronised from a stratum-1). ๐Ÿชœ

Ref time โ€” This is the time (UTC) at which the last measurement from the reference source was processed. โฑ๏ธ

System time โ€” This is the current offset between the NTP clock and system clock. The NTP clock is a software (virtual) clock maintained by chronyd, which is synchronised to the configured time sources and provides time to NTP clients. The system clock is synchronised to the NTP clock. To avoid steps in the system time, which might have adverse consequences for certain applications, the system clock is normally corrected only by speeding up or slowing down (up to the rate configured by the maxslewrate directive). If the offset is too large, this correction will take a very long time. A step can be forced by the makestep command, or the makestep directive in the configuration file. ๐Ÿขโšก

Note that all other offsets reported by chronyc and most offsets in the log files are relative to the NTP clock, not the system clock. ๐Ÿ“

Last offset โ€” This is the estimated local offset on the last clock update. A positive value indicates the local time (as previously estimated true time) was ahead of the time sources. โž•

RMS offset โ€” This is a long-term average of the offset value. ๐Ÿ“ˆ

Frequency โ€” The โ€˜frequencyโ€™ is the rate by which the systemโ€™s clock would be wrong if chronyd was not correcting it. It is expressed in ppm (parts per million). For example, a value of 1 ppm would mean that when the systemโ€™s clock thinks it has advanced 1 second, it has actually advanced by 1.000001 seconds relative to true time. ๐ŸŽš๏ธ

Residual freq โ€” This shows the โ€˜residual frequencyโ€™ for the currently selected reference source. This reflects any difference between what the measurements from the reference source indicate the frequency should be and the frequency currently being used. ๐Ÿ”

The reason this is not always zero is that a smoothing procedure is applied to the frequency. Each time a measurement from the reference source is obtained and a new residual frequency computed, the estimated accuracy of this residual is compared with the estimated accuracy (see โ€˜skewโ€™ next) of the existing frequency value. A weighted average is computed for the new frequency, with weights depending on these accuracies. If the measurements from the reference source follow a consistent trend, the residual will be driven to zero over time. ๐Ÿง โœจ

Skew โ€” This is the estimated error bound on the frequency. ๐Ÿ“

Root delay โ€” This is the total of the network path delays to the stratum-1 computer from which the computer is ultimately synchronised. ๐Ÿ›ฐ๏ธ

Root dispersion โ€” This is the total dispersion accumulated through all the computers back to the stratum-1 computer from which the computer is ultimately synchronised. Dispersion is due to system clock resolution, statistical measurement variations, etc. ๐ŸŒซ๏ธ

An absolute bound on the computerโ€™s clock accuracy (assuming the stratum-1 computer is correct) is given by: ๐Ÿงฎ

clock_error <= |system_time_offset| + root_dispersion + (0.5 * root_delay)

Update interval โ€” This is the interval between the last two clock updates. ๐Ÿ”

Leap status โ€” This is the leap status, which can be Normal, Insert second, Delete second or Not synchronised. ๐Ÿฆ˜

๐ŸŒ€ makestep, makestep threshold limit

okay so normally chronyd fixes time offsets by slewing โ€” it slows down or speeds up the clock as needed. But sometimes the system clock is so far adrift that slewing would take absolutely forever to correct it. Thatโ€™s where makestep comes in, bestie.

There are two forms of the command:

  • First form, no params โ€” tells chronyd to cancel any remaining correction that was being slewed and jump the system clock by the equivalent amount, making it correct immediately.
  • Second form โ€” configures the automatic stepping, similarly to the makestep directive. It has two parameters: stepping threshold (in seconds) and the number of future clock updates for which the threshold will be active. You can use it with the burst command to quickly make a new measurement and correct the clock by stepping if needed, without waiting for chronyd to complete the measurement and update the clock.
makestep 0.1 1
burst 1/2
โš ๏ธ BE WARNED: Certain software will be seriously affected by such jumps in the system time. That is literally the reason why chronyd uses slewing normally. ๐Ÿ’€

๐Ÿ“ˆ maxupdateskew skew-in-ppm

This command has the same effect as the maxupdateskew directive in the configuration file. slay, same energy, different place. โœจ

โณ waitsync [max-tries [max-correction [max-skew [interval]]]]

The waitsync command waits for chronyd to synchronise. ๐Ÿซถ

Up to four optional arguments can be specified:

  • The first is the maximum number of tries before giving up and returning a non-zero error code. When 0 is specified, or there are no arguments, the number of tries will not be limited.
  • The second and third arguments are the maximum allowed remaining correction of the system clock and the maximum allowed skew (in ppm) as reported by the tracking command in the System time and Skew fields. If not specified or zero, the value will not be checked.
  • The fourth argument is the interval specified in seconds in which the check is repeated. The interval is 10 seconds by default.

An example is:

waitsync 60 0.01

which will wait up to about 10 minutes (60 times 10 seconds) for chronyd to synchronise to a source and the remaining correction to be less than 10 milliseconds. iconic behavior honestly. โญ


โฐ Time sources

๐Ÿ‘€ sources [-a] [-v]

This command displays information about the current time sources that chronyd is accessing.

  • -a โ€” all sources are displayed, including those that do not have a known address yet. Such sources have an identifier in the format ID#XXXXXXXXXX, which can be used in other commands expecting a source address.
  • -v โ€” enables a verbose output. In this case, extra caption lines are shown as a reminder of the meanings of the columns.
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#* GPS0                          0   4   377    11   -479ns[ -621ns] +/-  134ns
^? ntp1.example.net              2   6   377    23   -923us[ -924us] +/-   43ms
^+ ntp2.example.net              1   6   377    21  -2629us[-2619us] +/-   86ms

The columns are as follows:

  • M โ€” this indicates the mode of the source. ^ means a server, = means a peer and # indicates a locally connected reference clock.
  • S โ€” this column indicates the selection state of the source.
    • * indicates the best source which is currently selected for synchronisation.
    • + indicates other sources selected for synchronisation, which are combined with the best source.
    • - indicates a source which is considered to be selectable for synchronisation, but not currently selected.
    • x indicates a source which chronyd thinks is a falseticker (i.e. its time is inconsistent with a majority of other sources, or sources specified with the trust option).
    • ~ indicates a source whose time appears to have too much variability.
    • ? indicates a source which is not considered to be selectable for synchronisation for other reasons (e.g. unreachable, not synchronised, or does not have enough measurements).
  • Name/IP address โ€” this shows the name or the IP address of the source, or reference ID for reference clocks.
  • Stratum โ€” this shows the stratum of the source, as reported in its most recently received sample. Stratum 1 indicates a computer with a locally attached reference clock. A computer that is synchronised to a stratum 1 computer is at stratum 2. A computer that is synchronised to a stratum 2 computer is at stratum 3, and so on.
  • Poll โ€” this shows the rate at which the source is being polled, as a base-2 logarithm of the interval in seconds. Thus, a value of 6 would indicate that a measurement is being made every 64 seconds. chronyd automatically varies the polling rate in response to prevailing conditions.
  • Reach โ€” this shows the sourceโ€™s reachability register printed as an octal number. The register has 8 bits. It is shifted to left by one bit with each poll and it is updated by 1 when a valid NTP response, or just a sample in case of a reference clock, is received from the source. A value of 377 indicates that a valid response or sample was received for all of the last 8 polls. Note that samples can be dropped if they are not considered good enough for synchronisation, but the reachability register will still have 1s for their polls.
  • LastRx โ€” this column shows how long ago the last good sample (which is shown in the next column) was received from the source. Measurements that failed some tests are ignored. This is normally in seconds. The letters m, h, d or y indicate minutes, hours, days, or years.
  • Last sample โ€” this column shows the offset between the local clock and the source at the last measurement. The number in the square brackets shows the actual measured offset. This can be suffixed by ns (indicating nanoseconds), us (indicating microseconds), ms (indicating milliseconds), or s (indicating seconds). The number to the left of the square brackets shows the original measurement, adjusted to allow for any slews applied to the local clock since. Positive offsets indicate that the local clock is ahead of the source. The number following the +/- indicator shows the margin of error in the measurement (NTP root distance).

The selectdata command can be used to get more details about the selection state. iykyk ๐Ÿ’…

๐Ÿงฎ sourcestats [-a] [-v]

The sourcestats command displays information about the drift rate and offset estimation process for each of the sources currently being examined by chronyd.

  • -a โ€” all sources are displayed, including those that do not have a known address yet. Such sources have an identifier in the format ID#XXXXXXXXXX, which can be used in other commands expecting a source address.
  • -v โ€” enables a verbose output. In this case, extra caption lines are shown as a reminder of the meanings of the columns.

An example report is:

Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
===============================================================================
ntp1.example.net           11   5   46m     -0.001      0.045      1us    25us

The columns are as follows:

  • Name/IP Address โ€” this is the name or IP address of the NTP server (or peer) or reference ID of the reference clock to which the rest of the line relates.
  • NP โ€” this is the number of sample points currently being retained for the server. The drift rate and current offset are estimated by performing a linear regression through these points.
  • NR โ€” this is the number of runs of residuals having the same sign following the last regression. If this number starts to become too small relative to the number of samples, it indicates that a straight line is no longer a good fit to the data. If the number of runs is too low, chronyd discards older samples and re-runs the regression until the number of runs becomes acceptable.
  • Span โ€” this is the interval between the oldest and newest samples. If no unit is shown the value is in seconds. In the example, the interval is 46 minutes.
  • Frequency โ€” this is the estimated residual frequency for the server, in parts per million. In this case, the computerโ€™s clock is estimated to be running 1 part in 10^9 slow relative to the server.
  • Freq Skew โ€” this is the estimated error bounds on Freq (again in parts per million).
  • Offset โ€” this is the estimated offset of the source.
  • Std Dev โ€” this is the estimated sample standard deviation.

๐Ÿ” selectdata [-a] [-v]

The selectdata command displays information specific to the selection of time sources. If the -a option is specified, all sources are displayed, including those that do not have a known address yet. With the -v option, extra caption lines are shown as a reminder of the meanings of the columns.

An example of the output is shown below.

S Name/IP Address        Auth COpts EOpts Last Score     Interval  Leap
=======================================================================
D ntp1.example.net          Y ----- --TR-    4   1.0   -61ms   +62ms  N
* ntp2.example.net          N ----- -----    0   1.0 -6846us +7305us  N
+ ntp3.example.net          N ----- -----   10   1.0 -7381us +7355us  N

The columns are as follows:

  • S โ€” this column indicates the state of the source after the last source selection. It is similar to the state reported by the sources command, but more states are reported.

The following states indicate the source is not considered selectable for synchronisation:

  • N โ€” has the noselect option.
  • M โ€” does not have enough measurements. give it a sec bestie ๐Ÿ˜ญ
  • s โ€” is not synchronised.
  • r โ€” has a stratum outside of the allowed range (configured by the minstratum and maxstratum directives).
  • d โ€” has a root distance larger than the maximum distance (configured by the maxdistance directive).
  • ~ โ€” has a jitter larger than the maximum jitter (configured by the maxjitter directive).
  • w โ€” waits for other sources to get out of the M state.
  • S โ€” has only measurements older than reachable sources, or is unreachable for too many polls (configured by the maxunreach option).
  • O โ€” has a stratum equal or larger than the orphan stratum (configured by the local directive).
  • T โ€” does not fully agree with sources that have the trust option.
  • x โ€” does not agree with other sources (falseticker).

The following states mean the source is considered selectable, it's just not the one running the clock rn:

  • W โ€” waits for other sources to be selectable (required by the minsources directive, or the require option of another source).
  • P โ€” another selectable source is preferred due to the prefer option.
  • U โ€” waits for a new measurement (this happens after selecting a different best source).
  • D โ€” has, or recently had, a root distance which is too large to be combined with other sources (configured by the combinelimit directive).

And these states mean the source is actively used for synchronisation of the local clock, slay:

  • + โ€” combined with the best source.
  • * โ€” selected as the best source to update the reference data (e.g. root delay, root dispersion). main character energy ๐Ÿ‘‘

Name/IP address

This column shows the name or IP address of the source if it's an NTP server, or the reference ID if it's a reference clock.

Auth

This column indicates whether an authentication mechanism is enabled for the source. Y means yes and N means no.

COpts

This column displays the configured selection options of the source:

  • N indicates the noselect option.
  • P indicates the prefer option.
  • T indicates the trust option.
  • R indicates the require option.

EOpts

This column displays the current effective selection options of the source โ€” which can be different from the configured options, thanks to the authentication selection mode (configured by the authselectmode directive). The symbols are the same ones as in the COpts column, so you already know them ๐Ÿ’…

Last

This column displays how long ago the last measurement of the source was made when the selection was performed.

Score

This column displays the current score against the source in the * state. The scoring system avoids frequent reselection when multiple sources have a similar root distance. A value larger than 1 indicates this source was better than the * source in recent selections. If the score reaches 10, the best source will be reselected and the scores will be reset to 1. no cap, that's the whole algorithm ๐ŸŽ€

Interval

This column displays the lower and upper endpoint of the interval which was expected to contain the true offset of the local clock, considering the root distance at the time of the selection.

Leap

This column displays the current leap status of the source:

  • N indicates the normal status (no leap second).
  • + indicates that a leap second will be inserted at the end of the month.
  • - indicates that a leap second will be deleted at the end of the month.
  • ? indicates the unknown status (i.e. no valid measurement was made).

selectopts address|refid [+|-option]...

The selectopts command modifies the configured selection options of an NTP source specified by IP address (or the ID#XXXXXXXXXX identifier used for unknown addresses), or a reference clock specified by reference ID as a string.

You can add selection options with the + symbol or remove them with the - symbol. The selectdata command is your bestie for verifying the configuration afterwards. The modified options will be applied in the next source selection, e.g. when a new measurement is made, or when the reselect command is executed.

Here's what using this command looks like, iconic behaviour honestly:

selectopts 1.2.3.4 -noselect +prefer
selectopts GPS +trust

reselect

To avoid excessive switching between sources, chronyd can stay synchronised to a source even when it's not currently the best one among the available sources. loyalty ๐Ÿ’–

The reselect command can be used to force chronyd to reselect the best synchronisation source.

reselectdist distance

The reselectdist command sets the reselection distance. It's equivalent to the reselectdist directive in the configuration file.

offset address|refid offset

The offset command modifies the offset correction of an NTP source specified by IP address (or the ID#XXXXXXXXXX identifier used for unknown addresses), or a reference clock specified by reference ID as a string. It's equivalent to the offset option in the server or refclock directive respectively.


๐Ÿ›ฐ๏ธ NTP sources ๐Ÿ›ฐ๏ธ

activity

This command reports the number of servers and peers that are online and offline. If the auto_offline option is used in specifying some of the servers or peers, the activity command can be useful for detecting when all of them have entered the offline state after the network link has been disconnected. v handy, lowkey ๐Ÿซถ

The report shows the number of servers and peers in 5 states:

  • online โ€” the server or peer is currently online (i.e. assumed by chronyd to be reachable).
  • offline โ€” the server or peer is currently offline (i.e. assumed by chronyd to be unreachable, and no measurements from it will be attempted.)
  • burst_online โ€” a burst command has been initiated for the server or peer and is being performed; after the burst is complete, the server or peer will be returned to the online state.
  • burst_offline โ€” a burst command has been initiated for the server or peer and is being performed; after the burst is complete, the server or peer will be returned to the offline state.
  • unresolved โ€” the name of the server or peer was not resolved to an address yet; this source is not visible in the sources and sourcestats reports. it's giving "we don't know her yet" ๐Ÿ™ˆ

authdata [-a]

The authdata command displays information specific to authentication of NTP sources. If the -a option is specified, all sources are displayed, including those that do not have a known address yet. Here's an example of the output:

Name/IP address             Mode KeyID Type KLen Last Atmp  NAK Cook CLen
=========================================================================
ntp1.example.net             NTS     1   15  256 135m    0    0    8  100
ntp2.example.net              SK    30   13  128    -    0    0    0    0
ntp3.example.net               -     0    0    0    -    0    0    0    0

The columns are as follows:

Name/IP address

This column shows the name or the IP address of the source.

Mode

This column shows which mechanism authenticates NTP packets received from the source. NTS means Network Time Security, SK means a symmetric key, and - means authentication is disabled.

KeyID

This column shows an identifier of the key used for authentication. With a symmetric key, it's the ID from the key file. With NTS, it's a number starting at zero and incremented by one with each successful key establishment using the NTS-KE protocol, i.e. it shows how many times the key establishment was performed with this source.

Type

This column shows an identifier of the algorithm used for authentication. With a symmetric key, it's the hash function or cipher specified in the key file. With NTS, it's an authenticated encryption with associated data (AEAD) algorithm, which is negotiated in the NTS-KE protocol. The following values can be reported:

  • 1: MD5
  • 2: SHA1
  • 3: SHA256
  • 4: SHA384
  • 5: SHA512
  • 6: SHA3-224
  • 7: SHA3-256
  • 8: SHA3-384
  • 9: SHA3-512
  • 10: TIGER
  • 11: WHIRLPOOL
  • 13: AES128
  • 14: AES256
  • 15: AEAD-AES-SIV-CMAC-256
  • 30: AEAD-AES-128-GCM-SIV

KLen

This column shows the length of the key in bits.

Last

This column shows how long ago the last successful key establishment was performed. It's in seconds, or the letters m, h, d or y indicate minutes, hours, days, or years.

Atmp

This column shows the number of attempts to perform the key establishment since the last successful key establishment. A number larger than 1 indicates a problem with the network or server. ๐Ÿ’€

NAK

This column shows whether an NTS NAK was received since the last request. A NAK indicates that authentication failed on the server side due to chronyd using a cookie which is no longer valid, and that it needs to perform the key establishment again in order to get new cookies.

Cook

This column shows the number of NTS cookies that chronyd currently has. If the key establishment was successful, a number smaller than 8 indicates a problem with the network or server. ๐Ÿช not the fun kind of cookies, unfortunately

CLen

This column shows the length in bytes of the NTS cookie which will be used in the next request.

ntpdata [address]

The ntpdata command displays the last valid measurement and other NTP-specific information about the specified NTP source, or all NTP sources (with a known address) if no address was specified. An example of the output is shown below. ๐Ÿ‘‡

okay bestie, so those lines above are literally just the vibe check of one source's measurement history โ€” here's what each of them actually means, no gatekeeping: ๐Ÿ’…

  • Remote address โ€” the IP address of the NTP server or peer, plus the corresponding reference ID.
  • Remote port โ€” the UDP port number the request got sent to. Standard NTP port is 123.
  • Local address โ€” the local IP address that received the response, plus the corresponding reference ID.
  • Leap status, Version, Mode, Stratum, Poll interval, Precision, Root delay, Root dispersion, Reference ID, Reference time โ€” all the NTP values from the last valid response. Yes, all of them, one bullet, they're a package deal. ๐ŸŽ€
  • Offset, Peer delay, Peer dispersion โ€” the measured values.
  • Response time โ€” the time the server or peer spent processing the request and waiting before it sent the response back.
  • Jitter asymmetry โ€” the estimated asymmetry of network jitter on the path to the source. It can be between -0.5 and 0.5. A negative value means the delay of packets sent to the source is more variable than the delay of packets sent from the source back. ๐Ÿ˜ญ
  • NTP tests โ€” results of RFC 5905 tests 1 through 3, 5 through 7, and the tests for maximum delay, delay ratio, delay dev ratio (or delay quantile), and synchronisation loop.
  • Interleaved โ€” shows whether the response was in interleaved mode.
  • Authenticated โ€” shows whether the response was authenticated.
  • TX timestamping โ€” the source of the local transmit timestamp. Valid values are Daemon, Kernel, and Hardware.
  • RX timestamping โ€” the source of the local receive timestamp.
  • Total TX โ€” the number of packets sent to the source.
  • Total RX โ€” the number of all packets received from the source.
  • Total valid RX โ€” the number of packets that passed the first two groups of NTP tests.
  • Total good RX โ€” the number of packets that passed all three groups of NTP tests, i.e. the NTP measurement was accepted. ๐Ÿ‘‘
  • Total kernel TX โ€” the number of packets sent to the source for which a timestamp was captured by the kernel.
  • Total kernel RX โ€” the number of packets received from the source for which a timestamp was captured by the kernel.
  • Total HW TX โ€” the number of packets sent to the source for which a timestamp was captured by the NIC.
  • Total HW RX โ€” the number of packets received from the source for which a timestamp was captured by the NIC.

๐Ÿฆ‹ add peer name [option]...

The add peer command lets you add a brand-new NTP peer while chronyd is literally already running. no restart, no drama, we love to see it ๐Ÿ’–

Once you're past the words add peer, the syntax of the parameters and options is identical to that for the peer directive in the configuration file.

An example of using this command is shown below.

add peer ntp1.example.net minpoll 6 maxpoll 10 key 25

๐ŸŒธ add pool name [option]...

The add pool command lets you add a whole pool of NTP servers while chronyd is running.

Once you're past the words add pool, the syntax of the parameters and options is identical to that for the pool directive in the configuration file.

An example of using this command is shown below:

add pool ntp1.example.net maxsources 3 iburst

โœจ add server name [option]...

The add server command lets you add a new NTP server while chronyd is running.

Once you're past the words add server, the syntax of the parameters and options is identical to that for the server directive in the configuration file.

An example of using this command is shown below:

add server ntp1.example.net minpoll 6 maxpoll 10 key 25

๐ŸŽ€ delete address

The delete command lets an NTP server or peer be removed from the current set of sources. bye bestie, your measurements are no longer needed ๐Ÿ‘‹

๐Ÿซถ burst good/max [mask/masked-address], burst good/max [masked-address/masked-bits], burst good/max [address]

The burst command tells chronyd to make a set of measurements to each of its NTP sources over a short duration, instead of the usual periodic measurements it makes. After such a burst, chronyd will revert to the previous state for each source. That might be either online, if the source was being periodically measured in the normal way, or offline, if the source had been indicated as being offline. (A source can be switched between the online and offline states with the online and offline commands.)

The mask and masked-address arguments are optional โ€” if you leave them out, chronyd will initiate a burst for all of its currently defined sources. group chat, everyone gets pinged ๐Ÿ“ฃ

The arguments have the following meaning and format:

  • good โ€” this defines the number of good measurements that chronyd will want to obtain from each source. A measurement is good if it passes certain tests โ€” for example, the round trip time to the source must be acceptable. (This lets chronyd reject measurements that are likely to be bogus.)
  • max โ€” this defines the maximum number of measurements that chronyd will attempt to make, even if the required number of good measurements has not been obtained.
  • mask โ€” this is an IP address with which the IP address of each of chronyd's sources is to be masked.
  • masked-address โ€” this is an IP address. If the masked IP address of a source matches this value, then the burst command is applied to that source.
  • masked-bits โ€” this can be used with masked-address for CIDR notation, which is a shorter alternative to the form with mask.
  • address โ€” this is an IP address or a hostname. The burst command is applied only to that source.

If no mask or masked-address arguments are provided, every source will be matched.

An example of the two-argument form of the command is:

burst 2/10

This will cause chronyd to attempt to get two good measurements from each source, stopping after two have been obtained, but in no event will it try more than ten probes to the source. ten attempts max, we're respectful of everyone's bandwidth ๐Ÿ”ฅ

Examples of the four-argument form of the command are:

burst 2/10 255.255.0.0/1.2.0.0
burst 2/10 2001:db8:789a::/48

In the first case, the two out of ten sampling will only be applied to sources whose IPv4 addresses are of the form 1.2.x.y, where x and y are arbitrary. In the second case, the sampling will be applied to sources whose IPv6 addresses have the first 48 bits equal to 2001:db8:789a.

Example of the three-argument form of the command is:

burst 2/10 ntp1.example.net

๐Ÿ’œ maxdelay address delay

This allows the maxdelay option for one of the sources to be modified, in the same way as specifying the maxdelay option for the server directive in the configuration file.

๐ŸŒˆ maxdelaydevratio address ratio

This allows the maxdelaydevratio option for one of the sources to be modified, in the same way as specifying the maxdelaydevratio option for the server directive in the configuration file.

โญ maxdelayratio address ratio

This allows the maxdelayratio option for one of the sources to be modified, in the same way as specifying the maxdelayratio option for the server directive in the configuration file.

๐Ÿ’€ maxpoll address maxpoll

The maxpoll command is used to modify the maximum polling interval for one of the current set of sources. It's equivalent to the maxpoll option in the server directive in the configuration file.

heads up bestie โ€” the new maximum polling interval only takes effect after the next measurement has been made. it is not an instant glow-up, it is a "after the next measurement" glow-up ๐Ÿ™ˆ

๐Ÿ“ minpoll address minpoll

The minpoll command is used to modify the minimum polling interval for one of the current set of sources. It's equivalent to the minpoll option in the server directive in the configuration file.

same energy as above ngl โ€” the new minimum polling interval only takes effect after the next measurement has been made. ๐Ÿ’…

๐Ÿงš minstratum address minstratum

The minstratum command is used to modify the minimum stratum for one of the current set of sources. It's equivalent to the minstratum option in the server directive in the configuration file.


๐ŸŽ€ offline [address], offline [masked-address/masked-bits], offline [mask/masked-address]

The offline command is used to warn chronyd that the network connection to a particular host or hosts is about to be lost โ€” think computers with intermittent connection to their time sources. consider this your formal two-weeks-notice text message ๐Ÿ˜ญ

Another case where offline could be used is where a computer serves time to a local group of computers, and has a permanent connection to true time servers outside the organisation. However, the external connection is heavily loaded at certain times of the day, and the measurements obtained are less reliable at those times. In this case, it's probably most useful to determine the gain or loss rate during the quiet periods and let the whole network coast through the loaded periods. The offline and online commands can be used to achieve this. iconic strategy honestly, let it coast ๐Ÿฆ‹

...okay so quick recap of what we were doing ๐Ÿ’… the offline command actually comes in four different flavors, and honestly each one is a vibe:

  • the first form is just a wildcard, meaning all sources โ€” and yes, that includes sources that don't even have a known address yet ๐Ÿ‘€
  • the second form lets you give an IP address mask plus a masked address
  • the third form is CIDR notation, classic
  • the fourth form is a plain IP address or a hostname

Here's how those look in the wild:

offline
offline 255.255.255.0/1.2.3.0
offline 2001:db8:789a::/48
offline ntp1.example.net

So what do they actually mean? The second form = "apply this to any source whose IPv4 address lives in the 1.2.3 subnet." The way it works is the host's address gets logically and-ed with the mask, and if that result matches the masked-address, the host gets processed ๐Ÿซถ. The third form = "apply to every source whose IPv6 address has its first 48 bits equal to 2001:db8:789a." And the fourth form? That one's shy โ€” it applies to only that single source, no cap.

And lowkey the wildcard form of the address is literally equivalent to this:

offline 0.0.0.0/0.0.0.0
offline ::/0

๐ŸŒˆ online ๐ŸŒˆ

online [address], online [masked-address/masked-bits], online [mask/masked-address]

The online command is the exact opposite energy of offline โ€” it's the "we're so back" of commands ๐Ÿ”ฅ. You use it to tell chronyd that network connectivity to a particular source (or a whole bunch of sources) has been restored.

The syntax is identical to offline, so no new rules to learn, slay โœจ.

๐Ÿฆ‹ onoffline ๐Ÿฆ‹

The onoffline command tells chronyd to switch all sources that have a known address over to online or offline status, according to whatever the current network configuration is. A source counts as online if it's actually possible to send requests to it โ€” i.e. there's a network route to that source present. Simple as ๐Ÿ’….

๐ŸŽ€ polltarget address polltarget ๐ŸŽ€

The polltarget command changes the poll target for one of your current sources. It's equivalent to the polltarget option in the server directive in the configuration file โ€” same thing, just done live, no restarts needed ๐Ÿ’–.

โญ refresh โญ

The refresh command forces chronyd to resolve the names of your configured NTP sources to IP addresses again, and replace any addresses that are missing from the list of resolved addresses. Iconic little refresh button behaviour ngl.

Heads up though โ€” sources that stop responding get replaced with newly resolved addresses automatically after 8 polling intervals. This command is for when you want them replaced immediately, like after you suspend and resume the machine on a totally different network ๐Ÿ™ˆ.

โš ๏ธ one caveat bestie: with pools that have more than 16 addresses, or where not all IPv4 or IPv6 addresses are included in a single DNS response (e.g. pool.ntp.org), this command might replace addresses even if they're still in the pool. It's giving "not me replacing perfectly good addresses" ๐Ÿ˜ญ

๐Ÿ“ reload sources ๐Ÿ“

The reload sources command makes chronyd re-read all *.sources files from the directories specified by the sourcedir directive. Fresh files, fresh me โœจ.

โš ๏ธ but fr fr, note that modified sources (like ones specified with a new option) are not modified in memory โ€” they get removed and added again, which means they lose all their old measurements and their selection state gets reset ๐Ÿ˜ญ so don't be surprised by that.

๐Ÿงš sourcename address ๐Ÿงš

The sourcename command prints the original hostname or address that was specified for an NTP source โ€” either in the configuration file or via the add command. It's an alternative to the -N option, and it's genuinely so useful in scripts ๐Ÿ‘‘

๐Ÿ’œ note that different NTP sources can share the same name, e.g. servers from a pool. So don't come for it when you see repeats.

๐Ÿ•ฐ๏ธ Manual time input ๐Ÿ•ฐ๏ธ

๐ŸŒธ manual on, manual off, manual delete index, manual list, manual reset ๐ŸŒธ

The manual command enables and disables use of the settime command, and modifies the behaviour of the manual clock driver. Let's break it down:

  • the on form enables use of the settime command
  • the off form disables use of the settime command
  • the list form lists all the samples currently stored in chronyd ๐Ÿ‘€

The list output looks like this:

210 n_samples = 1
#    Date  Time(UTC)    Slewed   Original   Residual
====================================================
 0 27Jan99 22:09:20       0.00       0.97       0.00

And the columns mean:

  1. The sample index (which you use for the manual delete command).
  2. The date and time of the sample.
  3. The system clock error when the timestamp was entered, adjusted to allow for changes made to the system clock since.
  4. The system clock error when the timestamp was entered, as it originally was (without allowing for changes to the system clock since).
  5. The regression residual at this point, in seconds. This one lets you spot 'outliers' super easily so you can yeet them with the manual delete command ๐Ÿ—‘๏ธ

The delete form deletes a single sample, and the parameter is the index of that sample โ€” the same number you see in the first column of the manual list output. After the data point is deleted, the current error and drift rate get re-estimated from the remaining data points, and the system clock is trimmed if necessary. Basically this option exists so you can discard 'outliers' โ€” like when the admin realises they typed in a genuinely terrible timestamp ๐Ÿ˜ญ we've all been there.

The reset form deletes all the samples at once. The system clock is left running exactly as it was before you entered the command, no drama ๐Ÿ’….

๐Ÿ’€ settime time ๐Ÿ’€

The settime command lets you enter the current time manually โ€” but only if this option has been configured into chronyd. (It can be configured either with the manual directive in the configuration file, or with the manual command of chronyc.)

โš ๏ธ real talk: your computer's sense of time will only be as accurate as the reference you're using to provide this input (e.g. your watch), plus how well you can time the press of the return key. So like... accuracy is giving "best effort" ๐Ÿ˜ญ

The good news: if your computer's time zone is set up properly, you can enter a local time (rather than UTC). And the response to a successful settime command tells you how much the computer's clock was wrong โ€” so if you entered the time wrongly (say, wrong time zone), it should be super apparent from that ๐Ÿ™ˆ.

Here's the drift tea โ˜•: the rate of drift of the system clock is estimated by a regression process using the entered measurement and all previous measurements entered during the present run of chronyd. However, the entered measurement is used for adjusting the current clock offset (rather than the estimated intercept from the regression, which gets ignored). Contrast that with the manual delete command, where the intercept is used to set the current offset (since there's no measurement that was just entered in that case). Subtle but important, iykyk ๐Ÿ‘‘

Also: the time is parsed by the public domain getdate algorithm, so consequently you can only specify time to the nearest second. No milliseconds for you bestie ๐ŸŽ€.

Valid inputs look like this:

settime 16:30
settime 16:30:05
settime Nov 21, 2015 16:30:05

For a full description of getdate, go read the getdate documentation (it's bundled, for example, with the source for GNU tar) ๐Ÿซถ.


๐Ÿ” NTP access ๐Ÿ”

๐Ÿฆ‹ accheck address ๐Ÿฆ‹

This command checks whether client NTP access is allowed from a particular host. So handy for a vibe check on your access rules โœจ.

Examples of use, showing a named host and numeric IP addresses:

accheck ntp1.example.net
accheck 1.2.3.4
accheck 2001:db8::1

You can use this to examine the effect of a whole series of allow, allow all, deny, and deny all commands โ€” whether they were specified via chronyc, or in chronyd's configuration file. Detective mode: activated ๐Ÿ”

๐Ÿ‘‘ clients [-p packets] [-k] [-r] ๐Ÿ‘‘

This command shows a list of clients that have accessed the server โ€” through the NTP, command, or NTS-KE port. It does not include accesses over the Unix domain command socket, so don't @ me about that ๐Ÿ’….

The options:

  • -p โ€” specifies the minimum number of received NTP or command packets, or accepted NTS-KE connections, needed to include a client in the list. Default value is 0, i.e. all clients get reported.
  • -k โ€” the last four columns will show the NTS-KE accesses instead of command accesses.
  • -r โ€” chronyd will reset the counters of received and dropped packets or connections after reporting the current values. Fresh start energy ๐Ÿงผ

An example of the output:

Hostname                      NTP   Drop Int IntL Last     Cmd   Drop Int  Last
===============================================================================
localhost                       2      0   2   -   133      15      0  -1     7
ntp1.example.net               12      0   6   -    23       0      0   -     -

Each row = the data for a single host. Only hosts that have passed the host access checks (set with the allow, deny, cmdallow and cmddeny commands or configuration file directives) actually get logged. The intervals are displayed as a power of 2 in seconds, cute โœจ.

The columns are:

  1. The hostname of the client.
  2. The number of NTP packets received from the client.
  3. The number of NTP packets dropped to limit the response rate.
  4. The average interval between NTP packets.
  5. The average interval between NTP packets after limiting the response rate.
  6. Time since the last NTP packet was received.
  7. The number of command packets or NTS-KE connections received/accepted from the client.
  8. The number of command packets or NTS-KE connections dropped to limit the response rate.
  9. The average interval between command packets or NTS-KE connections.
  10. Time since the last command packet or NTS-KE connection was received/accepted.

๐ŸŒˆ serverstats ๐ŸŒˆ

The serverstats command displays NTP and command server statistics โ€” a full little glow-up report of your server's numbers ๐Ÿ’–.

An example of the output:

NTP packets received       : 1598
NTP packets dropped        : 8
Command packets received   : 19
Command packets dropped    : 0
Client log records dropped : 0
NTS-KE connections accepted: 3
NTS-KE connections dropped : 0
Authenticated NTP packets  : 189
Interleaved NTP packets    : 43
NTP timestamps held        : 44
NTP timestamp span         : 120
NTP daemon RX timestamps   : 0
NTP daemon TX timestamps   : 1537
NTP kernel RX timestamps   : 1590
NTP kernel TX timestamps   : 43
NTP hardware RX timestamps : 0
NTP hardware TX timestamps : 0

okay so those fields have the following meaning, bestie ๐Ÿต:

  • NTP packets received โ€” how many valid NTP requests the server got. ๐Ÿ’–
  • NTP packets dropped โ€” how many NTP requests the server dropped because of rate limiting (set by the ratelimit directive).
  • Command packets received โ€” how many command requests the server got.
  • Command packets dropped โ€” how many command requests the server dropped because of rate limiting (set by the cmdratelimit directive).
  • Client log records dropped โ€” how many client log records the server dropped to limit memory use (set by the clientloglimit directive).
  • NTS-KE connections accepted โ€” how many NTS-KE connections the server accepted.
  • NTS-KE connections dropped โ€” how many NTS-KE connections the server dropped because of rate limiting (set by the ntsratelimit directive).
  • Authenticated NTP packets โ€” how many received NTP requests were authenticated (with a symmetric key or NTS).
  • Interleaved NTP packets โ€” how many received NTP requests were detected to be in the interleaved mode.
  • NTP timestamps held โ€” how many pairs of receive and transmit timestamps the server is currently holding in memory for clients using the interleaved mode.
  • NTP timestamp span โ€” the interval (in seconds) covered by the currently held NTP timestamps.
  • NTP daemon RX timestamps โ€” how many NTP responses included a receive timestamp captured by the daemon.
  • NTP daemon TX timestamps โ€” how many NTP responses included a transmit timestamp captured by the daemon.
  • NTP kernel RX timestamps โ€” how many NTP responses included a receive timestamp captured by the kernel.
  • NTP kernel TX timestamps โ€” how many NTP responses (in the interleaved mode) included a transmit timestamp captured by the kernel.
  • NTP hardware RX timestamps โ€” how many NTP responses included a receive timestamp captured by the NIC.
  • NTP hardware TX timestamps โ€” how many NTP responses (in the interleaved mode) included a transmit timestamp captured by the NIC.

allow [all] [subnet]

The effect of allow is literally identical to the allow directive in the configuration file. โœจ

The syntax is giving very much:

allow 1.2.3.4
allow all 3.4.5.0/24
allow 2001:db8:789a::/48
allow 0/0
allow ::/0
allow
allow all

deny [all] [subnet]

Same effect as the deny directive in the configuration file. (The source text says โ€œallow commandโ€ here โ€” iconic little typo โ€” but it's the deny directive, bestie.) ๐Ÿซถ

The syntax is illustrated like this:

deny 1.2.3.4
deny all 3.4.5.0/24
deny 2001:db8:789a::/48
deny 0/0
deny ::/0
deny
deny all

local [option]..., local off

The local command lets chronyd be told that it's supposed to appear as a reference source, even if it is not itself properly synchronised to an external source. This is useful on isolated networks, so a computer can be the primary time server for other computers. ๐Ÿ‘‘

The first form enables the local reference mode on the host. The syntax is identical to the local directive in the configuration file.

The second form disables the local reference mode.

smoothing

The smoothing command displays the current state of the NTP server time smoothing, which can be enabled with the smoothtime directive. An example of the output is shown below. ๐ŸŒธ

Active         : Yes
Offset         : +1.000268817 seconds
Frequency      : -0.142859 ppm
Wander         : -0.010000 ppm per second
Last update    : 17.8 seconds ago
Remaining time : 19988.4 seconds

The fields are explained as follows:

  • Active โ€” shows if the server time smoothing is currently active. Possible values are Yes and No. If the leaponly option is included in the smoothtime directive, (leap second only) will be shown on the line.
  • Offset โ€” the current offset applied to the time sent to NTP clients. A positive value means the clients are getting time that's ahead of true time.
  • Frequency โ€” the current frequency offset of the served time. A negative value means the time observed by clients is running slower than true time.
  • Wander โ€” the current frequency wander of the served time. A negative value means the time observed by clients is slowing down.
  • Last update โ€” how long ago the time smoothing process was updated, e.g. chronyd accumulated a new measurement.
  • Remaining time โ€” the time it would take for the smoothing process to get to zero offset and frequency if there were no more updates.

smoothtime activate, smoothtime reset

The smoothtime command can be used to activate or reset the server time smoothing process if it is configured with the smoothtime directive. ๐Ÿ’…

Monitoring access

cmdaccheck address

This command is similar to the accheck command, except that it's used to check whether monitoring access is permitted from a named host.

Examples of use are as follows:

cmdaccheck ntp1.example.net
cmdaccheck 1.2.3.4
cmdaccheck 2001:db8::1

cmdallow [all] [subnet]

This is similar to the allow command, except that it's used to allow particular hosts or subnets to use chronyc to monitor with chronyd on the current host. ๐ŸŽ€

cmddeny [all] [subnet]

This is similar to the deny command, except that it is used to allow particular hosts or subnets to use chronyc to monitor chronyd on the current host. (Yep, the source says โ€œallowโ€ right there โ€” we're keeping that exact chaotic energy. ๐Ÿ™ˆ)

Real-time clock (RTC)

rtcdata

The rtcdata command displays the current RTC parameters.

An example output is shown below. โญ

RTC ref time (GMT) : Sat May 30 07:25:56 2015
Number of samples  : 10
Number of runs     : 5
Sample span period :  549
RTC is fast by     :    -1.632736 seconds
RTC gains time at  :  -107.623 ppm

The fields have the following meaning:

  • RTC ref time (GMT) โ€” the RTC reading the last time its error was measured.
  • Number of samples โ€” the number of previous measurements being used to determine the RTC gain or loss rate.
  • Number of runs โ€” the number of runs of residuals of the same sign following the regression fit for (RTC error) versus (RTC time). A value which is small indicates that the measurements are not well approximated by a linear model, and that the algorithm will tend to delete the older measurements to improve the fit.
  • Sample span period โ€” the period that the measurements span (from the oldest to the newest). Without a unit the value is in seconds; suffixes m for minutes, h for hours, d for days or y for years can be used.
  • RTC is fast by โ€” the estimate of how many seconds fast the RTC was when it thought the time was at the reference time (above). If this value is large, you might (or might not) want to use the trimrtc command to bring the RTC into line with the system clock. (Note, a large error will not affect chronyd's operation, unless it becomes so big as to start causing rounding errors.)
  • RTC gains time at โ€” the amount of time gained (positive) or lost (negative) by the real time clock for each second that it ticks. It is measured in parts per million. So if the value shown was +1, suppose the RTC was exactly right when it crosses a particular second boundary. Then it would be 1 microsecond fast when it crosses its next second boundary.

trimrtc

The trimrtc command is used to correct the system's real-time clock (RTC) to the main system clock. It has no effect if the error between the two clocks is currently estimated at less than a second. โฐ

The command takes no arguments. It performs the following steps (if the RTC is more than 1 second away from the system clock):

  1. Remember the currently estimated gain or loss rate of the RTC and flush the previous measurements.
  2. Step the real-time clock to bring it within a second of the system clock.
  3. Make several measurements to accurately determine the new offset between the RTC and the system clock (i.e. the remaining fraction of a second error).
  4. Save the RTC parameters to the RTC file (specified with the rtcfile directive in the configuration file).

The last step is done as a precaution against the computer suffering a power failure before either the daemon exits or the writertc command is issued.

chronyd will still work perfectly well both whilst operating and across machine reboots even if the trimrtc command is never used (and the RTC is allowed to drift away from true time). The trimrtc command is provided as a method by which it can be corrected, in a manner compatible with chronyd using it to maintain accurate time across machine reboots.

The trimrtc command can be executed automatically by chronyd with the rtcautotrim directive in the configuration file. ๐Ÿ”ฅ

writertc

The writertc command writes the currently estimated error and gain or loss rate parameters for the RTC to the RTC file (specified with the rtcfile directive). This information is also written automatically when chronyd is killed (by the SIGHUP, SIGINT, SIGQUIT or SIGTERM signals) or when the trimrtc command is issued. ๐Ÿ’พ

Other daemon commands

cyclelogs

The cyclelogs command causes all of chronyd's open log files to be closed and re-opened. This allows them to be renamed so that they can be periodically purged. An example of how to do this is shown below. ๐Ÿงš

# mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
# chronyc cyclelogs
# rm /var/log/chrony/measurements1.log

okay so bestie, one lil heads-up before we get into the next commands ๐Ÿซถ โ€” the log files that get enabled by the log directive? they're opened when the first entry is made. and the message log file that chronyd's -l option names gets opened early on start, and it's closed on the cyclelogs command only if opening of the new file succeeds โ€” all so you don't lose messages, periodt. one more thing: if chronyd is configured to drop root privileges and the directory containing the log file is not writable for the specified user, chronyd will not be able to open the file again. ๐Ÿ˜ญ noted.

  • dump โ€” this one makes chronyd write its current history of measurements for each of its sources to dump files, in the directory specified in the configuration file by the dumpdir directive โœจ and it also writes server NTS keys and client NTS cookies to the directory specified by the ntsdumpdir directive. lowkey important: chronyd does this automatically when it exits anyway, so this command is mainly useful for inspection whilst chronyd is running ๐Ÿ‘€
  • rekey โ€” causes chronyd to re-read the key file specified in the configuration file by the keyfile directive. it also re-reads the server NTS keys if ntsdumpdir is specified and automatic rotation is disabled in the configuration file ๐Ÿ”‘
  • reset sources โ€” causes chronyd to drop all measurements and switch to the unsynchronised state. this is the glow-up-reset command ๐Ÿ’… it can help chronyd with recovery when the measurements are known to be no longer valid or accurate, e.g. due to moving the computer to a different network, or resuming the computer from a low-power state (which resets the system clock). chronyd will drop the measurements automatically when it detects the clock has made an unexpected jump, but ngl the detection is not completely reliable ๐Ÿ™ˆ
  • shutdown โ€” causes chronyd to exit. this is equivalent to sending the process the SIGTERM signal ๐Ÿ’€

๐ŸŒธ Client commands ๐ŸŒธ

dns option

the dns command configures how hostnames and IP addresses are resolved in chronyc. IP addresses can be resolved to hostnames when printing results of sources, sourcestats, tracking and clients commands โœจ and hostnames are resolved in commands that take an address as argument.

there are five options, bestie, five:

  • dns -n โ€” disables resolving IP addresses to hostnames. raw IP addresses will be displayed.
  • dns +n โ€” enables resolving IP addresses to hostnames. this is the default unless chronyc was started with the -n option.
  • dns -4 โ€” resolves hostnames only to IPv4 addresses.
  • dns -6 โ€” resolves hostnames only to IPv6 addresses.
  • dns -46 โ€” resolves hostnames to both address families. this is the default behaviour unless chronyc was started with the -4 or -6 option.

timeout timeout

the timeout command sets the initial timeout for chronyc requests in milliseconds. if no response is received from chronyd, the timeout is doubled and the request is resent ๐Ÿ” the maximum number of retries is configured with the retries command.

by default, the timeout is 1000 milliseconds.

retries retries

the retries command sets the maximum number of retries for chronyc requests before giving up. the response timeout is controlled by the timeout command.

the default is 2.

keygen [id [type [bits]]]

the keygen command generates a key that can be added to the key file (specified with the keyfile directive) to allow NTP authentication between server and client, or peers ๐ŸŽ€ the key is generated from the /dev/urandom device and it is printed to standard output.

the command has three optional arguments:

  1. the key number (by default 1), which will be specified with the key option of the server or peer directives in the configuration file.
  2. the name of the hash function or cipher (by default SHA1, or MD5 if SHA1 is not available).
  3. the length of the key in bits if a hash function was selected, between 80 and 4096 bits (by default 160 bits).

an example is:

keygen 73 SHA1 256

which generates a 256-bit SHA1 key with number 73 ๐Ÿ”ฅ the printed line should then be securely transferred and added to the key files on both server and client, or peers. a different key should be generated for each client or peer โ€” no sharing, bestie, that's not the vibe ๐Ÿ’…

an example using the AES128 cipher is:

keygen 151 AES128

exit, quit

the exit and quit commands exit from chronyc and return the user to the shell ๐Ÿ‘‹

help

the help command displays a summary of the commands and their arguments. iconic, honestly โ€” the main character energy of commands ๐ŸŒˆ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

chrony.conf(5), chronyd(8)


๐Ÿ’€ BUGS ๐Ÿ’€

for instructions on how to report bugs, please visit https://chrony-project.org/. go off, tell them everything ๐Ÿซถ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

chrony was written by Richard Curnow, Miroslav Lichvar, and others. legends, fr fr ๐Ÿ’–


and that's a wrap on the whole page, bestie!! โœจ this was chrony version 4.9, dated 2026-08-27, and honestly? ate. ๐ŸŽ€๐Ÿ’…๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from