Sunday, February 24, 2008

VMWare Virtual Machine 'Failed to Lock the File'

Scary moment occurred last week when one of my virtual machines failed to start from VMWare Workstation. The reported error was "failed to lock the file". A bit of searching revealed that I needed to delete the .LCK file in the VM's folder.

The cause for this (I think) was that I had opened the virtual disk of this VM as a mapped drive on the host machine (TIP: very useful feature to get at files from the VM without powering it up - just right click on the .VMDK file in Windows Explorere, and you'll see a couple of options there to map the disk as a drive). That drive was still mapped when trying to start the VM, meaning that the host machine was accessing the VM's files.

137 comments:

Gulzar said...

Great, Your suggestion worked for me in resolving my issue.


Thanks

DrGradus said...

I was on the verge of packing out. A google search quickly pointed me to your blog. And I here I found the answer.

Thanks!

andy ballard said...

Helped me too,
Thanks

Tommy Butler said...

Thanks :D

John said...

Thanks! Very helpful today as I got hit with a power outage.

However, I'm running VMWare server and the lock files end with ".WRITELOCK"

Radiocom1 said...

Thanks. Your suggestion worked very well. Not sure if this is relevant but I use Server 2003 / VMWare 2.0 and found that I had to delete all files and folders with .lck extensions in the copied back up VM to make it work.

Fu Fei said...

Thanks!, it helps

Jose Angel Rivera said...

Thanks!!! It worked for me...I was on panic...lol

aaron said...

Thanks!

Rob said...

Awesome!! Thank you for the post! This fixed my issue. I sweating for a minute. Thanks again!

Family Reunion said...

I was stressing a little - I thought i corrupted my VM files... useful feature, i must say.

Thanks

Ajit Singh said...

Thanks a million for such a useful piece of advice. I have thrown nearly 5 virtual machines due to this problem thinking that they have got corrupted. Thanks again.

Michael said...

Your suggestion was Number 1 on Google. Thank you very very much.

Jimbras said...

YOU ARE THE MAN!!!!!JESUS YOU SAVE MY DAY!!

Many Thanks,
SP from the country of sun,PORTUGAL

Jean Pierre said...

THANK YOU VERY MUCH, YOU SAVE MY DAY !!!!!

Marcelo said...

PERFECT! Thank you!!!

WilG said...

Very Very helpful. Thxs a million.

soops said...

A very helpfull post, many thanks

Dulcardo said...

GREAT!

calebfinley said...

Great, on VMware's site It was so problematic to find a solution. Thanks for posting this, worked like a charm

Ben said...

Thanks very much, another persons problem solved :)

Mizael Longuini de Morais said...

Thank you so much!

jorge said...

Good tip, a failed to lock the file google search brought be straight to your blog and indeed solved the problem in seconds, for people having problems loading the vmware-server ui you should point to localhost as: https://127.0.0.1:8333/ui/ and this should solve the problem.

Aozaki said...

Thank you very much for posting this.

Rostand Abear said...

Thank you, it worked for me too...

Jude said...

Thanks Dude. Very Helpful!

Jude said...

Thanks Dude. It helps a lot

Jude said...

Thanks Dude. It helps a lot

Lucas said...

I did not have any *.lck files in the VM's disk folder but I managed to get it working by removing the Hard Disk from its settings and adding it back in again (VMWare Server).

Darcy said...

This solution really saved my bacon this morning. I left VM running over night and my automatic back up had to shut down the VM. I think this was the reason it locked. Thanks for posting the resolution!

Live Life On Fire said...

Ditto

Ralph Hulslander said...

Gee a year later and it still is helping out.

You'd think it would be documented by now.
Ralph

Reinaldo Ferreira said...

A simple tip solved a huge issue! Thanks a lot!!
Reinaldo

Mohammad said...

Thanks a lot, this helped me on vmware server.

Alain said...

Thank you!

This helped me solve my problem!

Anton said...

Thank you!

This helped me solve my problem too!

GUINEO said...

thanks it works in my laptop , i'm runnin' ubuntu

Kooby said...

Thank you. Great help!

Nate said...

Thought I just lost the shell program that I moved from my flash drive to VM (and deleted from the flash drive afterwards). Google pointed me here. Nice tip, thanks!

mojo said...

Thanks!

I had 80 directories with the LCK extension...moved them to a temp directory and everything booted up.

C said...

Saved my life, great job researching it!!!

Randy said...

THANKS!

This post was the first hit on Google, and saved my bacon. A power outage was followed by the fact that VMWare Fusion would no longer load my Windows XP virtual machine.

I searched my host computer, a Mac, for .lck files and moved them all into a temp folder. VMWare loaded Windows XP no problem after that was done.

Faradade said...

Thanks a lot , it was so helpful

Leighton, Owner, Floating Point Digital Images said...

One change of underwear later - worked like a charm. Thanks!

Mamoun J. said...

Works Amazingly, thanks.

Anders Hedberg said...

Thanks for the comments as well. As someone pointed out there can be multiple lock directories which happend to me.

(I tested the UPS shutdown functionality on my server, which did not work so the machine was turned off while running full load. Left some lockfiles ;)

Les said...

Thanks

dash said...

Thanks for this SO USEFUL tips!
I was really in the "scary moment" part before I apply your solution and that's when I started to cool down!

THANK YOU SO MUCH

Christopher132 said...

I have my VM running off of a Truecrypt file and Radiocom1's suggestion worked for me. "had to delete all files and folders with .lck extensions".

Thanks!

hrishikesh said...

thanks a lot .. i was really panicked..

Sung yun said...

Thanks!!!
Your suggestion
really helped me a lot~

George said...

Worked for me, too! Thanks for the post!!! (Saved my day.)

jail said...

you save me a lot of hours of digging the web!
Thanks!

Mohammed said...

Thanks..iii

its really work for me

Danny said...

My VM had two .lck files: One named after the machine and one named a string of hex characters and dashes. I left the hex one alone and deleted the other and it worked. Thanks!

Manan said...

Thanks :)

Juan said...

This was a life saver, thanks so much. I upgraded VM Server Ver 1 to Ver 2 and the VM's wouldn't mount once updated until I deleted the locked files.

Thanks again,

J.

BackupNow said...

Top man worked for me also

Thanks
Martin

BackupNow said...

Top man worked for me also

Thanks
Martin

Creator said...

cool..thats worked for me too....Thanks man...

Jeff said...

Thanks soooooo much for this!

Krishna Huliyar said...

Thanks a heaps.

Team - Online Systems said...

What a good finding. It did work. Thanks Mate

David said...

worked like a charm. Thanks!

Sergestux said...

Muchas Gracias

amrita_banerjee said...

It helped me too... thank you

thedp said...

Thank you so much, I was so close to throw the notebook against the wall :)

Mal said...

This helped me a lot! thanks!

Mal said...

This helped me a lot! thanks

David said...

My machine says "Failed to Lock the File" but it says there's an issue with the .nvram. I see no .lck files. Anyone ever run into this problem?

David said...

My recent post, I figured it out. I have 4 hosts on a cluster so I had to power it off and migrate it to another host. I think the host I moved it to was the actual original host. It was moved because I had to re-register the VM and it was wrongfully placed on the wrong host. :)

thejasman said...

thanks for this!

i thought my vm was corrupted!

Sum said...

Thanks this worked great. I just deleted the LCK folder of the one it couldnt lock onto. This is after VMware crashed my system
thanks a lot!

Ahmed Eltawil said...

Thanks a bunch, worked like a charm :)

ash said...

Thanks Much... It worked for me..

Admin said...

Thanks ..worked!

Michael said...

thank you thank you thank you!

pax0r said...

Big thx, I spended three hours configuring my VM for my study project, and after power lost I got this message, and you sollution works prefectly :)

Zach said...

Thank You Thank You Thank You Thank You!!!!! I can't believe it was that easy! I was freaking out! I had just done a bunch of work, thought to myself, "Should I back up to my external drive?", said, "Nah", then I started getting that error, and was like, "Holy...!"

You're a lifesaver. I'm so glad you took the time to post this tip. I would never have figured this out!

IT Support said...

Thanks - This was very useful. Time to do a backup I think!

www.sysfix.co.uk

kokrong2b/01 said...

thanks for help. need for study use =]

Agamenon said...

Great Post in your Blog!! Solve my problem instantly. Thanks for Share Knowledge!

Miguel said...

thx a lot!!! xD

Sean said...

March 2011 and i helped me as well.

Thanks
Canmore

Mohamed said...

Good job mate..

panagiotissorras said...

Great!!It works!!!Thanks!!

Sheriff said...

just worked very nicely, thanks

ashok said...

Thank u so much.It worked for me

Siraj Pathan said...

Awesome man, worked for me tooo

Siraj Pathan said...

Awesome, worked for me too

kushal said...

thank dude ,,,,,,,

Perfekt said...

Thanks it worked,my error was due to a power failure

Jason said...

Worked awesome. I had copied my VM from one machine to another and was getting the error.

sri said...

Thanks a zillion for your tip!

There were .lck files within .lck folders, I deleted them and it worked like a charm!

Roland Franssen said...

Didn't know what i just did.. but seems to work perfectly, thanks :-)

Christian Fredh said...

Solved it for me! Thanks!

Amit said...

Its good suggestion and fixed issue. :)

WLANFAN said...

Dude, you just saved me from disaster. Thank you for posting the tip.

Sean - "WLANFAN"

laboratorytested said...

Like Lucas, I too did not have any .lck files in the VM folder. Removing the Hard Disk and adding it back fixed the issue. (vSphere - ESXi 5.0)

Amit said...

Thanks Man Irs works

AA said...

Great post - simple and clear. Seems to have helped almost 100 people to date.

Sridhar said...

Thanks a lot, it helped me !!

valipernes said...

Delete all folders with lock extension and the machine will start again with no problems.
Thank you!

Santhosh said...

Thanks.. :)

Santhosh said...

Thank you :)

haridimos said...

thkx !!
solved my issue too !!

Joseph Kahlich said...

Thanks for posting. This fixed my issue.

Anurag Sachan said...

Thanks a lot

Cheers
Anurag Sachan

Bach D said...

Thanks a lot dear..Bach D

DemiShaikh said...

Well Thanks alot for your support, actually one should delete all the folders having .lck extension to start the machine :) It works for me

asl75 said...

Thank you. Excellent on my way now. Vmware is solid.

atifazim said...

Thanks...my lights went out while i was running linux on vmware. Deleting the files solved the problem.

The Neo Habs Generation said...

I just wanted to let everyone know I had the problem and it resolved it, however I have a standard windows 7 VM I copy normally, to save time. I did this and tried setting up a new VM, told it I copied it. It gave me the lock error even after I deleted all the lock files. I had to delete the lock files in all folders, which is pretty sketchy imo. Either way, if somebody still is scratching their head, try that.

The Neo Habs Generation said...

If it still doesn't work for a specific VM try deleting the LCK files from others, that ended up fixing it for a VM that had no LCK files LOL

HaNcH said...

A lot of thanks!!! It worked for me!
Thanks man!!!

Arigbede Moses said...

The solution was on point. Thanks.

tdcrone said...

Same as everyone else, power outage on ESX server. No .LCK or .WRITELOCK on the datastore, but as another poster mentioned I was able to remove the hard disk (don't delete!) and add it back and the VM came right up!

Thanks for the blog and comments!

bobby said...

helpful information.....thank you

Akash said...

Worked for me too!!!!
Thanks for this.

adityo hutomo said...

thanks it works for me

Kiran Kumar Kammara said...

Great Worked for me

utkarsh said...

Man i almost had an heartattack, you saved my day.

utkarsh said...

Man a almost had an heartattack, you saved my day

Graces Photography said...

DUDE!!!! AWESOME...I was scared to death because my machine and the backup both were not working...just deleting the files and bam they worked again...thank you.

Killian Kavanagh said...

worked great

Killian Kavanagh said...

Worked Great

Adil Siddiqui said...

Simply put....you are tooo gud man...u saved my day...i toiled on the machine for 35 hrs straight and wham....win update rebooted my deskyop machine...stupid...and it wont open and google landed me here....god bless u...

Adil Siddiqui said...

Simply put....you are tooo gud man...u saved my day...i toiled on the machine for 35 hrs straight and wham....win update rebooted my deskyop machine...stupid...and it wont open and google landed me here....god bless u...

Jason J Rahming said...

Worked great for me.
Thanks

Jason J Rahming said...

Worked for me.
Thanks you saved me from a reinstall.

Tharun Raj said...

Thanks man.. it worked :)

gargi singh said...

Thanks a lot!!! it worked for me as well!!

Ralph Brooks said...

Thanks a lot. Helpful

techworld said...

almost 6 years later it helps another It guy. Thanx alot.

toke said...

thx ! this is very usefull! this has happened to me a couple of times now and this worked right away. the error started on one of my vm after the power turned off in my home.

kitimoto said...

you are my super hero !

Virtual STC said...

Tkx, worked for me. Excellent