×


Steps to kill an unresponsive Virtual Machine

Are you trying to figure out how to kill an unresponsive virtual machine?

This guide is for you.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix VMWare related errors.
In this context, you shall learn the steps to kill an unresponsive Virtual machine.


What makes a Virtual machine to become unresponsive?

Sometimes we see that a certain virtual machine on the VMWare ESXi host freezes and it is impossible to turn off or restart it from the vSphere console by any means.
Moreover, it is not advisable to reboot the entire ESXi host due to a single virtual machine.
If the virtual machine process on the ESXi server freezes, it stops responding to vCenter Reset/Power Off commands.

As a result, it returns one of the following errors to any action:
i. Another task is already in progress;
ii. The virtual machine might be performing concurrent operations. Actions: Complete the concurrent operation and retry the power-off operation; The virtual machine is in an invalid state;
iii. The attempted operation cannot be performed in the current state.

How to kill an unresponsive virtual machine?

Follow the steps below to manually kill the virtual machine process on the ESXi host from the ESXi Shell or PowerCLI command prompt;
1. First, we determine the hung virtual machine is running on which ESXi host. For that, we find the VM in the vSphere Client interface. The ESXi hostname on which VM is running is specified under the Summary tab in the Related Object >> Host section.
2. Next, we enable the SSH access protocol on the ESXi host. We do it from the vSphere interface. For that, we click on the ESXi hostname and go to Configure >> Services >> SSH >> Start.
3. Now we can connect to this host via SSH using the putty client. We run the below command to list the VMs running on the ESXi host.

esxcli vm process list

From the above command's result, we copy the “World ID” of the problem virtual machine.
4. We execute the below command to terminate the process of a hung virtual machine on an ESXi host.

esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber

5. In our example, we are trying to softly stop the VM with the specified ID:

esxcli vm process kill --type=soft -w=20598247

The VM powers off.
6. Now we stop the frozen virtual machine using the PowerCLI. We also check that the VM is running.

get-vm “web1" | select name,PowerStates

7. Then we force to stop the VM process.

stop-vm -kill "web1" -confirm:$false

8. Also, we can stop an unresponsive VMWare virtual machine using the ESXTOP utility.
For that, we open the SSH session, enter the esxtop, press “c” to display CPU resources and then we press SHIFT+V to display only virtual machine processes.
9. Then we press “f” (to select fields to be displayed), “c” (to display the LWID- Leader World Id), and then press ENTER.
10. After that, in the Name column, we find the virtual machine to be stopped and note its LWID number in the corresponding column.
11. Now, we press the “k” (kill) and enter the LWID number of the virtual machine that we want to force shut down.
12. And the last way of VM “hard“ power off is to use the kill tool. This method will stop not only the VM but also all child processes.
For that, we get the parent process ID of the VM:

ps | grep "web2"

Finally, we kill the VM process.

kill -9 24288473


[Need additional help in fixing VMWare errors? – We are available to help you today.]


Conclusion

This article will guide you through the steps to kill an unresponsive Virtual Machine in VMWare ESXi.