Hot Downloads

Altaro Free VM Backup

How to Fix VMware ESXi Virtual Machine 'Invalid Status'

Written by Administrator. Posted in Virtualization & VM Backup

5 1 1 1 1 1 Rating 5.00 (1 Vote)
Pin It

In this article, we'll show you how to deal with VMs which are reported to have an Invalid Status as shown in the screenshot below. This is a common problem many VMware and System Administrators are faced with when dealing with VMs. We'll show you how to enable SSH on ESXi (required for this task), use the vim-cmd to obtain a list of the invalid VMs, use the vim-cmd /vmsvc/unregister command to unregister - delete the VMs and edit the /etc/vmware/hostd/vmInventory.xml file to remove the section(s) that references the invalid VM(s).

The Invalid Status issue is usually caused after attempting to delete a VM, manually removing VM files after a vMotion, a problem with the VMFS storage or even after physically removing the storage from the ESXi host e.g replacing a failed hdd.

esxi vm machine invalid status

 Another difficulty with VMs stuck in an Invalid Status is that VMware will not allow you to remove or delete any Datastore associated with the VM e.g if you wanted to remove a HDD. For safety reasons, you must first remove or migrate the affected VM so that there is no VM associated with the Datastore before VMware allows you to delete it.

Concerned about your VM machines and their data? Download now your Free Enterprise-grade VM Backup solution

The screenshot below shows ESXi failing to delete datastore 256G-SSD - which is used by VM FCX-ISE1 above, now reported to be in an Invalid Status:

esxi vm unable to delete datastore

As most System Administrators discover in these situations - they are pretty much stuck and the only way to remove the VM, now marked as 'Invalid', is to delete it as the Unregister option cannot be selected when right clicking on top of the VM:

esxi vm invalid status delete unregister option unavailable

Notice in the screenshot above how the Unregister or Delete menu options are not available.

The only method to delete this VM is to use the SSH console on the ESXi host and execute a number of commands. This implies that SSH has been enabled on the ESXi host.

Read our quick guide on “How to enable SSH on an ESXi host” if SSH is not enabled on your ESXi host.

Once ssh is enabled, connect to your ESXi host with any ssh client such as e.g Putty using your ESXi root credentials, then use the vim-cmd with the following parameters to obtain a list of the invalid VMs:

[root@esxi1:~] vim-cmd vmsvc/getallvms | grep invalid
Skipping invalid VM '8'
[root@esxi1:~]

From the command output it is apparent that VM No.8 is the one we are after.  As a last attempt we can try to reload the VM in hope it will rectify the problem by executing the vim-cmd vmsvc/reload command:

[root@esxi1:~] vim-cmd vmsvc/reload 8
(vmodl.fault.SystemError) {
   faultCause = (vmodl.MethodFault) null,
   faultMessage = <unset>,
   reason = "Invalid fault"
   msg = "Received SOAP response fault from [<cs p:03d09848, TCP:localhost:80>]: reload
vim.fault.InvalidState"
}

Unfortunately, no joy. We now need to proceed to unregister/delete the VM using the vim-cmd /vmsvc/unregister command as shown below:

[root@esxi1:~] vim-cmd /vmsvc/unregister 8

Once the command is executed, the invalid VM will magically disappear from the ESXi GUI interface:

esxi vm machine invalid vm deleted

Another way to delete the VM is to edit the /etc/vmware/hostd/vmInventory.xml file and remove the section that references the invalid VM. In the snippet below we need to simply remove the highlighted text:

<ConfigRoot>
  <ConfigEntry id="0000">
    <objID>1</objID>
    <secDomain>23</secDomain>
    <vmxCfgPath>/vmfs/volumes/5a87661c-a465347a-a344-180373f17d5a/Voyager-DC/Voyager-DC.vmx</vmxCfgPath>
  </ConfigEntry>
  …………
  <ConfigEntry id="0008">
    <objID>8</objID>
    <secDomain>54</secDomain>
    <vmxCfgPath>/vmfs/volumes/   </vmxCfgPath>
  </ConfigEntry>
</ConfigRoot>

When finished, simply save the vmInventory.xml file.

Summary

This article showed how to deal with an ESXi VM that is in an invalid status. We explained possible causes of this issue, how to enable SSH on ESXi and the SSH commands required to reload or delete the invalid VM. Finally we saw how to delete a VM by executing the vim-cmd /vmsvc/unregister command or editing the vmInventory.xml XML file.

Back to Virtualization & VM Backup Section

Pin It

Articles To Read Next:

CCENT/CCNA

Cisco Routers

  • SSL WebVPN
  • Securing Routers
  • Policy Based Routing
  • Router on-a-Stick

VPN Security

  • Understand DMVPN
  • GRE/IPSec Configuration
  • Site-to-Site IPSec VPN
  • IPSec Modes

Cisco Help

  • VPN Client Windows 8
  • VPN Client Windows 7
  • CCP Display Problem
  • Cisco Support App.

Windows 2012

  • New Features
  • Licensing
  • Hyper-V / VDI
  • Install Hyper-V

Linux

  • File Permissions
  • Webmin
  • Groups - Users
  • Samba Setup