@@ -144,6 +144,21 @@ _pct_create() {
144144 return $rc
145145}
146146
147+ # Restart after a config change, and say something useful when it fails. The
148+ # two call sites used to be `pct start "$CTID" >/dev/null 2>&1`, so a failure
149+ # aborted the run under errexit with a bare 255 and the output discarded - six
150+ # runs across four apps in the telemetry, none of them diagnosable. pct can
151+ # also return 0 and leave the container stopped, so ask for the real state.
152+ _pct_restart () {
153+ local ctid=" $1 " what=" $2 " err
154+ err=" $( pct start " $ctid " 2>&1 ) " || true
155+ [[ " $( pct status " $ctid " 2> /dev/null) " == " status: running" ]] && return 0
156+ msg_error " Container ${ctid} did not start after ${what} "
157+ [[ -n " $err " ]] && msg_custom " ℹ️" " ${YW} " " $err "
158+ msg_custom " ℹ️" " ${YW} " " See: pct config ${ctid} and journalctl -u pve-container@${ctid} "
159+ return 1
160+ }
161+
147162# ------------------------------------------------------------------------------
148163# build_container()
149164#
@@ -389,6 +404,18 @@ $PCT_OPTIONS_STRING"
389404 [[ -n " ${HTTP_PROXY:- } " ]] && export HTTP_PROXY HTTPS_PROXY=" $HTTP_PROXY " http_proxy=" $HTTP_PROXY " https_proxy=" $HTTP_PROXY "
390405 [[ -n " ${HTTP_NO_PROXY:- } " ]] && export NO_PROXY=" $HTTP_NO_PROXY " no_proxy=" $HTTP_NO_PROXY "
391406
407+ # Every storage path below shells out to pvesm. Where that binary is missing
408+ # this is not a Proxmox host at all, and the `pvesm ... 2>/dev/null | awk`
409+ # pipelines just returned a bare 127 with the diagnostic thrown away - the
410+ # single largest group in our telemetry. Say what actually happened instead.
411+ if ! command -v pvesm > /dev/null 2>&1 ; then
412+ msg_error " pvesm is not available - this backend expects a Proxmox VE host"
413+ if declare -f detect_lxc_platform > /dev/null 2>&1 ; then
414+ msg_custom " ℹ️" " ${YW} " " Detected platform: $( detect_lxc_platform) . Override with LXC_PLATFORM=pve|incus if that is wrong"
415+ fi
416+ exit 1
417+ fi
418+
392419 # Validate storage space only if CONTAINER_STORAGE is already set
393420 # (Storage selection happens in create_lxc_container for some modes)
394421 if [[ -n " $CONTAINER_STORAGE " ]]; then
802829 chown root:root " $rootfs_path " 2> /dev/null || true
803830 fi
804831 pct unmount " $CTID " > /dev/null 2>&1 || true
805- pct start " $CTID " > /dev/null 2>&1
832+ _pct_restart " $CTID " " the rootfs ownership fix " || exit 227
806833 sleep 3
807834 fi
808835
@@ -1775,7 +1802,7 @@ fix_gpu_gids() {
17751802 sed -i -E " s|(dev[0-9]+: /dev/kfd),gid=[0-9]+|\1,gid=${render_gid} |g" " $LXC_CONFIG "
17761803
17771804 # Restart container
1778- pct start " $CTID " > /dev/null 2>&1
1805+ _pct_restart " $CTID " " GPU passthrough configuration " || exit 227
17791806 sleep 2
17801807
17811808 msg_ok " GPU passthrough configured (video:${video_gid} , render:${render_gid} )"
0 commit comments