At some point everyone has more than likely dealt with a file lock situation. A VM is inaccessible in the inventory, the .vmx file is greyed out, and any attempt to power it on will fail. Identifying the lock has never been an issue for me… It’s the removing of the said lock that has always given me a hard time. I had an issue today with an inaccessible VM, and I could not remove the .vmx.lck file. In the past I’ve been able to remove the .lck file and add the VM to inventory. Typically the next step was to put the host into maintenance mode and reboot it to free the lock. This has always been an inefficient process to me.
While evacuating my host, I came across this VMware KB. It must have been updated from the last time I viewed it becuase I do not recall the part about checking to see if the VM still has a running process. I logged into the host where the file was locked, and ran “esxcli vm process list”. Sure enough, the VM was showing as a running process on the host. I killed the world-id, and was successfully able to delete the .lck file. After that the VM powered up without issue.