File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -708,10 +708,23 @@ pub async fn cmd_sys_setup(args: SetupArgs) -> Result<()> {
708708async fn do_sys_setup ( stage0 : Stage0 < ' _ > ) -> Result < ( ) > {
709709 if stage0. shared . app_compose . secure_time {
710710 info ! ( "Waiting for the system time to be synchronized" ) ;
711- cmd ! {
712- chronyc waitsync 20 0.1 ;
711+ let mut last_err = None ;
712+ for i in 1 ..=30 {
713+ match cmd ! { chronyc waitsync 1 0.2 ; } {
714+ Ok ( _) => {
715+ last_err = None ;
716+ break ;
717+ }
718+ Err ( e) => {
719+ info ! ( "Time sync attempt {i}/30 failed, retrying..." ) ;
720+ last_err = Some ( e) ;
721+ tokio:: time:: sleep ( Duration :: from_secs ( 1 ) ) . await ;
722+ }
723+ }
724+ }
725+ if let Some ( e) = last_err {
726+ return Err ( e) . context ( "Failed to sync system time after 30 attempts" ) ;
713727 }
714- . context ( "Failed to sync system time" ) ?;
715728 } else {
716729 info ! ( "System time will be synchronized by chronyd in background" ) ;
717730 }
You can’t perform that action at this time.
0 commit comments