Error: "Cannot open the configuration file" when trying to power on VM
search cancel

Error: "Cannot open the configuration file" when trying to power on VM

book

Article ID: 308383

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Symptoms:

  • Powering on a virtual machine fails
  • You see below errors in vmware.log :

    Cannot open the configuration file /vmfs/volumes/datastore/virtual machine.vmx.

    Failed to create temporary file, The file already exists (3). errno: 17
    An error occurred while creating temporary file for /vmfs/volumes/datastore/VM directory/VM name.vmx: The file already exist

Environment

  • VMware vCenter Server 7.0.x
  • VMware vSphere ESXi 7.0.x
  • VMware vCenter Server 8.0.x
  • VMware vSphere ESXi 8.0.x

Cause

This issue occurs if the .vmx~ file created while powering on the machine continues to remain on the datastore even after the virtual machine is powered off.

Resolution

To resolve this issue, Delete the .vmx~ file:

  1. Open an SSH session to the ESXi Host where the problematic virtual machine is registered.

  2. Confirm that there is a .vmx file which ends in ~ : vm name.vmx~

    cd /vmfs/volumes/datastore/VM directory
    ls -ltrah

  3. Run the below command inside the VM directory to confirm that all virtual machine files are not locked:

     for file in *;do vmfsfilelockinfo -p "$file" | awk '{FS = "\n"; RS = ""} {print $2 , $7}';done

  4. If a virtual machine file is locked determine what may be locking the file: Investigating Virtual Machine file locks on ESXi Host(s).

  5. Confirm the virtual machine is registered to the host:

    vim-cmd vmsvc/getallvms

  6. Get the current state of the virtual machine in question from the host directly:

    vim-cmd vmsvc/power.getstate <vmid from step 3>

  7. Confirm that the virtual machine cannot be powered on:

    vim-cmd vmsvc/power.on <vmid from step 3>

  8. List the virtual machine directory:

    ls -ltrah

  9. Rename the temporary file causing the power on failure:

    mv vm name.vmx~ vm name.vmx_bak

  10. Power on the virtual machine:

    vim-cmd vmsvc/power.on <vmid from step 3>

Additional Information