Skip to main content

org.osbuild.chrony

Configure chrony to set system time from the network.

Configures chrony by modifying /etc/chrony.conf. Before new values are added to the chrony configuration, all lines starting with "server", "pool" or "peer" are removed. The 'timeservers' option provides a very high-level way of configuring chronyd with specific timeservers. Its value is a list of strings representing the hostname or IP address of the timeserver. For each list item, the following line will be added to the configuration: server \<HOSTNAME/IP\> iburst The 'servers' option provides a direct mapping to the server directive from chrony configuration. Its value is a list of dictionaries representing each timeserver which should be added to the configuration. For each list item, a server directive will be added the configuration. Currently supported subset of options which can be specified for each timeserver item:

  • 'hostname' (REQUIRED)
  • 'minpoll'
  • 'maxpoll'
  • 'iburst' (defaults to true)
  • 'prefer' (defaults to false)

The leapsectz option configures chrony behavior related to automatic checking of the next occurrence of the leap second, using the provided timezone. Its value is a string representing a timezone from the system tz database (e.g. 'right/UTC'). If an empty string is provided, then all occurrences of leapsectz directive are removed from the configuration.

The refclock directive can be used to specify one or more hardware reference clocks to be used as a time source.

Schema 1

{
"additionalProperties": false,
"minProperties": 1,
"properties": {
"timeservers": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of NTP server addresses."
},
"servers": {
"type": "array",
"items": {
"additionalProperties": false,
"type": "object",
"required": [
"hostname"
],
"properties": {
"hostname": {
"type": "string",
"description": "Hostname or IP address of a NTP server."
},
"minpoll": {
"type": "integer",
"description": "Specifies the minimum interval between requests sent to the server as a power of 2 in seconds.",
"minimum": -6,
"maximum": 24
},
"maxpoll": {
"type": "integer",
"description": "Specifies the maximum interval between requests sent to the server as a power of 2 in seconds.",
"minimum": -6,
"maximum": 24
},
"iburst": {
"type": "boolean",
"default": true,
"description": "Configures chronyd behavior related to burst requests on startup."
},
"prefer": {
"type": "boolean",
"default": false,
"description": "Prefer this source over sources without the prefer option."
}
}
}
},
"leapsectz": {
"type": "string",
"description": "Timezone used by chronyd to determine when will the next leap second occur. Empty value will remove the option."
},
"refclocks": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"driver"
],
"properties": {
"driver": {
"oneOf": [
{
"$ref": "#/definitions/PPS"
},
{
"$ref": "#/definitions/SHM"
},
{
"$ref": "#/definitions/SOCK"
},
{
"$ref": "#/definitions/PHC"
}
]
},
"poll": {
"type": "integer",
"description": "Specifies the interval between processing times of timestamps as a power of 2 in seconds."
},
"dpoll": {
"type": "integer",
"description": "Some drivers do not listen for external events and try to produce samples in their own polling interval. This is defined as a power of 2 and can be negative to specify a sub-second interval. The default is 0 (1 second)."
},
"offset": {
"type": "number",
"description": "This option can be used to compensate for a constant error. The default is 0.0."
}
}
}
}
},
"definitions": {
"PPS": {
"description": "Driver for the kernel PPS (pulse per second) API.",
"type": "object",
"required": [
"name",
"device"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"PPS"
]
},
"device": {
"type": "string",
"description": "Path to the PPS device (typically /dev/pps?).",
"pattern": "^\\/(?!\\.\\.)((?!\\/\\.\\.\\/).)+$"
},
"clear": {
"type": "boolean",
"description": "By default, the PPS refclock uses assert events (rising edge) for synchronisation. With this option, it will use clear events (falling edge) instead."
}
}
},
"SHM": {
"description": "NTP shared memory driver.",
"type": "object",
"required": [
"name",
"segment"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"SHM"
]
},
"segment": {
"type": "integer",
"description": "The number of the shared memory segment."
},
"perm": {
"type": "string",
"pattern": "^[0-7]{4}$",
"description": "This option specifies the permissions of the shared memory segment created by chronyd. They are specified as a numeric mode. The default value is 0600 (read-write access for owner only)."
}
}
},
"SOCK": {
"description": "Unix domain socket driver.",
"type": "object",
"required": [
"name",
"path"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"SOCK"
]
},
"path": {
"type": "string",
"pattern": "^\\/(?!\\.\\.)((?!\\/\\.\\.\\/).)+$",
"description": "The path to the socket."
}
}
},
"PHC": {
"description": "Unix domain socket driver.",
"type": "object",
"required": [
"name",
"path"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"enum": [
"PHC"
]
},
"path": {
"type": "string",
"pattern": "^\\/(?!\\.\\.)((?!\\/\\.\\.\\/).)+$",
"description": "The path to the device of the PTP clock to be used as a time source."
},
"nocrossts": {
"type": "boolean",
"description": "Disable use of precise cross timestamping."
},
"extpps": {
"type": "boolean",
"description": "Enable a PPS mode in which the PTP clock is timestamping pulses of an external PPS signal connected to the clock."
},
"pin": {
"type": "integer",
"description": "The index of the pin for the PPS mode. The default value is 0."
},
"channel": {
"type": "integer",
"description": "The index of the channel for the PPS mode. The default value is 0."
},
"clear": {
"type": "boolean",
"description": "This option enables timestamping of clear events (falling edge) instead of assert events (rising edge) in the PPS mode. This may not work with some clocks."
}
}
}
}
}

Schema 2

{}