Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep new Proxmox installs out of existing guest maintenance
pulse-triage[bot]5d88967eec0b
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 22cefdc2e6..3b2d7582d6 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -15,6 +15,30 @@```## Purpose++### New Proxmox installations leave existing workloads alone++Creating a Pulse LXC is not estate-wide legacy maintenance. The root installer+must not invoke sensor-proxy cleanup, stop/start existing guests or remove their+mount configuration before asking for installation mode, on cancellation or as+an implicit prerequisite for creating the new container. The old v4 automatic+mount rewrite is removed, not moved to a later installation phase.++Legacy sensor-proxy removal stays in the separate explicitly invoked+`scripts/uninstall-sensor-proxy.sh` maintenance procedure, with its existing+state/trust preservation, failure reporting and documented workload-interruption+warning. The new-install change neither runs that helper nor claims existing+legacy mounts are repaired. Existing new-container ownership/cleanup, signed+payload admission and scoped install/update behaviour are unchanged.++`TestRootInstallProxmoxLeavesLegacyCleanupExplicit` checks the root source has+no implicit legacy-cleanup implementation. The real `create_lxc_container`+entry is exercised through a controlling-terminal Cancel, Quick and Advanced+selection and a detached noninteractive Quick entry, with every Proxmox action+an inert fixture. No existing-guest inventory/lifecycle action may precede the+first configuration prompt; Cancel must complete without one. The separate+legacy cleanup safety suite continues to own its explicit maintenance path.+### Mechanical stable patch source admissionStable-regression patches are the sole main-only release exception. The releasediff --git a/install.sh b/install.shindex b1c1dc35f8..df3f0ee80e 100644--- a/install.sh+++ b/install.sh@@ -1241,87 +1241,6 @@ is_bridge_interface() {return 1}-cleanup_stale_sensor_proxy_mounts() {- # The v4 installer added mount entries for /run/pulse-sensor-proxy to LXC- # container configs. In v5+, the sensor proxy was removed but these entries- # persist. After a host reboot, /run (tmpfs) is wiped and the mount source- # disappears, causing Proxmox to refuse to start the container.- # This function detects and removes those stale entries automatically.- command -v pct >/dev/null 2>&1 || return 0-- local ctids- ctids=$(pct list 2>/dev/null | tail -n +2 | awk '{print $1}')- [ -z "$ctids" ] && return 0-- for ctid in $ctids; do- local conf="/etc/pve/lxc/${ctid}.conf"- [ -f "$conf" ] || continue-- # Check if this container has any pulse-sensor-proxy references- grep -q "pulse-sensor-proxy" "$conf" 2>/dev/null || continue-- echo " Cleaning stale sensor-proxy mount from container $ctid..."-- # Find the first [snapshot] line to avoid modifying snapshot sections- local snap_line- snap_line=$(grep -n '^\[' "$conf" 2>/dev/null | head -1 | cut -d: -f1 || true)-- # Determine which lines to examine (main config only, before snapshots)- local main_section- if [ -n "$snap_line" ]; then- main_section=$(head -n "$((snap_line - 1))" "$conf")- else- main_section=$(cat "$conf")- fi-- # Check if container is running (we may need to stop it for pct set)- local was_running=false- local stopped_by_cleanup=false- if pct status "$ctid" 2>/dev/null | grep -q "running"; then- was_running=true- fi-- # Remove mp<N> entries referencing pulse-sensor-proxy- local mp_keys- mp_keys=$(echo "$main_section" | grep -E '^mp[0-9]+:.*pulse-sensor-proxy' | cut -d: -f1 || true)- for mp_key in $mp_keys; do- if $was_running && ! $stopped_by_cleanup; then- if timeout 15 pct stop "$ctid" 2>/dev/null; then- stopped_by_cleanup=true- sleep 2- fi- fi- if ! timeout 10 pct set "$ctid" -delete "$mp_key" 2>/dev/null; then- # Fallback: direct sed deletion- if [ -n "$snap_line" ]; then- sed -i "1,$((snap_line - 1))s/^${mp_key}:.*pulse-sensor-proxy.*$//" "$conf"- else- sed -i "/^${mp_key}:.*pulse-sensor-proxy/d" "$conf"- fi- fi- done-- # Remove lxc.mount.entry lines referencing pulse-sensor-proxy- if echo "$main_section" | grep -q "lxc.mount.entry.*pulse-sensor-proxy"; then- if [ -n "$snap_line" ]; then- sed -i "1,$((snap_line - 1)){/lxc\.mount\.entry.*pulse-sensor-proxy/d}" "$conf"- else- sed -i "/lxc\.mount\.entry.*pulse-sensor-proxy/d" "$conf"- fi- fi-- # Remove any blank lines left behind- sed -i '/^$/d' "$conf"-- # Restart container only if we stopped it during cleanup- if $stopped_by_cleanup; then- timeout 30 pct start "$ctid" 2>/dev/null || true- fi-- echo " Cleaned sensor-proxy mount from container $ctid"- done-}-create_lxc_container() {# Only files created by this invocation belong to its EXIT cleanup. Local# --archive inputs and a caller-supplied installer must remain untouched.@@ -1339,9 +1258,8 @@ create_lxc_container() {echo "Proxmox VE detected. Installing Pulse in a container."echo- # Clean up stale v4 sensor-proxy mount entries that prevent LXC start after reboot- cleanup_stale_sensor_proxy_mounts-+ # Creating Pulse must not stop or rewrite any existing guest. Legacy v4+ # sensor-proxy cleanup is a separate, explicitly invoked maintenance job.# Check if we can interact with the user# Try to read from /dev/tty to test if we have terminal accessif test -e /dev/tty && (echo -n "" > /dev/tty) 2>/dev/null; thendiff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.goindex c82ae2a70e..6fd9750d0a 100644--- a/scripts/installtests/root_install_sh_test.go+++ b/scripts/installtests/root_install_sh_test.go@@ -10,6 +10,7 @@ import ("os/exec""path/filepath""regexp"+ "runtime""sort""strings""sync/atomic"@@ -17,6 +18,120 @@ import ("time")+func TestRootInstallProxmoxLeavesLegacyCleanupExplicit(t *testing.T) {+ content, err := os.ReadFile(repoFile("install.sh"))+ if err != nil {+ t.Fatal(err)+ }+ if strings.Contains(string(content), "cleanup_stale_sensor_proxy_mounts") {+ t.Fatal("new Pulse installation must not contain or invoke estate-wide legacy mount cleanup")+ }+ // Explicit maintenance remains separate; do not replace its failure/state+ // controls with the old install-time best-effort stop/edit/start path.+ legacy, err := os.ReadFile(repoFile("scripts", "uninstall-sensor-proxy.sh"))+ if err != nil || !strings.Contains(string(legacy), "cleanup_stale_sensor_proxy_mounts()") {+ t.Fatalf("separate legacy maintenance helper missing: %v", err)+ }+}++func TestRootInstallProxmoxEntryPreservesExistingGuests(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("Unix controlling-terminal installer fixture")+ }+ for _, tc := range []struct {+ name, wantActions, wantOutput string+ wantExit int+ }{+ {"cancel", "cleanup\n", "Installation cancelled", 0},+ {"quick", "nextid\ncleanup\n", "fixture stopped at Port [7655]:", 47},+ {"advanced", "nextid\ncleanup\n", "fixture stopped at Frontend port [7655]:", 47},+ {"noninteractive", "nextid\ncleanup\n", "Non-interactive mode detected. Using Quick installation.", 47},+ } {+ t.Run(tc.name, func(t *testing.T) {+ dir := t.TempDir()+ // The exact production entry runs, but no real guest, /etc/pve+ // config, legacy cleanup body or lifecycle tool is ever reached.+ // The old call is caught by an inert spy, not reenacted.+ body := `#!/bin/bash+set -euo pipefail+scenario="$1"+print_header() { :; }+print_info() { printf '%s\n' "$1"; }+handle_install_interrupt() { exit 75; }+cleanup_container_install_inputs() {+ [[ -z "$1" && -z "$2" && "$3" == false ]]+ printf 'cleanup\n' >>"$FIXTURE_ROOT/actions"+}+cleanup_stale_sensor_proxy_mounts() {+ printf 'UNEXPECTED legacy-cleanup\n' >>"$FIXTURE_ROOT/actions"+}+pvesh() {+ [[ "$*" == 'get /cluster/nextid' ]] || return 81+ printf 'nextid\n' >>"$FIXTURE_ROOT/actions"+ printf '222\n'+}+pct() { printf 'UNEXPECTED pct %s\n' "$*" >>"$FIXTURE_ROOT/actions"; return 82; }+qm() { printf 'UNEXPECTED qm %s\n' "$*" >>"$FIXTURE_ROOT/actions"; return 83; }+safe_read_with_default() {+ if [[ "$1" == 'Select [1-3]: ' ]]; then+ case "$scenario" in+ cancel) printf -v "$2" 3 ;;+ quick) printf -v "$2" 1 ;;+ advanced) printf -v "$2" 2 ;;+ *) exit 84 ;;+ esac+ return 0+ fi+ printf 'fixture stopped at %s\n' "$1"+ exit 47+}+` + extractRootInstallShellFunction(t, "create_lxc_container") + `+create_lxc_container+exit 85+`+ script := filepath.Join(dir, "entry.sh")+ if err := os.WriteFile(script, []byte(body), 0600); err != nil {+ t.Fatal(err)+ }+ // A PTY exercises the real /dev/tty branch. A new session with+ // pipe stdio exercises the detached installer, independent of the+ // terminal from which go test was launched. This needs no root.+ const runner = `import os, pty, subprocess, sys+command = ["bash", sys.argv[1], sys.argv[2]]+if sys.argv[2] == "noninteractive":+ sys.exit(subprocess.run(command, start_new_session=True).returncode)+sys.exit(os.waitstatus_to_exitcode(pty.spawn(command)))+`+ ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)+ defer cancel()+ cmd := exec.CommandContext(ctx, "python3", "-c", runner, script, tc.name)+ cmd.Env = append(os.Environ(), "FIXTURE_ROOT="+dir)+ out, err := cmd.CombinedOutput()+ if ctx.Err() != nil {+ t.Fatalf("entry fixture deadline: %v\n%s", ctx.Err(), out)+ }+ code := 0+ if err != nil {+ if exit, ok := err.(*exec.ExitError); ok {+ code = exit.ExitCode()+ } else {+ t.Fatalf("start fixture: %v\n%s", err, out)+ }+ }+ if code != tc.wantExit || !strings.Contains(string(out), tc.wantOutput) {+ t.Fatalf("entry exit %d, want %d and %q:\n%s", code, tc.wantExit, tc.wantOutput, out)+ }+ actions, err := os.ReadFile(filepath.Join(dir, "actions"))+ if err != nil || string(actions) != tc.wantActions {+ t.Fatalf("unexpected existing-guest or pre-prompt action: %v, %q; want %q\n%s", err, actions, tc.wantActions, out)+ }+ if strings.Contains(string(out), "Cleaned sensor-proxy") {+ t.Fatalf("new installation claimed legacy recovery:\n%s", out)+ }+ })+ }+}+func TestRootInstallScriptVersionFlagRequiresValue(t *testing.T) {scriptPath := filepath.Join("..", "..", "install.sh")