The message that VMware failed to lock the file when you try to start up a virtual machine, along with the notification that VMware failed to start the virtual machine may sound a bit alarming when you first encounter it. VMware may throw in an additional mention of a module ‘disk’ power on failed for extra drama. Luckily this situation can be fixed pretty easily so you don’t need to fear that your virtual machine is lost. In fact, I’ve seen increasingly more occurrences of this annoyance lately so I figured I’d publish this documented approach to help you recover your virtual machine quickly. Not to worry, the solution is pretty simple and by the time you’ve read through this page you’ll have your virtual machine humming along quite happily again.
The entire VMware failed to lock the file message reads something like this:
Failed to lock the file
Cannot open the disk “path to your vmdk file” or one of the snapshot disks it depends on.
Module ‘Disk’ power on failed.
Failed to start the virtual machine.
For the sake of completeness, I’ve included a screenshot of the message as it appeared on my system a couple of days ago.
In order to fix the message that VMware failed to lock the file, you need to look for so-called “lock” files or “lock” folders in your virtual machine folder. Lock files are typically used to indicate that certain files are “in use” and cannot be modified or tampered with. This is the case when your virtual machine is running. That being said, it’s pretty normal to find lock files or folders in your virtual machine folder whenever you launch or start a virtual machine.
This image below here illustrates my virtual machine folder when the virtual machine is in a suspended state (not running).
As you can see, it contains all the normal files that we’d expect to be there, such as a bunch of log files, nvram file (to store the state of the virtual machine’s BIOS), vmdk files (to store the actual data of the hard drives of my virtual machine), vmsd file (snapshot information), vmx file (primary configuration file) and a few more that are essential for the health of my virtual machine.
I’m not going to go in detail about the exact use of each of these file types as this would lead us to far and besides, we want to focus on dealing with the VMware failed to lock the file message.
Speaking of which, as soon as I start my VMware virtual machine, I will notice a few new inhabitants in my virtual machine folder, as illustrated in the image below.
As you can see, the new arrivals have a .lck file extension, which refers to their nature (lock files). Now normally this wouldn’t be a problem since whenever I decide to properly shut down or suspend my virtual machine, VMware will clean up after itself and will remove the lock files.
But, we must face the fact in our daily work that the devil is in the detail. Notice how I mentioned above “whenever I decide to properly shut down ...”
Whenever an unexpected termination of the running virtual machine comes along (for instance when the host machine loses power or experiences a hang), VMware may not get the time or resources to clean up any .lck lock files and they will remain in your virtual machine folder and still be present at the time when you decide to power up your virtual machine the next time.
VMware will then discover that there are still lock files present and will throw the VMware failed to lock the file message, because it will conclude that the file is currently in a lock condition.
The solution is not complicated: simply delete any .lck files or folders you find inside the folder of your virtual machine and you should be good to go. If you’re really paranoid and want to make double sure that you don’t mess anything up by deleting these files, you can also rename them to another extension than .lck (for instance .lckold or something along these lines). That way VMware will not see any .lck files and you get the opportunity to check whether or not you can start your virtual machine again in good health before you have to decide if you should delete the renamed .lck files after all.
You may note that you encounter the VMware failed to lock the file message even though your host computer did not experience any sudden crashes or power losses, but I’ve seen on more than one occasion that this situation occurred due to a scheduled Windows 10 update operation.
As you may have noticed already, some Windows 10 updates require a restart of your computer and they tend to organize a reboot of your system when Windows notices that you’re not actively using the computer, for instance when you’re away from your pc. These reboots can cause trouble for VMware, not giving it the proper indication that any running virtual machines should suspend or shut down.
Whether your VMware virtual machine has fallen victim to one of these infamous Windows 10 update restarts or you were having other kinds of startup trouble, I hope that this article was helpful for you to recover your virtual machine to a healthy working condition.
If you are a fan of VMware virtualization or if you found this article helpful, please like this page (button below) or feel free to leave a short comment in the section below. I’d appreciate it, thanks!