5 Ways to Troubleshoot Unresponsive Virtual Machine in ESXi host

There are few issues which put VMware administrators into a trouble. One among them is troubleshooting unresponsive virtual machine. Virtual machine becomes unmanageable from the usual ways such as cannot power off virtual machine from ESXi host, Cannot access or unlock files on a virtual machine, Unable to manage virtual machine from vSphere client and web client, You cannot edit the properties of virtual machine, Unable to access virtual machine in any way such as Remote console and even you can’t connect via RDP, SSH or even via SSH. We cannot reboot the ESXi host for one virtual machine becomes hung right. Ok Then what else I can do? Don’t worry I will explain the different ways to troubleshoot unresponsive virtual machine or hung virtual machine in ESXi host using various command line options.

5 ways to troubleshoot unresponsive virtual machine in ESXi host

 Let’s discuss 5 different ways to troubleshoot unresponsible virtual machine in ESXi host using various command line tools.

Troubleshooting unresponsive virtual machine using ESXCLI

ESXClLI commands are one of the most used commands by the VMware Administrators. ESXCLI command allows us to manage, configure and troubleshoot virtual machine, network, storage and also ESXi configurations. let’s take a look at how to use ESXCLI command to troubleshoot unresponsive virtual machine in ESXi host.
esxcli vm process list

Troubleshooting Unresponsive Virtual Machine

You need to copy the World ID of the unresponsive virtual machine. Let’s take an example, Unresponsive virtual machines are App-1 & App-2 and respective world ID is 1281357 and 604966.  I can use the below ESXCLI command to kill the virtual machine

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

Troubleshooting Unresponsive Virtual Machine

Troubleshooting unresponsive virtual machine using vim-cmd

What is vim-cmd?

vim-cmd is a vSphere CLI tool available with ESXi host. vim-cmd can be used to perform various activities in a VMware environment. vim-cmd is (virtual infrastructure management) command.  The vim-cmd is associated with the vSphere API – it’s built on top of the hostd which implements the APIs.

How to use vim-cmd to power of unresponsive virtual machine

You need to first get the list of all virtual machines running on the ESXi host using the getallvms command

vim-cmd vmsvc/getallvms

Once you got the list of running VM’s on the ESXi host, you need note down the vmid of the unresponsive virtual machine. Run the vim-cmd power.getstate to get the power state of the virtual machine and vim-cmd power off command to power off the problematic virtual machine with the help of vmid.

vim-cmd vmsvc/power.getstate vmid

vim-cmd vmsvc/power.off vmid

Troubleshooting Unresponsive Virtual Machine

Troubleshoot unresponsive virtual machine using ESXTOP

ESXTOP is the utility available with ESXi host. Which helps to examine real-time resource usage ESXi hosts. esxtop can only be used for the local ESX machine. There are 3 different types of Modes available in esxtop such as Interactive Mode, Batch Mode, and Replay Mode. Let’s see how to stop unresponsive virtual machine using ESXTOP command.

Login to ESXi host using SSH and type the command “ESXTOP”. Press Shift+v to change the ESXtop view to virtual machines.


Troubleshooting Unresponsive Virtual Machine

Press f to add or remove the fields and Press c to add the Leader World ID (LWID) column to the view. Press any key to return to the main menu.

Troubleshooting Unresponsive Virtual Machine

Note down the LWID (Leader WorldID) of the unresponsive virtual machine. Press and Type LWID of the unresponsive virtual machine to kill the unresponsive virtual machine. In my Example, My unresponsive virtual machine is App-1 and LWID is 1453107

Troubleshooting Unresponsive Virtual Machine

Troubleshoot unresponsive virtual machine using PowerCLI

PowerCLI is one of the favorite remote command line tools for many administrators. It simply allows you to automate a lot of day to day tasks. Let’s see how to power off the virtual machine using one-liner PowerCLI command. Stop-vm is to power off the virtual machine and -Kill parameter helps to kill the unresponsive virtual machine.

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

Troubleshooting Unresponsive Virtual Machine

Troubleshoot unresponsive virtual machine using Kill command

Kill word looks forcefully to us. That’s why it is in the last of the list. Kill command always use to kill the process. The virtual machine is also a series of process in the ESXi host.  Execute the below command

ps | grep "Vmname"

Once you got the process ID of the virtual machine. Execute the below command to kill the virtual machine forcefully

kill -9 

Troubleshooting Unresponsive Virtual Machine

I hope this is informative for you. Thanks for Reading !! Be social and share it in social media using social media plugins, if you feel worth sharing it.