From 4fbb118072129de5990393c0a19f7c21509680c8 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 15 Nov 2025 13:25:07 +0000 Subject: [PATCH] Add PULSE_LXC_CTID env override for LXC CTID detection Modern Proxmox LXC containers (cgroup v2 + systemd) don't expose the CTID inside the guest namespace. The auto-detection in DetectLXCCTID() works for older LXC setups and when hostname is numeric, but fails for most production containers where users set custom hostnames. Changes: - Added PULSE_LXC_CTID environment variable override in router.go:490-495 - Graceful fallback: auto-detect first, then check env var, then show placeholder - UI already handles missing CTID by showing "pct exec " placeholder This provides a robust solution for thousands of users: - Stock Proxmox LXC: Shows `pct exec ` placeholder (user substitutes manually) - Custom hostname containers: Can set PULSE_LXC_CTID=171 in compose/systemd - Numeric hostname containers: Auto-detected (backwards compatible) Related: FirstRunSetup.tsx already has graceful fallback (line 336-339) --- internal/api/router.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/api/router.go b/internal/api/router.go index db07f3c..8fdcbfe 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -487,8 +487,11 @@ func (r *Router) setupRoutes() { status["bootstrapTokenPath"] = r.bootstrapTokenPath status["isDocker"] = os.Getenv("PULSE_DOCKER") == "true" status["inContainer"] = system.InContainer() + // Try auto-detection first, then fall back to env override if ctid := system.DetectLXCCTID(); ctid != "" { status["lxcCtid"] = ctid + } else if envCtid := os.Getenv("PULSE_LXC_CTID"); envCtid != "" { + status["lxcCtid"] = envCtid } if containerName := system.DetectDockerContainerName(); containerName != "" { status["dockerContainerName"] = containerName