Add a time synchronization page - #514
Conversation
| measured offset to step to. Add time sources to `/etc/chrony.conf` first: | ||
|
|
||
| ``` | ||
| server 0.centos.pool.ntp.org iburst |
There was a problem hiding this comment.
| server 0.centos.pool.ntp.org iburst | |
| server 2.pool.ntp.org iburst |
I think it's preferable to not use centos vendor zone. since XCP-ng is a different vendor.
I think it's acceptable for users to use a public pool, as suggested at:
FYI xcpng vendor zone is still pending (for months):
There was a problem hiding this comment.
Taken, and thanks for the links. The vendor zone was not ours to use and I had not thought about it at all. Switched to the generic pool.
Worth someone chasing xcp-ng-rpms/chrony#1 so there is an XCP-ng zone to point at eventually, but this page should not wait on that.
The NTP content this PR added to hosts-pools duplicated the dedicated page in xcp-ng#514, which is what was actually asked for in review. The branch is now stacked on that page instead of carrying a second copy. hosts-pools keeps its short NTP section and links to the page. The yum troubleshooting entry links to the correcting-a-wrong-clock section rather than to the hosts-pools anchor. The note about reverting the repo file is a warning rather than a tip: the page tells the reader to edit it as a diagnostic, so leaving it edited is a state the page created, and it silently costs mirror failover. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
The NTP content this PR added to hosts-pools duplicated the dedicated page in xcp-ng#514, which is what was actually asked for in review. The branch is now stacked on that page instead of carrying a second copy. hosts-pools keeps its short NTP section and links to the page. The yum troubleshooting entry links to the correcting-a-wrong-clock section rather than to the hosts-pools anchor. The note about reverting the repo file is a warning rather than a tip: the page tells the reader to edit it as a diagnostic, so leaving it edited is a state the page created, and it silently costs mirror failover. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Wrong clocks cause failures across the product that rarely name the clock: TLS validation against the mirrors when fetching updates, pool join, and certificate validity windows. NTP was documented only in passing, in the installer walkthrough, the answer file reference and the pool requirements. Gather it into one page: why the date matters, how to set the sources at install time and afterwards, how to check them, and how to correct a clock that is already wrong. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
Review suggestions from @thomas-dkmt on the intro, the TLS bullet, rtcsync, the installer step, the source states, makestep, the isolated-network prose and the pool paragraph. The source states and the recovery procedure become lists rather than running prose. @rzr: the sample configuration used the CentOS vendor zone, which is not ours to use. It now points at the generic public pool. The code blocks inside the numbered procedure are indented under their items, so it renders as one list rather than restarting at each fence. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
f817306 to
630a4ba
Compare
The NTP content this PR added to hosts-pools duplicated the dedicated page in xcp-ng#514, which is what was actually asked for in review. The branch is now stacked on that page instead of carrying a second copy. hosts-pools keeps its short NTP section and links to the page. The yum troubleshooting entry links to the correcting-a-wrong-clock section rather than to the hosts-pools anchor. The note about reverting the repo file is a warning rather than a tip: the page tells the reader to edit it as a diagnostic, so leaving it edited is a state the page created, and it silently costs mirror failover. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
…state rzr asked for the expected output next to the failure case. Taking it off an 8.3 host rather than composing it turned up a gap in the legend: it listed *, + and ?, but a normal four-source listing is mostly -, which was not described anywhere. A reader comparing the prose to their own output had nothing to match it against. Adds the healthy systemctl and chronyc sources output, the - state, and the first MS character for the source type. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
stormi
left a comment
There was a problem hiding this comment.
As I regularly repeat, conventional commits is not a convention to apply to this repository.
|
|
||
| ### During installation | ||
|
|
||
| At step 11, the installer prompts you to enter the time, select a time zone and either |
There was a problem hiding this comment.
A reference to a numbered step in another page won't age well.
There was a problem hiding this comment.
I dropped the number. It now reads that the installer prompts for the time, the time zone, and either NTP servers or a manual time, and links to the install page without pointing to a position in it.
| server's certificate against the host's own date. If the host's clock is set too far in the | ||
| past, the TLS handshake fails because, from the host's perspective, the mirror's certificate | ||
| is not yet valid. The error `yum` prints in that situation does not mention time. | ||
| - **Pool membership.** A host joining a pool must have its clock synchronized with the pool |
There was a problem hiding this comment.
I think this would be worth expanding on. Same time when joining is necessary, but we also want it not to drift later, as this can cause subtle synchronization issues, and I'm not sure it's entirely covered by the next bullet point about certificates (which are used by hosts to authenticate to each other, notably).
There was a problem hiding this comment.
I expanded it. The bullet now covers staying synchronized as well as joining, and says why the second is the harder one to catch: a failed join tells you what is wrong; drift afterwards does not. It surfaces as hosts disagreeing about when things happened, each convinced by its own clock.
I kept it separate from the certificates bullet, since that is a different mechanism, and folded the old Pools section into this bullet as well, per your comment further down.
|
|
||
| :::warning | ||
| If you set the time manually at this step, the host can end up with `chronyd` running but no | ||
| time source configured at all. It will keep whatever date it was installed with. See |
There was a problem hiding this comment.
"It will keep whatever date it was installed with." might need rewording, as it may let some think that the date will not increment every day.
There was a problem hiding this comment.
Also, "it" seems ambiguous to me, in that sentence.
There was a problem hiding this comment.
I reworded it, and "it" is gone. It now says the clock still ticks, but nothing ever checks it, so it drifts from the date you typed, and if that date was wrong, it stays wrong.
Testing another of your comments turned up a reason to say more here: this is the one case that does not fix itself at boot. A host with sources gets stepped back into line within seconds of chronyd starting, so no sources at all is what makes this state persist. The warning says that now.
| time source configured at all. It will keep whatever date it was installed with. See | ||
| [Checking the time sources](#checking-the-time-sources) below. | ||
| ::: | ||
|
|
||
| ### During an automated installation | ||
|
|
||
| The installation answer file accepts one or more NTP servers through the `<ntp-server>` | ||
| element. See [Answer file](../../appendix/answerfile). | ||
|
|
||
| ### On an installed host | ||
|
|
||
| You can configure NTP from `xsconsole`, or by editing `/etc/chrony.conf` directly and |
There was a problem hiding this comment.
This should be of last resort if no other way works, such as xsconsole, xe or Xen Orchestra (does it support setting up NTP?).
There was a problem hiding this comment.
I changed it. xsconsole is the documented route now, and editing the file by hand is marked as a last resort in both places it appeared.
Regarding your question, I could be wrong, but I think XO does not configure NTP on hosts. xoa network ntp sets the time servers of the XOA appliance, which is a Debian VM keeping its own clock through systemd-timesyncd, and the NTP field in the deployment form does the same for the appliance being deployed:
@xen-orchestra/lite/src/pages/xoa-deploy.vue:447
xapi.call('VM.add_to_xenstore_data', [vmRef.value, 'vm-data/ntp', ntp.value])
I grepped a clone of the tree rather than trusting a code search. Every hit outside docs/ is that one locale string repeated per language plus the form using it, and chrony appears nowhere. 🤷
The page now states the distinction, because appliance NTP and host NTP are easy to conflate.
| ^* vps1.websters-computers.> 2 7 377 59 -361us[ -444us] +/- 8522us | ||
| ^+ meshflow.net 3 9 377 118 +203us[ +122us] +/- 12ms | ||
| ^+ mail.rapidooo.fr 2 9 377 113 -1029us[-1110us] +/- 9934us | ||
| ^- 88-185-213-3.subs.proxad> 3 8 377 506 +688us[ +491us] +/- 49ms |
There was a problem hiding this comment.
Suggestion: I'd replace the server names with placeholders, so that no one starts wondering why their results differ from the example.
There was a problem hiding this comment.
Done: ntp1.example.net through ntp4.example.net.
One tension worth naming: @rzr asked earlier for the real expected output, and this trades against that a little.
I kept every column value real and changed only the names, so the shape someone compares against is still a genuine listing. 🤷
I'm happy to put the real hostnames back if you would rather.
| ### If sources are listed | ||
|
|
||
| Correct the clock and check the result: | ||
|
|
||
| ```bash | ||
| chronyc makestep | ||
| date | ||
| ``` | ||
|
|
||
| `chronyc makestep` is what does the work here. By default, chrony corrects time offsets by | ||
| gradually slewing the system clock, which never converges for an offset of months or years. |
There was a problem hiding this comment.
I'm not sure about this. Either the service is healthy and this is unneeded, or it's the service that needs to be fixed, isn't it? Manually setting the clock once doesn't look like a long term solution and may just postpone the actual resolution by weeks or months.
I think it could be mentioned as an emergency fix, but not as a solution. And to add steps to go towards an actual solution (re-run xsconsole? check chronyd logs?).
It can also be useful as a one time check: "is chronyc able to fetch the date?", but I think it should be included in a higher level resolution process.
Unless I'm mistaken, it's XAPI that manages chronyc (worth verifying though), so the resolution could be at several layers:
- configuration layer (no sources configured, user mistake initially)
- XAPI layer (xsconsole being a XAPI client)
- chronyd service
- network, firewall (I don't see the later mentioned, but I would be surprised if that isn't a common cause).
Btw, I'm pretty sure Vates' support team would have interesting input on this.
There was a problem hiding this comment.
Testing your other comment showed that a host with reachable sources does not usually have a wrong clock at all: stock config has makestep 1.0 3, and a 45-day offset was corrected within ten seconds of chronyd starting. So a clock that is still wrong is evidence that something upstream is broken, and stepping it by hand mostly hides that. 🤔
Restructured along the layers you listed, working outward:
- Any sources at all,
chronyc sources, withxsconsoleto add them. - Sources reachable. Everything stuck at
?is configured but unanswered, so UDP 123 and the firewall get named here, along with the no-route-to-the-pool case. - Daemon health:
systemctl status chronydandjournalctl -u chronyd. - Configuration changed underneath you, which
rpm -V chronywill show.
Stepping the clock is its own short section now, described as a stopgap that buys time for the diagnosis rather than ending it, including the detail that it reports success while moving nothing when there are no sources.
One correction on XAPI managing chronyc, since you flagged it as worth verifying: /etc/chrony.conf is owned by the chrony package, and nothing under /opt/xensource writes it.
xsconsole is an XAPI client that edits the file and restarts the daemon, which comes to the same thing for a user, but it does mean rpm -V chrony reports its edits as local modifications.
On the support team, I have not asked them. Their ordering of these layers would be better than mine, since they see which one actually turns out to be the cause.
| server 0.pool.ntp.org iburst | ||
| server 1.pool.ntp.org iburst | ||
| server 2.pool.ntp.org iburst | ||
| server 3.pool.ntp.org iburst |
There was a problem hiding this comment.
again, editing the configuration file directly should be last resort.
There was a problem hiding this comment.
Same change as above, applied here too. Both places now put xsconsole first and mark editing the file by hand as a last resort.
| If `date` is wrong again after every power cycle, the motherboard's RTC battery is probably | ||
| dead and should be replaced. `rtcsync` can only keep the hardware clock in step while the | ||
| host is running; it cannot help a clock that loses its value when the power goes. |
There was a problem hiding this comment.
What consequences does it have? Doesn't chronyd fix the date shortly after initial startup? Does it cause problems at startup that do not self-heal?
There was a problem hiding this comment.
Yes, chronyd fixes it quickly, as long as it has a source.
The stock /etc/chrony.conf carries makestep 1.0 3, so for the first three updates after the service starts, it jumps the clock instead of easing it into place. I stopped chronyd, put the clock 45 days into the past, and started it again:
skew 2026-07-03T12:17:41Z chronyd started
t+05s 2026-07-03 still wrong
t+10s 2026-08-17T12:17:46Z corrected
Under ten seconds for 45 days. The page claimed chrony only slews and so never converges for offsets of months or years, which is true once those three updates are spent and wrong at startup. Fixed, and it changes the shape of the page: a host with sources heals itself, so the manual correction is for the daemon that has been up a while, or the host that never had a source at all.
What does not self-heal is Number of sources = 0, since makestep needs something to measure against. That is now said where the manual-time-at-install warning is.
There was a problem hiding this comment.
If
dateis wrong again after every power cycle
This part implies, to me, that we you get a wrong date again after every power cycle DESPITE ntp, and I don't see how that is possible thanks to makestep, unless there's a problem with the ntp configuration which must then be fixed and the battery then doesn't matter. Or does it?
It's still unclear to me what the problem is if you have a dead battery, outside the fact that the clock needs to be fixed at each boot (implying a part of the boot process with wrong log times and maybe worse consequences that I can't foresee).
| :::note | ||
| Correcting the date does not invalidate the host's own certificate. XAPI issues it with a | ||
| ten-year validity, so a host installed with a wrong date still holds a certificate that | ||
| covers the corrected date. `xe host-refresh-server-certificate` is not needed for this. |
There was a problem hiding this comment.
"a host installed with a wrong date still holds a certificate that covers the corrected date"
Can we affirm that? It's likely, not guaranteed.
Also, this note brings up a topic that many users wouldn't have thought of initially, only to dismiss it directly. I'd rather 1. tell them that they're probably fine but 2. also tell them how to verify and 3. how to fix it if really necessary (if we're able to provide the appropriate steps, validated).
There was a problem hiding this comment.
I read one off an 8.3 host:
notBefore=Jun 2 15:17:54 2026 GMT
notAfter=May 30 15:17:54 2036 GMT
Ten years wide, anchored on the clock at the moment it was generated. A host that installs itself believing the year is 2010 gets a certificate valid from 2010 to 2020, so correcting the clock to now leaves it expired. Set the clock far forward at install, and you get the mirror image: not valid yet once you correct backwards. My note leaned on the width, and the anchor is what actually decides it.
Rewritten along your three lines. Most corrections are fine, and it says so. To check:
openssl x509 -in /etc/xensource/xapi-ssl.pem -noout -dates
date -uTo fix, if the date falls outside that window, xe host-refresh-server-certificate host=<host>, with xe host-emergency-reset-server-certificate for a host already being rejected and therefore not reachable the usual way. Both were checked against xe help on the host.
There was a problem hiding this comment.
Correction to my own reply above, and a better answer than the one I gave.
I reproduced it on a lab host, and the result contradicted part of what I wrote. On an 8.3 host, chronyd stopped and the clock moved to 2016:
xe host-refresh-server-certificate host=<uuid>
/etc/xensource/xapi-pool-tls.pem
notBefore=Aug 17 10:00:00 2016 GMT
notAfter=Aug 15 10:00:00 2026 GMT
Ten years, anchored on the fake clock. Restoring the real date left that certificate expired by two days.
What I had wrong: xapi-ssl.pem never moved during any of this. host-refresh-server-certificate renews the internal pool certificate, and xe help says so plainly once read, "Refresh internal server certificate of host", against "Deletes the current TLS server certificate in the host" for host-reset-server-certificate. So my note told the reader to check the dates on one certificate and then run the command that renews the other. It would have reported success and changed nothing, which is the worst shape for a troubleshooting instruction.
Fixed in c848a9b. The note now lists both certificates with the command that regenerates each, tells the reader to check both windows, and warns against exactly the substitution I had just made.
The host is back to a 2026 to 2036 pool certificate and healthy. I will open an issue on xcp-ng/xcp for the underlying behaviour, since a certificate anchored to a wrong install-time clock is a product question rather than a documentation one, and link it here.
| such as an appliance on the same network, or a local server that is itself synchronized and | ||
| acts as the reference time for the network. | ||
|
|
||
| ## 🎱 Pools {#pools} |
There was a problem hiding this comment.
I'm not sure this section brings much value besides what's already described in "Why the clock must be correct", at least in its current state.
There was a problem hiding this comment.
Agreed, it was saying the same thing twice. Folded into the Pool membership bullet in "Why the clock must be correct" and dropped the section.
The merge also gave that bullet somewhere to make your point from the other comment, that we care about drift after joining and not only about the clock at join time. Nothing referenced the #pools anchor, so no links break.
Nine points from review. Three of them were questions with checkable answers rather than wording, so they got checked on an 8.3 host. The certificate note was wrong. It said a corrected date always stays inside the host certificate's validity, so no refresh is needed. The certificate is ten years wide and anchored on the clock at generation time: notBefore Jun 2 2026, notAfter May 30 2036 on the test host. A host that installed itself believing the year was 2010 therefore holds a certificate that expired in 2020, and correcting the clock leaves it expired. The note now says most corrections are fine, how to check the window against the date, and how to regenerate when it is outside. host-refresh-server-certificate takes host as a required parameter, and host-emergency-reset-server-certificate is the local one for a host already being rejected. Whether chronyd self-heals a wrong date at startup: yes, given a source. Stock chrony.conf carries makestep 1.0 3. A clock put 45 days in the past was corrected between five and ten seconds after chronyd started. The page had claimed chrony only slews and never converges for large offsets, which is true after those first three updates and not at boot. That reframes the manual correction as the narrower case it is. Xen Orchestra does not configure NTP on hosts. Its xoa network ntp and the NTP field in the deploy form both target the XOA appliance, which keeps its own Debian clock. Checked by grepping a clone of the XO tree: every hit outside docs is one locale string and the deploy form that uses it, and chrony appears nowhere. The rest: the correction section is now a diagnosis working outward from configuration to firewall, with stepping the clock demoted to a stopgap; xsconsole is the documented route and editing chrony.conf by hand is marked last resort in both places it appeared; the reference to a numbered installer step is gone; the manual-time warning no longer reads as though the date stops incrementing; example server names are placeholders; and the Pools section folded into the pool bullet it was duplicating, which also picks up the point about drift after joining. Still open, and not mine to answer: the suggestion that the support team would have useful input on the diagnosis order. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
The note I pushed earlier told the reader to check the dates on xapi-ssl.pem and then run host-refresh-server-certificate. Those are different certificates. The refresh command renews the internal pool certificate and leaves the TLS one alone, so following the note would have printed success and fixed nothing. Found by reproducing the failure rather than reasoning about it. On an 8.3 host, with the clock moved to 2016 and chronyd stopped, host-refresh-server-certificate produced a pool certificate valid 2016-08-17 to 2026-08-15. Restoring the clock left that certificate expired by two days, which is the failure the note describes, observed rather than deduced. xapi-ssl.pem was untouched throughout, which is what exposed the wrong pairing. xe help is explicit once you read it: host-reset-server-certificate "deletes the current TLS server certificate", host-refresh-server- certificate refreshes the "internal" one. The note now carries both paths in a table, tells the reader to check both windows, and warns against the substitution I had just made. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
There was a problem hiding this comment.
Depending on whether or not this other PR gets merged, we might want to remove the emojis in the section headings.
Review raised that xcp-ng#525 removes emoji from headings across the docs, and asked whether this page should follow. It should: xcp-ng#522 and xcp-ng#524 were the two competing approaches and both are closed, so xcp-ng#525 is the only live option and it is approved. A new page landing with six emoji headings would put back a small part of what that PR takes out. Heading text and anchors are untouched, so no links move. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
|
Removed in I went with removing rather than waiting, because the choice looks settled: #522 and #524 are both closed, so #525 is the only live option left, and it is already approved. A new page arriving with six emoji headings would put back a small piece of exactly what that PR takes out, and whoever merges it would have to come back for this file. If #525 ends up not merging, this page is then the odd one out, and I will put them back. |
Review noted that "See X" sat disconnected from the sentence before it, and that the same shape recurred across the page. All five now carry the connection in the sentence rather than leaving the reader to infer it: Pool Requirements what else a host must meet before it can join Install XCP-ng where this falls in the installation sequence Checking the time how to recognise that state on a running host Answer file its syntax Networks without folded into the clause about no route to the pool Two other uses of "see" on the page are ordinary verbs, "to see the offset" and "the certificate clients see", and are left alone. No link targets or anchors change. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
| - **Pool membership.** A host joining a pool must have its clock synchronized with the pool | ||
| master, and must stay synchronized afterwards. A failed join tells you what is wrong. Drift | ||
| that sets in later does not: it surfaces as hosts disagreeing about when things happened, | ||
| each of them convinced by its own clock. Keep every host in a pool on the same time sources. | ||
| See [Pool Requirements](../../installation/requirements#pool-requirements) for the other | ||
| conditions a host has to meet before it can join. |
There was a problem hiding this comment.
Suggested rewording. Straight out of my fingers, so feel free to improve the language correctness.
| - **Pool membership.** A host joining a pool must have its clock synchronized with the pool | |
| master, and must stay synchronized afterwards. A failed join tells you what is wrong. Drift | |
| that sets in later does not: it surfaces as hosts disagreeing about when things happened, | |
| each of them convinced by its own clock. Keep every host in a pool on the same time sources. | |
| See [Pool Requirements](../../installation/requirements#pool-requirements) for the other | |
| conditions a host has to meet before it can join. | |
| - **Hosts synchronization inside a pool.** Desynchronized time references between hosts | |
| in a pool can cause a variety of subtle issues for operations that require the hosts to agree | |
| on the current time. As such, it is necessary for hosts to synchronize time from a common | |
| source. Disagreeing clocks can also prevent adding a new host to an existing pool. The correct | |
| way to fix it is to ensure synchronization works, rather than a one time fix which would let | |
| them drift apart in the future. |
| - **Logs and scheduled operations.** Correlating events across the hosts of a pool, and | ||
| anything that runs on a schedule such as backups, depend on the hosts agreeing on what | ||
| time it is. | ||
|
|
There was a problem hiding this comment.
Here let's add a word about Xen Orchestra, which, when used, must also have a synchronized clock?
| Measured on 8.3: a clock put 45 days in the past was corrected between five and ten seconds | ||
| after `chronyd` started. |
There was a problem hiding this comment.
Let's remove this log-like precision.
| Measured on 8.3: a clock put 45 days in the past was corrected between five and ten seconds | ||
| after `chronyd` started. | ||
|
|
||
| After those three updates chronyd only slews, which for an offset of months or years never |
There was a problem hiding this comment.
I didn't know verb "to slew", and think that "gradually adjusts" who be easier to understand by non-native english speakers like me.
| converges. That is the case the manual correction below exists for, along with the host that | ||
| had no time source to begin with. |
There was a problem hiding this comment.
I'm not so sure about this claim. As I understand it, a reboot fixes the clock if ntp is correctly configured, so:
- either the hosts haven't been rebooted in a very long time and they're likely behind on updates, and should probably be updated+rebooted.
- if rebooting doesn't fix the problem, it's probably elsewhere and not caused by the fact that chronyd can only gradually adjust time after first three times since last reboot, but by another, bigger cause (heavily drifting hardware clock, misconfigured ntp or failure to join it due to firewall...).
| from the date you typed, and if that date was wrong, it stays wrong. This is also the one | ||
| case that does not fix itself at boot, since `makestep` needs a source to measure against. |
There was a problem hiding this comment.
"This is also the one case that does not fix itself at boot, since makestep needs a source to measure against."
=> this could be removed, if the sentence just above would say that nothing adjusts it (instead of checks it).
| 4. **Was the configuration changed underneath you?** `rpm -V chrony` reports whether | ||
| `/etc/chrony.conf` still matches the package. Hand edits and `xsconsole` both show up here. |
There was a problem hiding this comment.
I have doubts about this one. Can you verify?
- If xsconsole changes chrony.conf, then of course it will differ from the base file provided by the package
- more generally, rpm -V checks differences between a file as provided by the RPM package and what's on the system. For a configuration file, it's natural that there's a difference. It's there for this purpose. I don't know what rpm -V says here but I wouldn't be surprised if either it would always show it different (with a flag stating that it's configuration), or always ignore it. It also depends whether the file is declared %config or %config(noreplace) in the RPM spec file. Here, we have
%config(noreplace) %{_sysconfdir}/chrony.confwhich means that the RPM must not overwrite the file with future updates if the sysadmin (XAPI/xsconsole being considered an extension of the sysadmin for this purpose) has made any change to the file.
So, the output of rpm -V tells you nothing here, except maybe in some cases "it was never configured", but you would already have found out with earlier checks.
What you probably really want is to determine if something has modified the configuration outside the supported way (installer, xsconsole, xe/XAPI), and I'm not sure there's an answer to this one, but I haven't digged into the details.
| 2. **Are they reachable?** Sources stuck at `?` are configured but unanswered. NTP goes out | ||
| over UDP 123, so a firewall between the host and its servers produces exactly this, as | ||
| does a network with no route to the public pool, which | ||
| [Networks without internet access](#networks-without-internet-access) below covers. |
There was a problem hiding this comment.
It could also be that the ntp server they have chosen doesn't exist anymore
| Once sources are reachable, restarting the daemon corrects the clock on its own, because the | ||
| `makestep` allowance applies again from a fresh start: |
There was a problem hiding this comment.
To understand this, one must have read #how-xcp-ng-keeps-time
| ### Stepping the clock immediately | ||
|
|
||
| If you need the correct date right now and the daemon has been running for a while, its | ||
| `makestep` allowance is already spent and it will only slew: |
There was a problem hiding this comment.
Same comment about "slew" that earlier.
| :::note | ||
| **Check the host certificate after a large correction.** | ||
|
|
||
| XAPI issues certificates with a ten-year validity, anchored on the clock at the moment they | ||
| are generated. Small corrections stay comfortably inside that window, so most of the time | ||
| there is nothing to do. | ||
|
|
||
| A big correction is different. A host that generated its certificates believing the year was | ||
| 2016 holds them valid 2016 to 2026, and moving the clock to the real date can leave them | ||
| expired. A clock set far into the future produces the mirror image: certificates not valid | ||
| yet once the date is corrected backwards. | ||
|
|
||
| There are two, and they are refreshed by different commands: | ||
|
|
||
| | Certificate | What it is | Regenerate with | | ||
| |---|---|---| | ||
| | `/etc/xensource/xapi-ssl.pem` | The TLS certificate clients see, including Xen Orchestra | `xe host-reset-server-certificate` | | ||
| | `/etc/xensource/xapi-pool-tls.pem` | The internal certificate hosts use between themselves | `xe host-refresh-server-certificate host=<host>` | | ||
|
|
||
| Check both windows against the corrected date: | ||
|
|
||
| ```bash | ||
| openssl x509 -in /etc/xensource/xapi-ssl.pem -noout -dates | ||
| openssl x509 -in /etc/xensource/xapi-pool-tls.pem -noout -dates | ||
| date -u | ||
| ``` | ||
|
|
||
| If the date falls outside `notBefore` to `notAfter`, regenerate the one concerned using the | ||
| table above. Do not reach for `host-refresh-server-certificate` to fix `xapi-ssl.pem`: it | ||
| refreshes the internal certificate, reports success, and leaves the TLS one untouched. | ||
|
|
||
| On a host whose TLS certificate is already rejected, and which therefore cannot be reached the | ||
| usual way, `xe host-emergency-reset-server-certificate` runs locally on the host itself. | ||
| ::: |
There was a problem hiding this comment.
I think this should just be a short note explaining how to verify the certificate validity periods. How to renew certificates is a topic that doesn't belong here. There's an old draft on this whole topic, which stalled: #216
The certificate topic is a big one in itself, we should cover it independently.
| On such networks, point the hosts at a time source they can actually reach, using `xsconsole` | ||
| as above: an appliance on the same network, or a local server that is itself synchronized and | ||
| acts as the reference time for the network. |
There was a problem hiding this comment.
using xsconsole is one way to do it, for an already installed host. But here we're not in the troubleshooting part of the document anymore, so the best course of action is to set it right at installation time.
@stormi asked for this in #504:
NTP was documented in three places, each in passing: the installer walkthrough tells you to always use an NTP server, the answer file reference lists
<ntp-server>, and the pool requirements mention clock synchronization. Nothing said what to do when the clock is already wrong, or how to tell whether chrony is actually doing anything.This gathers it into one page: why the date matters, how to set the sources at install time and afterwards, how to check them, and how to correct a host that has already drifted.
The part I had not seen documented anywhere is that
chronydcan be running and enabled while having no time sources configured at all.systemctl status chronydlooks healthy, the network is fine, and the host simply keeps its installation date. The only check that reveals it ischronyc sourcesreturningNumber of sources = 0, which nobody runs until they already suspect the clock. So the page puts that check first, and splits the correction into two paths, becausechronyc makestepreports success and moves nothing when there is no source to step to.#504 will link here for detail once this lands, and sheds its NTP how-to in the process. I have deliberately not linked from here to that troubleshooting section yet, since it does not exist on
masterandonBrokenLinksis set tothrow.