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
Wait for rootless runtime mounts to release
rcourtmanfec53eb39eb2
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 05cb25d54d..9f81fa9706 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -7346,7 +7346,11 @@ including stats and secondary inventory, rather than accepting an earliersemantic-only report and racing the evidence assertion.Cleanup removes the exact fixture containers through both still-live runtimeAPIs before stopping their services or deleting storage, so Podman namespace-and shared-memory mounts cannot outlive the state they protect.+and shared-memory mounts cannot outlive the state they protect. After both+runtime services and the delegated user manager stop, cleanup waits until the+kernel mount table contains no mount at or below any dedicated runtime state+root before deleting that state; an empty runtime inventory or a successful+systemd stop alone is not mount-release evidence.The wrapper must compile every Go artifact with mandatory VCS stamping so amissing revision or unavailable clean-worktree proof fails before live evidencecan be emitted; the receipt and validator retain the exact artifact hashes anddiff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex c2bb27fb94..6c2f2487ca 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -268,7 +268,10 @@ systemd user-manager cleanup cannot erase completed qualification evidence.Direct recovery is complete only after the full stable telemetry digest isobserved; the first semantic-only report cannot satisfy the qualification wait.Final cleanup removes the exact rootless and rootful fixture containers while-both runtime APIs are live, then stops the services and removes runtime state.+both runtime APIs are live, then stops the services and delegated user manager.+It deletes runtime state only after the kernel mount table proves that no mount+remains at or below any dedicated runtime root; container inventory and unit+state alone cannot authorize storage deletion.The outer wrapper forgets a tracked container only after strict labeled removalsucceeds, preventing already-removed hosts from producing false manual-cleanupwarnings when a later runtime fails.diff --git a/scripts/installtests/secure_runtime_rootless_qualification_test.go b/scripts/installtests/secure_runtime_rootless_qualification_test.goindex 69a9ded230..8fb7689a75 100644--- a/scripts/installtests/secure_runtime_rootless_qualification_test.go+++ b/scripts/installtests/secure_runtime_rootless_qualification_test.go@@ -430,6 +430,7 @@ func TestSecureRuntimeRootlessQualification(t *testing.T) {rootlessQualStopUnit(t, daemon.rootlessUnit)rootlessQualStopUnit(t, daemon.rootfulUnit)rootlessQualStopUserManager(t, daemon)+ rootlessQualWaitRuntimeMountsReleased(t, daemon, 30*time.Second)rootlessQualRemoveRuntimeState(t, daemon)rootlessQualAssertPulseRemoved(t)for _, socket := range []string{daemon.rootlessSock, daemon.rootfulSock} {@@ -1173,13 +1174,89 @@ func rootlessQualAssertPulseRemoved(t *testing.T) {func rootlessQualRemoveRuntimeState(t *testing.T, d rootlessQualDaemon) {t.Helper()- for _, path := range []string{d.home, filepath.Join("/run/user", strconv.Itoa(d.uid)), "/var/lib/pulse-rootful-docker", "/var/lib/containers/storage"} {+ for _, path := range rootlessQualRuntimeStateRoots(d) {if err := os.RemoveAll(path); err != nil {t.Fatalf("remove runtime state %s: %v", path, err)}}}+func rootlessQualRuntimeStateRoots(d rootlessQualDaemon) []string {+ return []string{d.home, filepath.Join("/run/user", strconv.Itoa(d.uid)), "/var/lib/pulse-rootful-docker", "/var/lib/containers/storage"}+}++func rootlessQualWaitRuntimeMountsReleased(t *testing.T, d rootlessQualDaemon, timeout time.Duration) {+ t.Helper()+ deadline := time.Now().Add(timeout)+ var remaining []string+ for {+ mountInfo, err := os.ReadFile("/proc/self/mountinfo")+ if err != nil {+ t.Fatalf("read kernel mount table before runtime-state deletion: %v", err)+ }+ remaining, err = rootlessQualMountPointsBelow(string(mountInfo), rootlessQualRuntimeStateRoots(d))+ if err != nil {+ t.Fatalf("parse kernel mount table before runtime-state deletion: %v", err)+ }+ if len(remaining) == 0 {+ return+ }+ if time.Now().After(deadline) {+ t.Fatalf("runtime mounts remain after service shutdown: %q", remaining)+ }+ time.Sleep(100 * time.Millisecond)+ }+}++func rootlessQualMountPointsBelow(mountInfo string, roots []string) ([]string, error) {+ cleanRoots := make([]string, 0, len(roots))+ for _, root := range roots {+ if root = filepath.Clean(strings.TrimSpace(root)); root != "." {+ cleanRoots = append(cleanRoots, root)+ }+ }+ var matches []string+ for lineNumber, line := range strings.Split(mountInfo, "\n") {+ if strings.TrimSpace(line) == "" {+ continue+ }+ fields := strings.Fields(line)+ if len(fields) < 6 {+ return nil, fmt.Errorf("line %d has %d fields", lineNumber+1, len(fields))+ }+ mountPoint, err := rootlessQualDecodeMountInfoPath(fields[4])+ if err != nil {+ return nil, fmt.Errorf("line %d mount point: %w", lineNumber+1, err)+ }+ mountPoint = filepath.Clean(mountPoint)+ for _, root := range cleanRoots {+ if mountPoint == root || root == string(filepath.Separator) || strings.HasPrefix(mountPoint, root+string(filepath.Separator)) {+ matches = append(matches, mountPoint)+ break+ }+ }+ }+ sort.Strings(matches)+ return slices.Compact(matches), nil+}++func rootlessQualDecodeMountInfoPath(value string) (string, error) {+ var decoded strings.Builder+ decoded.Grow(len(value))+ for i := 0; i < len(value); i++ {+ if value[i] != '\\' {+ decoded.WriteByte(value[i])+ continue+ }+ if i+3 >= len(value) || value[i+1] < '0' || value[i+1] > '7' || value[i+2] < '0' || value[i+2] > '7' || value[i+3] < '0' || value[i+3] > '7' {+ return "", fmt.Errorf("invalid mountinfo escape at byte %d", i)+ }+ decoded.WriteByte((value[i+1]-'0')*64 + (value[i+2]-'0')*8 + value[i+3] - '0')+ i += 3+ }+ return decoded.String(), nil+}+func rootlessQualRemoveFixtures(t *testing.T, d rootlessQualDaemon) {t.Helper()rootlessQualRemoveFixtureSet(t, rootlessQualCLI(d, true))@@ -1514,6 +1591,40 @@ exit 2}}+func TestRootlessQualificationMountReleaseUsesExactKernelPaths(t *testing.T) {+ mountInfo := strings.Join([]string{+ "36 25 0:32 / /var/lib/containers/storage rw,relatime - overlay overlay rw",+ "37 36 0:33 / /var/lib/containers/storage/overlay/abc/merged rw,relatime - overlay overlay rw",+ "38 25 0:34 / /var/lib/containers/storage-other rw,relatime - tmpfs tmpfs rw",+ "39 25 0:35 / /var/lib/pulse\\040rootless/data rw,relatime - tmpfs tmpfs rw",+ "40 25 0:36 / /var/lib/pulse\\134rootless/data rw,relatime - tmpfs tmpfs rw",+ }, "\n")++ got, err := rootlessQualMountPointsBelow(mountInfo, []string{+ "/var/lib/containers/storage",+ "/var/lib/pulse rootless",+ `/var/lib/pulse\rootless`,+ })+ if err != nil {+ t.Fatal(err)+ }+ want := []string{+ "/var/lib/containers/storage",+ "/var/lib/containers/storage/overlay/abc/merged",+ "/var/lib/pulse rootless/data",+ `/var/lib/pulse\rootless/data`,+ }+ if !slices.Equal(got, want) {+ t.Fatalf("mounts beneath runtime roots = %q, want %q", got, want)+ }+ if _, err := rootlessQualMountPointsBelow("1 2 3", []string{"/var/lib/containers/storage"}); err == nil {+ t.Fatal("malformed mountinfo line was accepted")+ }+ if _, err := rootlessQualMountPointsBelow("1 2 3 4 /bad\\09x 6", []string{"/bad"}); err == nil {+ t.Fatal("malformed mountinfo escape was accepted")+ }+}+func TestRootlessQualificationStopAcceptsCollectedTransientUnit(t *testing.T) {tempDir := t.TempDir()logPath := filepath.Join(tempDir, "systemctl.log")