diff --git a/extensions/Servers/Proxmox/Livewire/Overview.php b/extensions/Servers/Proxmox/Livewire/Overview.php index fc5ede60f..9aee24726 100644 --- a/extensions/Servers/Proxmox/Livewire/Overview.php +++ b/extensions/Servers/Proxmox/Livewire/Overview.php @@ -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 diff --git a/extensions/Servers/Proxmox/Proxmox.php b/extensions/Servers/Proxmox/Proxmox.php index d0c51fc0c..40af93d93 100644 --- a/extensions/Servers/Proxmox/Proxmox.php +++ b/extensions/Servers/Proxmox/Proxmox.php @@ -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', [