{"id":116,"date":"2024-11-27T11:01:20","date_gmt":"2024-11-27T10:01:20","guid":{"rendered":"https:\/\/kerms.hobby-site.org\/?p=116"},"modified":"2024-11-27T11:01:20","modified_gmt":"2024-11-27T10:01:20","slug":"powering-off-an-unresponsive-virtual-machine-on-an-esxi-host","status":"publish","type":"post","link":"https:\/\/kerms.hobby-site.org\/?p=116","title":{"rendered":"Powering off an unresponsive virtual machine on an ESXi host"},"content":{"rendered":"\n<p>If powering off the virtual machine from vSphere Client or Host Client will not work, you can use one of the command line methods below.<br>&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Determining the virtual machine&#8217;s location<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Determine the host on which the virtual machine is running.<\/li>\n\n\n\n<li>This information is available in the virtual machine&#8217;s Summary tab when viewed in vCenter web client<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Using the CLI to shutdown the unresponsive virtual machine<\/h3>\n\n\n\n<p>There are several methods to power off the non-responsive virtual machine using command line as the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/knowledge.broadcom.com\/external\/article\/308457\/powering-off-an-unresponsive-virtual-mac.html#Using_the_ESXi_command_line\">Using &#8222;vim-cmd&#8220; commands<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/knowledge.broadcom.com\/external\/article\/308457\/powering-off-an-unresponsive-virtual-mac.html#Using_the_ESXi_esxcli_command\">Using &#8222;esxcli&#8220; commands<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/knowledge.broadcom.com\/external\/article\/308457\/powering-off-an-unresponsive-virtual-mac.html#esxtop\">Using esxtop<\/a><\/li>\n<\/ul>\n\n\n\n<p>Its recommended to follow the sections and steps in this article in order.<br>&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br><strong><a><\/a>Using vim-cmd<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in as root to the ESXi using SSH.<\/li>\n\n\n\n<li>Get a list of all registered virtual machines, identified by their VMID and Display Name by running this command:vim-cmd vmsvc\/getallvms<\/li>\n<\/ol>\n\n\n\n<p>Example output:<br><img decoding=\"async\" src=\"https:\/\/api-broadcomcms-software.wolkenservicedesk.com\/attachment\/get_attachment_content?uniqueFileId=1512268513878\"><\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Take note of the impacted virtual machine ID\u00a0VMID<\/li>\n\n\n\n<li>Get the current state of a virtual machine by running this command:vim-cmd vmsvc\/power.getstate VMID<\/li>\n<\/ol>\n\n\n\n<p>Example output:<br><img decoding=\"async\" src=\"https:\/\/api-broadcomcms-software.wolkenservicedesk.com\/attachment\/get_attachment_content?uniqueFileId=1512257459570\"><\/p>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Check if there hanging task on the impacted virtual machine that prevent the machine from powering on by running this command:vim-cmd vmsvc\/get.tasklist VMID<\/li>\n<\/ol>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">(ManagedObjectReference) [\n'vim.Task:haTask-2-vim.VirtualMachine.createSnapshot-1234567',\n'vim.Task:haTask-2-vim.VirtualMachine.consolidateDisks-12345678'\n]<\/pre>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li>Run the\u00a0<code>vim-cmd vimsvc\/task_info task_id<\/code>\u00a0command to see the task in more detail.<\/li>\n<\/ol>\n\n\n\n<p>For example using the data from step 5:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vim-cmd vimsvc\/task_info haTask-2-vim.VirtualMachine.createSnapshot-1234567\n\nvim.TaskInfo) {\ndynamicType = &lt;unset&gt;,\nkey = \"haTask-2-vim.VirtualMachine.createSnapshot-1234567\",\ntask = 'vim.Task:haTask-2-vim.VirtualMachine.createSnapshot-1234567',\ndescription = (vmodl.LocalizableMessage) null,\nname = \"vim.VirtualMachine.createSnapshot\",\ndescriptionId = \"VirtualMachine.createSnapshot\",\nentity = 'vim.VirtualMachine:2',\nentityName = \"VMware vCenter Server Appliance5-1\",\nstate = \"running\",\ncancelled = false,\ncancelable = false,\nerror = (vmodl.MethodFault) null,\nresult = &lt;unset&gt;,\nprogress = 50,\nreason = (vim.TaskReasonUser) {\ndynamicType = &lt;unset&gt;,\nuserName = \"********\",\n},\nqueueTime = \"2014-11-09T17:49:01.171933Z\",\nstartTime = \"2014-11-09T17:49:01.175521Z\",\ncompleteTime = &lt;unset&gt;,\neventChainId = 1234567,\nchangeTag = &lt;unset&gt;,\nparentTaskKey = &lt;unset&gt;,\nrootTaskKey = &lt;unset&gt;,\n}<\/pre>\n\n\n\n<ol start=\"7\" class=\"wp-block-list\">\n<li>The task is hung and needs to be cancelled, use the command:vim-cmd vimsvc\/task_cancel task_id<\/li>\n<\/ol>\n\n\n\n<p><strong>Note<\/strong>:&nbsp;Please note that not all tasks can be canceled. For instance, in the example above we see the snapshot task has the&nbsp;cancelable&nbsp;flag set to&nbsp;false (cancelable = false).<\/p>\n\n\n\n<ol start=\"8\" class=\"wp-block-list\">\n<li>Shutdown the virtual machine using the VMID found in Step 3 and run this command:vim-cmd vmsvc\/power.shutdown VMID<\/li>\n<\/ol>\n\n\n\n<p>Note: If the virtual machine fails to shut down, run this command to hard power-off the VM:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vim-cmd vmsvc\/power.off VMID<\/pre>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/api-broadcomcms-software.wolkenservicedesk.com\/attachment\/get_attachment_content?uniqueFileId=1512263619947\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><a><\/a>Using esxcli<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in as root to the ESXi using SSH.<\/li>\n\n\n\n<li>Get a list of running virtual machines, identified by World ID and Display Name by running this command:<br>esxcli vm process list<\/li>\n<\/ol>\n\n\n\n<p>Example output:<br><img decoding=\"async\" src=\"https:\/\/api-broadcomcms-software.wolkenservicedesk.com\/attachment\/get_attachment_content?uniqueFileId=1512264277886\"><\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Take a note of the world ID of the non-responsive virtual machine. For example in step 3 the World ID is\u00a02750434.<\/li>\n\n\n\n<li>Power off the virtual machine from the list by running one of these commands:esxcli vm process kill -t=soft -w=WorldID or esxcli vm process kill -t=hard -w=WorldID or esxcli vm process kill -t=force -w=WorldID<\/li>\n<\/ol>\n\n\n\n<p><strong>Note<\/strong>: These command provide different levels of force to stop the virtual machine:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Soft is the most graceful<\/li>\n\n\n\n<li>Hard performs an immediate shutdown<\/li>\n\n\n\n<li>Force should be used as a last resort<\/li>\n<\/ul>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>If the VM fails to stop even after running the &#8222;esxcli vm process kill&#8220; command, evacuate all other VMs off the ESXi host and restart the ESXi itself.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><a><\/a>Using esxtop<\/h3>\n\n\n\n<p>Killing a virtual machine using esxtop is equivalent to a forced hard shutdown with esxcli.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in as root to the ESXi host using SSH<\/li>\n\n\n\n<li>Show a list of the currently running virtual machines with esxtopesxtop<\/li>\n\n\n\n<li>Press &#8222;<strong>Shift-V<\/strong>&#8220; to show only running virtual machines.<\/li>\n\n\n\n<li>Press &#8222;<strong>F<\/strong>&#8220; to add new fields, and then &#8222;<strong>C<\/strong>&#8220; to select the LWID (Leader World Id) field. Press &#8222;<strong>Enter&#8220;<\/strong>\u00a0to apply the change<\/li>\n\n\n\n<li>To kill one of the virtual machine processes, Press &#8222;<strong>K<\/strong>&#8220; and copy the\u00a0<strong>LWID<\/strong>\u00a0from the unresponsive VM you wish to kill.<br><br><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"113\" src=\"https:\/\/api-broadcomcms-software.wolkenservicedesk.com\/attachment\/get_attachment_content?uniqueFileId=1587397237732\"><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>If powering off the virtual machine from vSphere Client or Host Client will not work, you can use one of the command line methods below.&nbsp; Determining the virtual machine&#8217;s location Using the CLI to shutdown the unresponsive virtual machine There &hellip; <a href=\"https:\/\/kerms.hobby-site.org\/?p=116\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts\/116"}],"collection":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=116"}],"version-history":[{"count":2,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":118,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions\/118"}],"wp:attachment":[{"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kerms.hobby-site.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}