Unable to Write VMX File – Error while managing Virtual Machines
search cancel

Unable to Write VMX File – Error while managing Virtual Machines

book

Article ID: 406132

calendar_today

Updated On:

Products

VMware vSphere ESXi 8.0

Issue/Introduction

  • After restoring a virtual machine using a backup solutions to NFS volume, you may encounter the following error during reconfiguration or power-on operations:
  • Unable to write VMX file: Error on the virual machine.
  • This issue typically occurs when the server logs "Stale file handle" errors in response to NFS41 file open requests.

Environment

VMware vSphere ESXi 8.0.x

Datastore : NFS v4.1

Cause

The issue stems from stale file handle entries in the Directory Name Lookup Cache (DNLC) used by the NFS v4.1. These stale entries prevent the VMX lock file (*.vmx.lck) from being accessed correctly.

From: /var/log/vmkernel.log:

WARNING: NFS41: NFS41FSOpGetObject: Failed to get object: Stale file handle
NFS41: NFS41FileOpenFile: Open of 0x0 name VM_Name.vmx.lck failed: Stale file handle
NFS41: NFS41FileOpOpenFile: Open failed: Stale file handle

From: hostd.log

Hostd[]: [Originator sub=Vigor.Vmsvc.vm:/vmfs/volumes////VM_Name.vmx opID="" sid="" user=vpxuser:VSPHERE.LOCAL\sppdeploy] Commit Vigor batch operation message: Unable to write VMX file: /vmfs/volumes////VM_Name.vmx

Resolution

The issue is fixed in VMware ESXi 8.0 Update 3 Build 24859861 and later version, this build includes logic to automatically clear stale entries in the DNLC, resolving the stale file handle issue.

If anyone unable to upgrade to above fixed version, they can follow the below workaround meantime.

Workaround: Disable DNLC for NFS41

[Option-1]

1. Check Current DNLC Status

$ esxcfg-advcfg -g /NFS41/EnableDnlc
Value of EnableDnlc is 1

2. Disable DNLC Globally

$ esxcfg-advcfg -s 0 /NFS41/EnableDnlc

3. Verify DNLC Is Disabled

$ esxcfg-advcfg -g /NFS41/EnableDnlc
Value of EnableDnlc is 0

[Option-2]

1. List NFS41 Mounts

$ esxcli storage nfs41 list

2. Open vsish and Navigate to Volume

$ vsish
> cd vmkModules/nfs41client/mnt/NFS41

3. Check DNLC Status

get properties
# Look for: enableDnlc:1

4. Disable DNLC

set properties enableDnlc 0

5. Verify

get properties
# Should show: enableDnlc:0

6. Exit vsish

exit

Additional Information

Note:

  • This workaround is intended for troubleshooting or temporary use only.

  • Permanent resolution requires updating to the fixed ESXi build.