On Proxmox, sometimes a VM refuses to shut down. It’s quite annoying, so here’s the ultimate solution: the “kill -9” of the VM’s PID.
Of course, there are gentler methods before resorting to this, but let’s not get into details!
Start by opening the shell of your Proxmox host server hosting the VM or connect via SSH to it.
We’ll proceed in 3 steps
Retrieve the VMID of our VM
Find the PID corresponding to the VMID
Kill the VM using the PID
The VMID corresponds to the number of your VM, in the left menu of Proxmox next to each of your VMs. (usually 101, 102 etc…)
For the example, we’ll take the VM with VMID 101
Now let’s identify the PID with a little ps aux
ps aux | grep "/usr/bin/kvm -id 101"
root 18109 216 25.7 9947724 8445000
With the output of our command, we’ve just retrieved the PID of the VM.
For our VM, the PID is 18109 (the first block of numbers)
All that’s left is to kill our VM to shut it down.
kill -9 18109
And there you have it! Problem solved, after a few seconds the VM should be shut down.