Skip to content

Commit ced0a0e

Browse files
committed
Fix time sync: wait for chrony to actually sync before proceeding
chronyc makestep only applies a correction if chrony already has a time estimate, but on first boot chrony may not have completed NTS-KE handshake yet. Replace with waitsync which blocks until chrony has synced with at least one source (up to 30s timeout, 1s threshold).
1 parent 627f19a commit ced0a0e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

basefiles/dstack-prepare.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ mount_overlay /bin $OVERLAY_TMP
9595
mount_overlay /home $OVERLAY_TMP
9696

9797
# Make sure the system time is synchronized
98-
log "Syncing system time..."
99-
# Let the chronyd correct the system time immediately
100-
chronyc makestep
98+
log "Waiting for time sync..."
99+
chronyc waitsync 30 1 0 0 2>/dev/null || log "Warning: time sync timed out"
101100

102101
if ! [[ -e /dev/tdx_guest ]]; then
103102
modprobe tdx-guest

0 commit comments

Comments
 (0)