Skip to content

Commit dbdca25

Browse files
committed
Fix waitsync loop to properly wait for NTS handshake completion
The previous single waitsync call with 30 retries completed in ~3s, too fast for NTS-KE TLS handshake. Use a loop with 1s sleep between attempts, allowing up to 30s total for sync.
1 parent 025f2c0 commit dbdca25

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

basefiles/dstack-prepare.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ mount_overlay /home $OVERLAY_TMP
9696

9797
# Make sure the system time is synchronized
9898
log "Waiting for time sync..."
99-
chronyc waitsync 30 0.2 0 0 2>/dev/null || log "Warning: time sync timed out"
99+
for i in $(seq 1 30); do
100+
if chronyc waitsync 1 0.2 0 0 2>/dev/null; then
101+
log "Time synchronized"
102+
break
103+
fi
104+
sleep 1
105+
done || log "Warning: time sync timed out"
100106

101107
if ! [[ -e /dev/tdx_guest ]]; then
102108
modprobe tdx-guest

0 commit comments

Comments
 (0)