Like everything else, there are more than a few ways to do this. We’ll cover them here from least to most painful. All of these require access to the service console, so ESXi users… Sorry.
vmware-cmd stop hard
- Log into the service console (SSH, iLO, KVM, etc)
- Type “vmware-cmd –l” This will return a list of all VM’s & their paths
- Check the VM’s state “vmware-cmd /the/path/from/step/two.vmx getstate”
- Let’s try to stop stop the VM “vmware-cmd /the/path/from/step/two.vmx stop trysoft”
- Didn’t work? Time for a larger bat: “vmware-cmd /the/path/from/step/two.vmx stop hard”
This method is the safest, as in step 4 we try to use the tools to gracefully turn the VM off. Failing that, we do the equilivant of pulling the power.
vm-support –X
This one is a bit more cumbersome as it generates a bunch of support debugging data as well, but it should be your next step in killing a stuck VM.
- Log into the Service Console
- We need to get the VMID of the VM that we’re killing “vm-support –x” (that’s a little x)
- Kill the VM! “vm-support –X vmid”
- Answer the prompts, paying special attention to the “ABORT” question, you want to answer yes to that.
- In about 5 to 10 minutes, the VM will be off, and there will be a tar file in the directory you ran the command from that can be sent along to support.
Like I said, a bit more cumbersome, but much less likely to have any long term effects.
vmkload_app –kill 9
This method is still yet more awkward, but still has quite a bit of grace to it.
- Log into the Service Console
- We need to get the VMID of the VM that we’re killing “vm-support –x” (that’s a little x)
- Now we need to get the ‘World ID’ “less /proc/vmware/vm/(the value from #2)/cpu/status
- Look for the ‘Group’ field, it will contain a value like ‘vm.1293’
- Now hit it with a bat: “/usr/bin/vmware/vmkload_app –k 9 1293”
You will get a warning that you have sent ‘signal 9’ to world 1293 (or your ID) and it should be quite dead.
kill –9 pid
I hate even putting this here, but sometimes things refuse to die. Please keep in mind that this should ONLY be used as a last resort, as it is like swatting a fly with a Cadillac.
- Log into the Service Console
- Get the pid “ps auxwww | grep vmx”
- Kill it with “kill –9 pid”
Straight forward, but then again so is pulling the pin on a grenade. The results will likely be the same.
3 thoughts on “Killing a Stuck or Hung VM”
Comments are closed.