From 82a2e8afd65922af0f32dc6218825953cf6529d4 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Wed, 21 Apr 2021 15:50:17 -0400 Subject: [PATCH 1/3] Remove pidfile /dev/null for chronyd in setupntp on Ubuntu systems --- xCAT/postscripts/setupntp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index a95c621da..98ce05f26 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -167,6 +167,18 @@ warn_if_bad "$?" "Failed to configure the system to maintain the RTC in universa # Synchronize and set the system clock once logger -t $log_label -p local4.info "Syncing the clock ..." + +OS_name=`cat /etc/os-release | grep "NAME=\"Ubuntu\""` + +if [ -z $OS_name ] +then + pidfile_option="pidfile /dev/null" +else + # Some versions of chronyd on Ubuntu distros have an issue + # with the valid option "pidfile /dev/null". + pidfile_option="" +fi + chronyd -f /dev/null -q "$( if [ "${#NTP_SERVERS[@]}" -gt "0" ] then @@ -174,7 +186,7 @@ chronyd -f /dev/null -q "$( else echo "pool pool.ntp.org iburst" fi -)" "pidfile /dev/null" +)" "$pidfile_option" rm -f /etc/adjtime # Set the hardware clock from the system clock From f0705f9ff4a428c42cc7bc2c749f91402b2acea5 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Thu, 22 Apr 2021 12:22:23 -0400 Subject: [PATCH 2/3] Modification of the conditional statement --- xCAT/postscripts/setupntp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 98ce05f26..1388e5b5f 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -168,15 +168,13 @@ warn_if_bad "$?" "Failed to configure the system to maintain the RTC in universa # Synchronize and set the system clock once logger -t $log_label -p local4.info "Syncing the clock ..." -OS_name=`cat /etc/os-release | grep "NAME=\"Ubuntu\""` - -if [ -z $OS_name ] +if [ -f /etc/os-release ] && cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null then - pidfile_option="pidfile /dev/null" -else # Some versions of chronyd on Ubuntu distros have an issue # with the valid option "pidfile /dev/null". pidfile_option="" +else + pidfile_option="pidfile /dev/null" fi chronyd -f /dev/null -q "$( From d009f2c00a1e785ea1f2f3d0764a74021a23fd86 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Thu, 22 Apr 2021 13:10:32 -0400 Subject: [PATCH 3/3] Add grep to check_exec_or_exit --- xCAT/postscripts/setupntp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 1388e5b5f..c0466607a 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -145,7 +145,7 @@ fi unset MASTER unset NTPSERVERS -check_exec_or_exit cp cat logger +check_exec_or_exit cp cat logger grep check_exec_or_exit systemctl timedatectl hwclock systemctl stop ntp.service 2>/dev/null