Killing Wayward VMs in vSphere ESX

From time to time as an ESX admin, you’ve likely come across a VM that doesn’t want to die.  The infamous “Another task is already in progress.” error message likely means you have a VM locked into la-la land, unable to be powered down, reset, restarted, shut down or otherwise manipulated.  If you have ESX, this is about the time you find yourself firing up Putty and heading in to do some low level surgery.

First steps:

  • topping the virtual machine by issuing the command vmware-cmd /vmfs/volumes/<datastorename>/<vmname>/<vmname>.vmx stop.   Equivalent to sending it a shutdown command.  Will probably fail.
  • If this does not work, one can issue the following command: vmware-cmd /vmfs/volumes/<datastorename>/<vmname>/<vmname>.vmx stop hard. This will try to kill the Virtual Machine instantly.  Equivalent to a power off, will likely fail.
  • If that does not work, one can issue the command vm-support -x to list the running VMs and their World IDs, then vm-support -X worldid (note the x is case sensitive in both commands). This then prompts the user with a couple of questions, then runs a debug stop of the VM, and creates a set of log files as well that you can forward to VMware tech support.  This does some fancy background things and is your last stop before calling VMware support.  Not to mention, its a great way to get the PID of all your running VMs.  You can try kill -9 PIDOFYOURVM but that probably won’t work if the previous commands failed.
  • I’ve had to do this about four times in four years, just often to have always forgotten how to do it…


    Leave a Reply

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