Skip to content

Fix LXC password reset (501 on nonexistent lxc/exec endpoint) - #33

Merged
greenlogles merged 2 commits into
mainfrom
fix/lxc-reset-password
Jul 15, 2026
Merged

Fix LXC password reset (501 on nonexistent lxc/exec endpoint)#33
greenlogles merged 2 commits into
mainfrom
fix/lxc-reset-password

Conversation

@greenlogles

Copy link
Copy Markdown
Owner

Summary

Fixes a 501 Not Implemented when resetting an LXC container's root password.

The handler called POST /nodes/{node}/lxc/{vmid}/exec, which Proxmox does not implement — LXC has no REST exec endpoint (unlike QEMU's guest-agent agent/exec); pct exec is CLI-only.

501 Not Implemented: Method 'POST /nodes/node3/lxc/210/exec' not implemented

Fix

Run pct exec <vmid> -- chpasswd on the node over the same channels ProxUI already uses for snippet writes, feeding root:<password> on stdin so the secret never appears in the process list or shell history:

  1. SSH as root — ProxUI's key installed and port 22 open (password on the stdin pipe).
  2. node Shell — root@pam console, via a short-lived temp file that's removed after.

_ssh_run_root gained an optional stdin_data; a new _reset_lxc_root_password helper does the tiering; the route returns a clear, actionable error if no channel is usable.

Requirements / behavior

  • Needs ProxUI SSH access set up to the node (Cloud-Init → Custom Snippet → Set up access) or a root@pam connection — there is no API path for LXC exec.
  • The container must be running (already enforced).
  • QEMU password reset (guest agent + cipassword fallback) is unchanged.

Testing

  • 167 unit tests pass; black clean. Live pct exec path should be exercised against a running container on deploy.

Resetting an LXC root password called POST /nodes/{node}/lxc/{vmid}/exec,
which Proxmox does not implement (LXC has no REST exec, unlike QEMU's guest
agent), so it returned 501 Not Implemented.

Run 'pct exec <vmid> -- chpasswd' on the node over the existing SSH / node-Shell
channels instead, feeding root:<password> on stdin so the secret never appears
on the command line. Requires ProxUI SSH access to the node or a root@pam
connection; the container must be running.
The SSH tier connected to the configured API endpoint for every node
(connection_metadata maps discovered nodes to that endpoint), so resetting a
container on a non-endpoint node ran pct exec on the wrong node:
'Configuration file nodes/<endpoint>/lxc/<vmid>.conf does not exist'.

Resolve the owning node's real address via cluster status and target it for
the SSH tier (new host override on the SSH helpers). The termproxy tier already
reaches the right node, since /nodes/<node>/termproxy is proxied there.
@greenlogles
greenlogles merged commit 96597be into main Jul 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant