Virtual machine inaccessible or invalid in the vCenter Server UI due to ESXi host file lock
search cancel

Virtual machine inaccessible or invalid in the vCenter Server UI due to ESXi host file lock

book

Article ID: 424735

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • VM displays as invalid or inaccessible in vCenter Server UI.

  • The Register VM option is grayed out in the vSphere Client when browsing the datastore in vCenter Server: Navigate to datastore > Files > Select the VM folder > Click on VM_name.vmx

  • Attempts to register VM via the ESXi host client results in the VM being marked as invalid.

  • /var/run/log/hostd.log in ESXi host contains the following error when the VM is registered:

YYYY-MM-DDTHH:MM:SS In(166) Hostd[####]: [Originator@#### sub=Libs opID=esxui-#### sid=#### user=root] VigorOffline_Init: Failed to initialize VIGOR offline: Cannot open file "/vmfs/volumes/datastore_name/VM_folder/VM_name.vmx": Device or resource busy.
YYYY-MM-DDTHH:MM:SS In(166) Hostd[####]: [Originator@#### sub=Vmsvc.vm:/vmfs/volumes/datastore_name/VM_folder/VM_name.vmx opID=esxui-#### sid=#### user=root] Marking VirtualMachine invalid

Environment

  • VMware vSphere ESXi 7.x

  • VMware vSphere ESXi 8.x

  • VMware vCenter Server 7.x

  • VMware vCenter Server 8.x

Cause

An ESXi host maintains an exclusive lock on VM files to prevent concurrent access across the cluster. When an ESXi host reboots unexpectedly, suffers hardware failure, or experiences unresponsive management agents, the host fails to release the lock. This causes a file availability mismatch in vCenter Server and marks the virtual machine as inaccessible or invalid.

Resolution

Identify the ESXi host holding the lock and clear the stale session.

  1. Execute the following command via SSH on the host where the inaccessible VM resides or previously resided to identify the ESXi host holding the lock : vmfsfilelockinfo -p /vmfs/volumes/datastore_name/VM_folder/VM_name.vmx

  2. Locate the ESXi host associated with the identified MAC address.

  3. Log in to the lock-owning ESXi host via SSH.

  4. If the host is in maintenance mode, exit maintenance mode.

  5. Remove the inaccessible VM from the vCenter Server inventory: Right-click the inaccessible VM > Remove from Inventory

  6. If the Remove from Inventory option is grayed out, a manual cleanup of the stale entry from the vCenter database is required. For detailed instructions, see Orphaned or stale virtual machine removal from vCenter Server

  7. Register the VM via the ESXi SSH: vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_folder/VM_name.vmx

  8. If the registration fails or the host is unresponsive due to hardware issues, a reboot of the lock-owning host is required to release the exclusive lock.

Additional Information