How to Fix VMware ESXi Virtual Machine 'Invalid Status'
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.
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
Related Articles:
- 6 Key Areas to Consider When Selecting a VM Backup Solution
- Understanding Deduplication. Complete Guide to Deduplication Methods & Their Impact on Storage and VM Backups
- Differences Between VMware vSphere, vCenter, ESXi Free vs ESXi Paid, Workstation Player and Pro
- How to Enable SNMP on VMware ESXi Host & Configure ESXi Firewall to Allow or Block Access to the SNMP Service
- How to Enable or Disable SSH on VMware ESXi via Web GUI, vSphere Web GUI (vCenter), vSphere Client and Shell Console
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:
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:
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:
(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:
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.
Your IP address:
18.117.72.244
Wi-Fi Key Generator
Follow Firewall.cx
Cisco Password Crack
Decrypt Cisco Type-7 Passwords on the fly!