From 670ea2df515740a515694645997832d564660cf6 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Thu, 3 Sep 2026 14:39:50 -0300 Subject: [PATCH] fix(setupntp): --backend ntpd configures a daemon that is not installed setupntp falls back from chrony to ntpd when chronyd is absent, but not the other way. A node told --backend ntpd, or --use-ntpd, that has only chrony execs setupntp.traditional, which writes /etc/ntp.conf and calls startservice ntpserver for a daemon that is not there. The node ends with no running time daemon and a warning in the log. The ntpd branch of the backend selection now probes ntpd. When ntpd is absent and chronyd and systemctl are both present, setupntp uses chrony and logs the change, the same way the chrony branch already does. makentp_ntp_deps.t covers both directions. The two ntpd cases fail without this change. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT/postscripts/setupntp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 425ea665f..29035e8b7 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -139,11 +139,19 @@ then esac fi -# The requested backend is a preference, not a guarantee: a node that does not have chronyd -# still has to be configured, so fall back to ntpd and say so rather than failing. +# The requested backend is a preference, not a guarantee: a node that does not have the +# requested daemon still has to be configured, so use the other one and say so. if [ "${NTP_BACKEND}" = "ntpd" ] then USE_NTPD="yes" + if ! check_executes ntpd >/dev/null 2>&1 && + check_executes chronyd >/dev/null 2>&1 && + check_executes systemctl >/dev/null 2>&1 + then + USE_NTPD="" + logger -t $log_label -p local4.warning \ + "setupntp: ntpd requested but ntpd is absent; using chrony" + fi else check_executes chronyd >/dev/null 2>&1 || USE_NTPD="yes" check_executes systemctl >/dev/null 2>&1 || USE_NTPD="yes"