fix: remove password from LXC config update (not supported by Proxmox API)

This commit is contained in:
2026-03-02 07:31:47 -05:00
parent 3879dab60b
commit 153bcfcea5
2 changed files with 14 additions and 7 deletions

View File

@@ -470,15 +470,23 @@ class Overview extends Component
// Refresh the server model to get latest data
$this->server->refresh();
// Apply password via Proxmox API using cloud-init
// LXC containers don't support password change via config API
if ($this->server->node->is_lxc) {
$this->notify('Password saved to database. Note: LXC container passwords cannot be changed via API - use console access to change root password if needed.', 'warning');
$this->isEditingPassword = false;
$this->password = '';
$this->password_confirmation = '';
$this->passwordError = '';
return;
}
// Apply password via Proxmox API using cloud-init (KVM only)
$proxmox = new Proxmox;
$vmType = $this->server->node->vmType();
// For KVM: cipassword sets the password via cloud-init on next boot
// For LXC: password sets the root password directly
$passwordKey = $this->server->node->is_lxc ? 'password' : 'cipassword';
$response = $proxmox->request('/nodes/' . $this->server->node->name . '/' . $vmType . '/' . $this->server->vm_id . '/config', 'put', [
$passwordKey => $this->password,
'cipassword' => $this->password,
]);
// The request() method throws on error, so if we get here, it was successful

View File

@@ -613,9 +613,8 @@ class Proxmox extends ClassServer
'hostname' => $server->hostname,
];
if ($password) {
$data['password'] = $password;
}
// Note: LXC password cannot be set via config PUT - only during pct create.
// Password from cloned template is preserved, or use pct exec to change it.
// Resize rootfs disk
$this->requestAndWait('/nodes/' . $server->node->name . '/lxc/' . $server->vm_id . '/resize', 'put', [