From 8d46c9c381a2487d759f477948eabe51d40479b7 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Mon, 20 Dec 2021 07:58:27 -0700 Subject: [PATCH] Add chrony waitsync back in This is a revert of 373a27163e0365919f707604df5b61863029d2e4 because makestep does not fail if the ntp servers are unavailable. This change adds waitsync back in so it fails if the servers are unavilable but leaves the makestep in place which should force the sync. If the servers are unavailable, the waitsync should catch it. If they are available waitsync should be a relative noop because the makestep would sync the system. The waitsync has been increased to 5 minutes (from 200 seconds). waitsync will wait 30 times with an interval of 10 seconds between checks. Closes-Bug: #1955414 Change-Id: I4ac9210f6533e6826b2814f72b7271b43fdca267 --- deployment/timesync/chrony-baremetal-ansible.yaml | 4 +++- firstboot/userdata_timesync.yaml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/deployment/timesync/chrony-baremetal-ansible.yaml b/deployment/timesync/chrony-baremetal-ansible.yaml index 93a1cbc8fa..5aa1ef936a 100644 --- a/deployment/timesync/chrony-baremetal-ansible.yaml +++ b/deployment/timesync/chrony-baremetal-ansible.yaml @@ -120,8 +120,10 @@ outputs: - name: Install, Configure and Run Chrony include_role: name: chrony - - name: Ensure system is NTP time synced + - name: Force NTP sync command: chronyc makestep + - name: Ensure system is NTP time synced + command: chronyc waitsync 30 ansible_group_vars: chrony_role_action: all chrony_ntp_servers: {get_param: NtpServer} diff --git a/firstboot/userdata_timesync.yaml b/firstboot/userdata_timesync.yaml index fd3c6fbc92..1857d61566 100644 --- a/firstboot/userdata_timesync.yaml +++ b/firstboot/userdata_timesync.yaml @@ -75,6 +75,7 @@ resources: if [ "$service" = "chrony" ]; then if command -v chronyc >/dev/null; then chronyc makestep + chronyc waitsync 30 else echo "No chronyc available, skipping sync" fi