Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Port installer disk preflight from v5

rcourtman87aba32540a1
diff --git a/docs/release-control/v6/internal/records/self-hosted-installer-disk-preflight-2026-05-01.md b/docs/release-control/v6/internal/records/self-hosted-installer-disk-preflight-2026-05-01.md
new file mode 100644
index 0000000000..dc495647f6
--- /dev/null
+++ b/docs/release-control/v6/internal/records/self-hosted-installer-disk-preflight-2026-05-01.md
@@ -0,0 +1,44 @@
+# Self-Hosted Installer Disk Preflight Record
+
+- Date: `2026-05-01`
+- Lane: `L1`
+- Subsystem: `deployment-installability`
+- Result: `passed`
+
+## Context
+
+The v5 maintenance audit found `release/5.1` commit `4de1c3745`
+(`Preflight disk space before Pulse updates`). That fix prevents small LXC or
+single-disk installs from stopping the running Pulse service and then failing
+part-way through update staging or extraction because `/tmp` or `/opt/pulse`
+does not have enough free space.
+
+The current v6 candidate already had update-manager extraction/backup
+space checks, but the root server installer still lacked the earlier
+operator-facing preflight.
+
+## Disposition
+
+The v6 root installer now performs a disk-space preflight before it detects and
+stops the active Pulse service or downloads/applies the release archive:
+
+- `/tmp` must have enough staging headroom;
+- the install filesystem must have apply headroom;
+- when `/tmp` and the install directory share the same filesystem, the
+ required space is combined and checked as one capacity constraint;
+- failure reports the available and required sizes before any service stop.
+
+`internal/updates/adapter_installsh.go` now reflects the same operator-facing
+requirement in the update plan prerequisites.
+
+## Proof
+
+- `bash -n install.sh`
+- `go test ./internal/updates -run 'TestInstallShAdapter_PrepareUpdate|InstallSh' -count=1`
+- `go test ./scripts/installtests -run 'RootInstallScript.*(ArchiveSupport|UpdateDiskHeadroom)|RootInstallScriptRequiresSignedReleaseDownloads' -count=1`
+
+## Outcome
+
+The v5 installer disk-space preflight is ported to the current v6 candidate.
+The self-hosted release confidence lane remains at the RC floor for this
+slice.
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index cee04cebd4..f0e089ed54 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -2481,6 +2481,11 @@
"path": "docs/release-control/v6/internal/records/known-rc-issue-closure-for-ga-installer-bundle-fallback-2026-05-01.md",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/records/self-hosted-installer-disk-preflight-2026-05-01.md",
+ "kind": "file"
+ },
{
"repo": "pulse",
"path": "docs/release-control/v6/internal/subsystems/deployment-installability.md",
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 95d99d2242..b917ae0df6 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -409,6 +409,13 @@ old snapshot ages out of retention, choose a backup root with enough free
space, and reject extraction/backup work early with a concrete space error
instead of drifting into partial update failure on small LXC or single-disk
installs.
+The root server installer shares that same fail-closed update-space boundary:
+`install.sh` must preflight staging and install-directory filesystem headroom
+before it stops the running Pulse service or downloads/applies a release
+archive, combining the required headroom when `/tmp` and the install directory
+share one filesystem. The install.sh update adapter must advertise that same
+operator prerequisite so in-app updates do not understate the staging
+requirement.
The same governed promotion path must now stay explicit too:
`scripts/release_control/resolve_release_promotion.py` is the canonical owner
for stable-versus-prerelease metadata validation shared by `.github/workflows/release-dry-run.yml`
diff --git a/install.sh b/install.sh
index a458e166ce..038a750245 100755
--- a/install.sh
+++ b/install.sh
@@ -103,6 +103,8 @@ CURRENT_INSTALL_CTID=""
CONTAINER_CREATED_FOR_CLEANUP=false
BUILD_FROM_SOURCE_MARKER="$INSTALL_DIR/BUILD_FROM_SOURCE"
DETECTED_CTID=""
+UPDATE_MIN_TEMP_FREE_BYTES=$((900 * 1024 * 1024))
+UPDATE_MIN_INSTALL_FREE_BYTES=$((256 * 1024 * 1024))
release_signature_key_available() {
[[ -n "${PINNED_RELEASE_SSH_PUBLIC_KEY:-}" ]]
@@ -156,6 +158,97 @@ AUTO_NODE_REGISTER_ERROR=""
DEBIAN_TEMPLATE_FALLBACK="debian-12-standard_12.12-1_amd64.tar.zst"
DEBIAN_TEMPLATE=""
+bytes_to_human() {
+ local bytes="${1:-0}"
+
+ if [[ ! "$bytes" =~ ^[0-9]+$ ]]; then
+ printf '%s\n' "$bytes"
+ return 0
+ fi
+
+ local units=("B" "KB" "MB" "GB" "TB")
+ local value="$bytes"
+ local unit_index=0
+
+ while (( value >= 1024 && unit_index < ${#units[@]} - 1 )); do
+ value=$((value / 1024))
+ ((unit_index += 1))
+ done
+
+ printf '%s%s\n' "$value" "${units[$unit_index]}"
+}
+
+get_available_bytes_for_path() {
+ local path="$1"
+ local available_kb=""
+
+ available_kb=$(df -Pk "$path" 2>/dev/null | awk 'NR==2 {print $4}')
+ if [[ ! "$available_kb" =~ ^[0-9]+$ ]]; then
+ return 1
+ fi
+
+ printf '%s\n' $((available_kb * 1024))
+}
+
+get_filesystem_device_for_path() {
+ local path="$1"
+ local filesystem=""
+
+ filesystem=$(df -Pk "$path" 2>/dev/null | awk 'NR==2 {print $1}')
+ if [[ -z "$filesystem" ]]; then
+ return 1
+ fi
+
+ printf '%s\n' "$filesystem"
+}
+
+ensure_update_disk_headroom() {
+ local temp_path="${1:-/tmp}"
+ local install_path="${2:-$INSTALL_DIR}"
+ local temp_fs=""
+ local install_fs=""
+ local temp_free_bytes=""
+ local install_free_bytes=""
+ local combined_required_bytes=$((UPDATE_MIN_TEMP_FREE_BYTES + UPDATE_MIN_INSTALL_FREE_BYTES))
+
+ temp_fs=$(get_filesystem_device_for_path "$temp_path" 2>/dev/null || true)
+ install_fs=$(get_filesystem_device_for_path "$install_path" 2>/dev/null || true)
+ temp_free_bytes=$(get_available_bytes_for_path "$temp_path" 2>/dev/null || true)
+ install_free_bytes=$(get_available_bytes_for_path "$install_path" 2>/dev/null || true)
+
+ if [[ -z "$temp_free_bytes" || -z "$install_free_bytes" ]]; then
+ print_warn "Could not determine available disk space for the update preflight; continuing anyway"
+ return 0
+ fi
+
+ if [[ -n "$temp_fs" && "$temp_fs" == "$install_fs" ]]; then
+ if (( temp_free_bytes < combined_required_bytes )); then
+ print_error "Not enough free disk space to stage the Pulse update"
+ print_info "The same filesystem backs $temp_path and $install_path"
+ print_info "Available: $(bytes_to_human "$temp_free_bytes"), required: $(bytes_to_human "$combined_required_bytes")"
+ print_info "Free disk space and retry the update"
+ return 1
+ fi
+ return 0
+ fi
+
+ if (( temp_free_bytes < UPDATE_MIN_TEMP_FREE_BYTES )); then
+ print_error "Not enough free disk space in $temp_path to stage the Pulse update"
+ print_info "Available: $(bytes_to_human "$temp_free_bytes"), required: $(bytes_to_human "$UPDATE_MIN_TEMP_FREE_BYTES")"
+ print_info "Free disk space under $temp_path and retry the update"
+ return 1
+ fi
+
+ if (( install_free_bytes < UPDATE_MIN_INSTALL_FREE_BYTES )); then
+ print_error "Not enough free disk space in $install_path to apply the Pulse update"
+ print_info "Available: $(bytes_to_human "$install_free_bytes"), required: $(bytes_to_human "$UPDATE_MIN_INSTALL_FREE_BYTES")"
+ print_info "Free disk space under $install_path and retry the update"
+ return 1
+ fi
+
+ return 0
+}
+
get_latest_release_from_redirect() {
# Follow the GitHub "latest" redirect and extract the tag in a way that
# tolerates intermediate redirects that omit /tag/ (issue #698).
@@ -2827,6 +2920,10 @@ download_pulse() {
rm -f "$BUILD_FROM_SOURCE_MARKER"
+ if ! ensure_update_disk_headroom "/tmp" "$INSTALL_DIR"; then
+ exit 1
+ fi
+
raw_arch=$(uname -m)
pulse_arch=$(detect_pulse_architecture "$raw_arch") || {
print_error "Unsupported architecture: $raw_arch"
diff --git a/internal/updates/adapter_installsh.go b/internal/updates/adapter_installsh.go
index 52038fbc93..d3de63b6a4 100644
--- a/internal/updates/adapter_installsh.go
+++ b/internal/updates/adapter_installsh.go
@@ -86,7 +86,7 @@ func (a *InstallShAdapter) PrepareUpdate(ctx context.Context, request UpdateRequ
Prerequisites: []string{
"Root access (sudo)",
"Internet connection",
- "At least 100MB free disk space",
+ "About 1.2GB free disk space for update staging",
},
}
diff --git a/internal/updates/adapter_installsh_more_test.go b/internal/updates/adapter_installsh_more_test.go
index 88ff42c2ff..01a018adc0 100644
--- a/internal/updates/adapter_installsh_more_test.go
+++ b/internal/updates/adapter_installsh_more_test.go
@@ -7,6 +7,15 @@ import (
"testing"
)
+func containsString(values []string, needle string) bool {
+ for _, value := range values {
+ if value == needle {
+ return true
+ }
+ }
+ return false
+}
+
func TestInstallShAdapter_PrepareUpdate(t *testing.T) {
adapter := NewInstallShAdapter(nil)
@@ -20,6 +29,9 @@ func TestInstallShAdapter_PrepareUpdate(t *testing.T) {
if len(plan.Instructions) == 0 || len(plan.Prerequisites) == 0 {
t.Fatalf("expected instructions and prerequisites: %+v", plan)
}
+ if !containsString(plan.Prerequisites, "About 1.2GB free disk space for update staging") {
+ t.Fatalf("expected update staging disk prerequisite, got %+v", plan.Prerequisites)
+ }
}
func TestInstallShAdapter_RollbackErrors(t *testing.T) {
diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.go
index 6ce40b1998..c2ccefda05 100644
--- a/scripts/installtests/root_install_sh_test.go
+++ b/scripts/installtests/root_install_sh_test.go
@@ -72,6 +72,10 @@ func TestRootInstallScriptArchiveSupportContract(t *testing.T) {
`resolve_archive_override()`,
`infer_release_from_archive_name()`,
`validate_pulse_binary_architecture()`,
+ `ensure_update_disk_headroom()`,
+ `UPDATE_MIN_TEMP_FREE_BYTES=$((900 * 1024 * 1024))`,
+ `UPDATE_MIN_INSTALL_FREE_BYTES=$((256 * 1024 * 1024))`,
+ `ensure_update_disk_headroom "/tmp" "$INSTALL_DIR"`,
`prefetch_pulse_archive_for_container()`,
`download_release_archive()`,
`install_pulse_archive()`,
@@ -84,6 +88,82 @@ func TestRootInstallScriptArchiveSupportContract(t *testing.T) {
}
}
+func TestRootInstallScriptUpdateDiskHeadroomRejectsSharedLowSpaceFilesystem(t *testing.T) {
+ script := `
+ set -euo pipefail
+ print_error() { :; }
+ print_info() { :; }
+ print_warn() { :; }
+ INSTALL_DIR="/opt/pulse"
+ UPDATE_MIN_TEMP_FREE_BYTES=$((100 * 1024))
+ UPDATE_MIN_INSTALL_FREE_BYTES=$((80 * 1024))
+` + extractRootInstallShellFunction(t, "bytes_to_human") + `
+` + extractRootInstallShellFunction(t, "get_available_bytes_for_path") + `
+` + extractRootInstallShellFunction(t, "get_filesystem_device_for_path") + `
+` + extractRootInstallShellFunction(t, "ensure_update_disk_headroom") + `
+ df() {
+ if [[ "$1" == "-Pk" ]]; then
+ case "$2" in
+ /tmp|/opt/pulse)
+ printf 'Filesystem 1024-blocks Used Available Capacity Mounted on\n'
+ printf '/dev/shared 1000 0 150 0%% /\n'
+ return 0
+ ;;
+ esac
+ fi
+ command df "$@"
+ }
+ if ensure_update_disk_headroom /tmp /opt/pulse; then
+ echo "ensure_update_disk_headroom unexpectedly passed on a shared full filesystem" >&2
+ exit 1
+ fi
+ `
+
+ out, err := exec.Command("bash", "-c", script).CombinedOutput()
+ if err != nil {
+ t.Fatalf("bash: %v\n%s", err, out)
+ }
+}
+
+func TestRootInstallScriptUpdateDiskHeadroomAcceptsSeparateFilesystems(t *testing.T) {
+ script := `
+ set -euo pipefail
+ print_error() { :; }
+ print_info() { :; }
+ print_warn() { :; }
+ INSTALL_DIR="/opt/pulse"
+ UPDATE_MIN_TEMP_FREE_BYTES=$((100 * 1024))
+ UPDATE_MIN_INSTALL_FREE_BYTES=$((80 * 1024))
+` + extractRootInstallShellFunction(t, "bytes_to_human") + `
+` + extractRootInstallShellFunction(t, "get_available_bytes_for_path") + `
+` + extractRootInstallShellFunction(t, "get_filesystem_device_for_path") + `
+` + extractRootInstallShellFunction(t, "ensure_update_disk_headroom") + `
+ df() {
+ if [[ "$1" == "-Pk" ]]; then
+ case "$2" in
+ /tmp)
+ printf 'Filesystem 1024-blocks Used Available Capacity Mounted on\n'
+ printf '/dev/tmp 1000 0 120 0%% /tmp\n'
+ return 0
+ ;;
+ /opt/pulse)
+ printf 'Filesystem 1024-blocks Used Available Capacity Mounted on\n'
+ printf '/dev/root 1000 0 90 0%% /\n'
+ return 0
+ ;;
+ esac
+ fi
+ command df "$@"
+ }
+ ensure_update_disk_headroom /tmp /opt/pulse
+ `
+
+ out, err := exec.Command("bash", "-c", script).CombinedOutput()
+ if err != nil {
+ t.Fatalf("bash: %v\n%s", err, out)
+ }
+}
+
func TestRootInstallScriptAutoRegisterUsesSecureContractShape(t *testing.T) {
content, err := os.ReadFile(filepath.Join("..", "..", "install.sh"))
if err != nil {