Home / Solution / VMware ESXi: How to Kill an Unresponsive (Stuck) Virtual Machine

VMware ESXi: How to Kill an Unresponsive (Stuck) Virtual Machine

Sometimes I see sure digital machine on the VMWare ESXi host freezes and it’s unattainable to flip off or restart it from vSphere console by any means. Rebooting the complete ESXi host due to a single digital machine will not be totally advisable (particularly if in case you have just one ESXi host, or the remaining servers within the DRS cluster are usually not in a position to deal with the additional load of digital machines from the server to be restarted). Consider the primary methods to pressure kill an unresponsive (hung) digital machine on VMWare ESXi host.

If the digital machine course of on the ESXi server freezes, it stops responding on vCenter Reset/Power Off instructions, and returns one of many following errors to any motion:

  • Another process is already in progress;
  • The digital machine is perhaps performing concurrent operations. Actions: Complete the concurrent operation and retry the power-off operation; The digital machine is in an ;
  • The tried operation can’t be carried out within the present state.

In such instances, you’ll be able to manually kill the digital machine course of on the ESXi host from the ESXi Shell or PowerCLI command immediate.

First you want to decide on which ESXi host the hung digital machine is working. To do that, discover the VM within the vSphere Client interface. The ESXi host title on which VM is working is specified on the Summary tab within the Related Object -> Host part.

vmware vsphere client get vm host

Next, SSH entry protocol should be enabled in your ESXi host. You can do it from the vSphere interface. Click on the ESXi host title, go to Configure -> Services -> SSH -> Start.

vmware esxi - run ssh

Now you’ll be able to join to this host by way of SSH utilizing the putty shopper. List the VMs working on the ESXi host:

esxcli vm course of checklist

esxcli vm process list

Copy the “World ID” of the issue digital machine.

To terminate the method of a hung digital machine on an ESXi host, use the next command:

esxcli vm course of kill --type=[soft,hard,force] --world-id=WorldQuantity

There are three kill sorts of the VM course of:

  • Soft – the most secure method to kill the VMX course of (related to kill -SIGTERM);
  • Hard – speedy termination of the VM course of (kill -9);
  • Force – probably the most arduous VM course of cease mode. Should be used final if nothing else helps.
Make certain that there are not any lively snapshots, backups, and related duties for VM, and VM not within the “” state. Otherwise, you’ll be able to break your VM and it’ll have to be restored from backup.

Let’s attempt to softly cease the VM with the desired ID:

esxcli vm course of kill --type=smooth -w=20598249

esxcli vm process kill

The VM ought to powered off.

You can cease the frozen digital machine utilizing the PowerCLI (that is handy, as a result of when connecting to vCenter you don’t want to discover the hostname on which the VM is working and allow SSH shell on it). Check that the VM is working:

get-vm “web1" | choose title,PowerStates

Force cease the VM course of with the command:

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

PowerCLI stop-vm -kill

Also, you’ll be able to cease an unresponsive VMWare digital machine utilizing the ESXTOP utility.

Open the SSH session, enter the esxtop, press “c” to show CPU sources after which SHIFT+V to show solely digital machine processes.

esxtop

Then press “f” (to choose fields to be displayed), “c” (to show the LWID- Leader World Id) after which press ENTER.

esxtop get vm lwid

In the Name column, discover the digital machine to be stopped and word its LWID quantity within the corresponding column.

Now you will have to press “ok” (kill) and enter the LWID variety of the digital machine that you really want to pressure shut down.

And the final method of VM “arduous“ energy off is to use the kill software. This technique will cease not solely the VM, but in addition all baby processes.

Get the dad or mum course of ID of the VM:

ps | grep "web2"

Kill the VM course of:

kill -9 24288474

esxi kill vm process with ps

After such a “arduous reset”, the put in OS will boot within the Recovery mode. In the case of visitor Windows, the display screen will appear like this.

Check Also

Installing SFTP (SSH FTP) Server on Windows with OpenSSH

You can use the official OpenSSH bundle for Windows to simply arrange a safe file …

Leave a Reply

Your email address will not be published. Required fields are marked *