Force Stop VM

Troubleshooting: How to Force Cancel a Hung Task in vCenter or ESXi

Posted on Updated on


    Weโ€™ve all been there: a vMotion hits 99% and just… stays there. Or a backup job finishes on the proxy side, but vCenter still thinks the VM is “busy.” Usually, the Cancel button is grayed out, leaving you stuck in management limbo.

    When the GUI fails you, itโ€™s time to hop into the CLI. Here is how to manually kill a hung task by targeting the VM’s parent process.


    Step 1: Verify the Task

    Before pulling the trigger, confirm the task is actually stuck and not just slow. Check the Monitor > Tasks and Events tab for the specific VM. If the progress bar hasn’t budged in an hour and the “Cancel” option is disabled, proceed to the host.

    Step 2: Enable and Connect via SSH

    To kill a process, you need to be on the specific ESXi host where the VM is currently registered.

    1. Enable SSH: Go to the ESXi host in vSphere > Configure > System > Services > Start SSH.
    2. Connect: Open your terminal (Putty, CMD, or Terminal) and log in as root.

    Step 3: Locate the Parent Process ID (PID)

    We need to find the specific process tied to your VM. Use the ps command combined with grep to filter for your VM’s name.

    Run the following command:

    ps -v | grep "Your_VM_Name"

    (Note: Using the -v flag in ESXi provides a more detailed view of the world ID and parent processes.)

    Look for the line representing the VM’s main process. You are looking for the Leader ID or the first ID listed in the row.

    Step 4: Kill the Process

    Once you have identified the ID (e.g., 859467), send the kill signal. Start with a standard terminate signal, which allows the process to clean up after itself.

    Run the command:

    kill 859467

    Lazy Admin Tip: If the process is extremely stubborn and won’t die, you can use kill -9 859467 to force an immediate termination. Use this as a last resort!

    Step 5: Verify in vSphere

    Give vCenter a minute to catch up. The hung task should now disappear or show as “Canceled” in the Tasks and Events console. Your VM should return to an “Idle” state, allowing you to power it on, move it, or restart your backup.