Proxmox: stop early when the node's cluster has no quorum

Without quorum /etc/pve is read-only, so pct create and pvesm set fail with
cfs lock errors. lxc mode now checks pvecm status first and explains the
fixes (pvecm expected 1 for now, or separating the node from the cluster).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:44:41 -08:00
parent 310f78c7df
commit a96ae4e825
4 changed files with 40 additions and 0 deletions

View file

@ -174,6 +174,7 @@ lxc_install() {
local tag="netmon-$ROLE" ctname script ip k port=${!PORT_KEY}
if [ "$ROLE" = hub ]; then ctname=netmon-hub; else ctname="netmon-probe-$(hostname -s | tr -c 'a-zA-Z0-9-\n' '-')"; fi
step "proxmox container"
check_quorum
CTID=$(find_ct "$tag")
if [ -n "$CTID" ]; then log "reusing container $CTID (tagged $tag)"; else create_ct "$ctname" "$tag"; fi
pct status "$CTID" | grep -q running || pct start "$CTID"
@ -205,6 +206,17 @@ lxc_install() {
echo " uninstall: pct stop $CTID && pct destroy $CTID"
}
# Without quorum /etc/pve is read-only: no container can be created or changed.
# A standalone node (no cluster) has no corosync config, and pvecm status fails: that's fine.
check_quorum() {
if pvecm status 2>/dev/null | grep -Eq '^Quorate:[[:space:]]+No'; then
die "this node is in a cluster without quorum, so /etc/pve is read-only and no container can be created.
If the other cluster nodes are gone: run 'pvecm expected 1' (until the next reboot or corosync restart),
or separate the node from the cluster for good (Proxmox docs: 'Separate a node without reinstalling').
Without quorum, Proxmox also won't start guests at boot."
fi
}
# The container this installer made before, found by its tag.
find_ct() {
local id