From 469de51c023911798c179467d7302690d73c8376 Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Wed, 11 Nov 2026 23:18:15 +0100 Subject: [PATCH] Say when pct create fails because timedatectl does not answer pct create reads the host's time zone through timedatectl. On five hosts in a week D-Bus did not answer, and each run tried three times, asked about verbose mode and ended in a generic creation failure. Name the host problem and stop at the first attempt. --- pve/backend.func | 9 +++++++++ tests/pct-create-settings.sh | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/pve/backend.func b/pve/backend.func index da4bd73..4875074 100644 --- a/pve/backend.func +++ b/pve/backend.func @@ -3738,6 +3738,15 @@ create_lxc_container() { if ! _pct_create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" $PCT_OPTIONS ${_PW_ARGS[@]+"${_PW_ARGS[@]}"} >"$LOGFILE" 2>&1; then msg_debug "Container creation failed on ${TEMPLATE_STORAGE}. Checking error..." + # pct create asks timedatectl for the host's time zone; when that fails, every retry fails with it. + if grep -q "command 'timedatectl show" "$LOGFILE"; then + msg_error "pct create could not read this host's time zone: timedatectl does not answer." + msg_custom "🔧" "${YW}" "On the Proxmox host, run 'systemctl restart systemd-timedated' and check that 'timedatectl' works, then retry." + msg_custom "💡" "${YW}" "If timedatectl still fails, D-Bus on the host is stuck; a reboot clears it." + _flush_pct_log + exit 209 + fi + if grep -qiE 'Compilation failed|Bareword.*not allowed' "$LOGFILE"; then msg_error "Container creation failed due to broken Perl modules on the PVE host." msg_custom "⚠️" "${YW}" "This usually happens after a partial PVE package upgrade." diff --git a/tests/pct-create-settings.sh b/tests/pct-create-settings.sh index ee3db28..b11a154 100644 --- a/tests/pct-create-settings.sh +++ b/tests/pct-create-settings.sh @@ -64,5 +64,12 @@ _cs_shield_hangup() { "$@"; } pveam() { [[ -d "$TEST_DIR/nas/template/cache" ]] && echo saved || echo "No such file or directory"; } expect "a storage without template/cache gets it before the download" saved "$(_pveam_download nas debian-13-standard_13.6-1_amd64.tar.zst)" +# From the telemetry: five hosts, three futile attempts each. +printf '%s\n' "Failed to parse bus message: Transport endpoint is not connected" \ + "unable to create CT 110 - command 'timedatectl show '--property=Timezone' --value' failed: exit code 1" >"$TEST_DIR/pct.log" +expect "a host whose timedatectl fails is named before any retry" 1 \ + "$(awk '/First attempt/,/already exists\|already in use/' "$CORE_DIR/pve/backend.func" | grep -c "grep -q \"command 'timedatectl show\" \"\$LOGFILE\"")" +expect "and the pattern matches what pct create prints" 0 "$(grep -q "command 'timedatectl show" "$TEST_DIR/pct.log"; echo $?)" + printf '%s passed, %s failed\n' "$passed" "$failed" ((failed == 0))