This article provides information on stopping virtual machines in an ESXi environment.
Note: If attempting to troubleshoot the cause of an unresponsive virtual machine, it is usually preferable to collect performance metrics and then either suspend or crash the virtual machine to collect additional troubleshooting information.
For more information, see:
Attempt to power off the virtual machine gracefully using the client:
Another task is already in progress"
, wait for the task to complete or see Powering off a virtual machine fails with the error: Cannot power Off: Another task is already in progress or vCenter operation times out with the error: Operation failed since another task is in progress.Note: From vSphere 6.5, enable Virtual Machine Encryption to protect virtual machine and its files. If encryption is enabled on the virtual machine, ensure the logged in user has Cryptographic Operations privileges. For more information on the Privileges, see Prerequisites and Required Privileges for Encryption Tasks section in the ESXi and vCenter Server 7.0 Documentation.
The esxcli command can be used locally or remotely to power off a virtual machine running on ESXi 5.x or later.
.vmx
configuration file:esxcli vm process list
esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber
Use the k
command in esxtop
to send a signal to and kill a running virtual machine process.
esxtop
utility by running this command:esxtop
c
to switch to the CPU resource utilization screen.Shift+v
to limit the view to virtual machines. This may make it easier to find the Leader World ID in step 7.LWID
).k.
World to kill
prompt, type in the Leader World ID from step 7, and press Enter.On the ESXi console, enter Tech Support mode and log in as root.
.vmx
configuration file:vim-cmd vmsvc/getallvms
vim-cmd vmsvc/power.getstate VMID
vim-cmd vmsvc/power.shutdown VMID
vim-cmd vmsvc/power.off VMID
Note: If the above procedures did not resolve the issue and the ESXi host is responsive, it may be required to reboot the host to put the virtual machine in a powered-off state. Migrating all the virtual machines to other ESXi with vMotion to avoid downtime may also be done.
VMware Skyline Health Diagnostics for vSphere - FAQ
Powering off an unresponsive virtual machine on an ESXi host
Troubleshooting virtual machine power on task hangs
Failed to power on virtual machine
Sending signals on ESXi to power off the virtual machine
A virtual machine can be halted from the command line by sending signals to the process.
Warning: This procedure is potentially hazardous to the ESXi host. If improper identification of the appropriate process ID (PID) and the wrong process is killed, it may have unexpected results.
kill
command to send a signal to, and terminate, a running virtual machine process.ps | grep vmx
7662 7662 vmx /bin/vmx
7667 7662 vmx /bin/vmx
7668 7662 mks:VirtualMachineName /bin/vmx
7669 7662 vcpu-0:VirtualMachineName /bin/vmx
vmx
process. Identify the parent vmx
process for the target virtual machine. The first column contains the PID, and the second contains the parent's PID. Ensure only the parent process is terminated. The parent Process ID (PID) for each process is listed in the second column, identified in this example in bold. Take note of this number for use in the following steps.vmx
process is listed, terminate the process by running this command:kill ProcessID
kill -9 ProcessID
If a virtual machine cannot be powered off using any of these methods, it usually indicates a problem with the underlying infrastructure, such as the ESXi host or its backing hardware.
If a problem is suspected with the ESXi host that is preventing the shutdown of virtual machines, vMotion all unaffected virtual machines off the host, and force the host to halt with a purple diagnostic screen. For more information, see Using hardware NMI facilities to troubleshoot unresponsive hosts (344096).