This Virtual Machine Appears To Be In Use…

December 4, 2008

Now that I am using VMWare Fusion on a regular basis I am learning the application a lot better, and this includes how to deal with typical issues that arise with day-to-day usage.  Yesterday, I powered up my laptop after it had unexpectedly lost power and saw that my virtual machine was “locked”.  In this state my Windows VM would not start, but I was able to figure out how to resolve the error.

Here is what VMWare Fusion looked like when I opened it up after the power outage (note the “File locked” message and lock button on the VM listing):

VMWare Fusion: Windows Virtual Machine - File Locked

When I clicked on the lock button (which had replaced VMWare Fusion’s normal “play” button), I got an error message indicating “The virtual machine appears to be in use”:

VMWare Fusion error: This virtual machine appears to be in use

Seeing as how I was not using the VM (…at least to the best of my knowledge), I clicked on “Take Ownership”, and got an error message that said “Taking ownership of this virtual machine failed”:

VMWare Fusion error: Taking ownership of this virtual machine failed

What to do?  I started googling for the error messages to see if I could find a resource or VMWare support document that described how to troubleshoot them, but to my surprise it took me awhile and some digging to find something.  Luckily, I finally found a posting that described almost the same situation I had, which in essence recommended removing VMWare’s lock files on the virtual machine. This solution worked perfectly for me, so I wanted to document in a little more detail how I implemented it on my Mac. PLEASE NOTE!  This involves using the Terminal and Unix shell commands, so if you are not familiar with either, you should proceed at your own risk.  I do not believe anything below is all that complicated for someone with general Terminal / Unix experience, but for example if you are asking yourself right now what the Terminal is or have never dropped into the Terminal before, these directions will not be detailed enough for you. 1.  Quit VMWare Fusion. Before you start, make sure that you have totally quit VMWare Fusion, and it is not running in the background. 2.  Launch Terminal. I decided to go into Terminal to remove the lock files given the Finder does not show hidden files and folders by default.  (You could theoretically do all of this in the Finder if you enable viewing of hidden files and folders, but for me it was easier to just go straight to Terminal). 3.  Change to the Virtual Machine directory. By default, VMWare creates a directory under your user Documents folder called “Virtual Machines.localized” with subfolders for each VM. On your Mac this directory name will likely be different than mine (it is based on the name of your actual VM).  However as an example, on my Mac the directory is:
/Users/kenclark/Documents/Virtual Machines.localized/Windows XP Professional.vmwarevm
Therefore, the command to change into that directory (from the default terminal prompt which starts you in your home directory, i.e. /Users/kenclark) is:
cd Documents/Virtual\ Machines.localized/Windows\ XP\ Professional.vmwarevm/
4. Verify there are lock files in this directory. Once you are in the VM’s directory, you should see a number of lock files intermixed with the VM files.  To do this, just enter the following Unix command to list the directory contents:
ls -l
As an example, on my Mac I saw four lock files in addition to VMWare’s system files.  They were:
Windows XP Professional-000001.vmdk.lck Windows XP Professional.vmdk.lck Windows XP Professional.vmem.lck Windows XP Professional.vmx.lck
5.  Create a directory to back up the lock files. Theoretically you could simply delete the lock files, but I am more conservative and did not want to risk really messing anything up on my Mac.  I created a temp directory for the lock files rather than deleting them. Here’s the command to make a backup directory I am calling “lockfiles-temp”.  (Please note I am assuming you are in the Virtual Machine directory when you do this).
mkdir lockfiles-temp
6.  Move the lock files into the temp directory. Again I moved the lock files rather than deleting them to ensure I could rollback if this did not work.  Here is the command:
mv *.lck ./lockfiles-temp
At this point you should verify the move was successful, by executing another directory listing:
ls -l
When you do this, you should see no lock files in the VM directory. 7.  Launch VMWare and Start your Virtual Machine. Now, power up VMWare and you should see a new screen that shows your virtual machine is unlocked and either “Powered Off” (as mine shows below) or “Suspended” – in either case it will be ready to start up.

VMWare Fusion: Windows XP Powered Off Mission Accomplished!

  • Dan

    Saved my bacon – thanks!

  • http://www.kenclarksblog.com Ken Clark

    Dan,

    When this happened to me, I had to imagine (or hope for the sake of me ego… ;) that I wasn’t the only one who ran into this issue and the online documentation was pretty light. Glad I was able to help!

    Ken

  • Kim K

    Dan, Worked like a champ!!

    Kim

  • http://www.kenclarksblog.com Ken Clark

    Dan, Kim,

    Glad I was able to help! Ken

  • http://jimmers.info Martin

    I am running VMware Workstation 6.5.1 on Linux. I got the same error message after my laptop was rebooted. However I found that instead of lck files there are lck directories in the VM directory. So I had to issue this to remove them:

    rm -fr *.lck

    Offtopic: Fedora 10 with VMware Workstation 6.5.1 is not stable enough. I often get cursor stuck in the VM which makes it impossible to continue work until I login vis SSH to my laptop and kill vmware process (vmrun stop does not help even vmrun list reports running vms). I would like to know if moving to Leopard + VMware fusion is a solution. What you think, Ken?

  • http://www.kenclarksblog.com Ken Clark

    Martin,

    I have not used Fedora, but my experience with Fusion on Leopard has been pretty positive, and it goes without saying that OS X is terrific. I am using version 2.0.1 of Fusion which is stable and its performance is generally solid.

    One immediate config setting you will want to modify in Fusion is to increase the default memory allocation for the VM. By default I believe it allocates 256MB which for my machine had Windows XP at a crawl. I changed it to 1GB and it works much better, but it will still stall for a couple seconds here and there if I have a lot of Windows and Mac apps open at the same time. I am probably going to try allocating another 500MB or so before long to see if that eliminates those occasional hiccups (for reference, I have 4GB on the machine). That said, all in I would recommend it.

    Ken

  • http://www.whiteboardconsultant.com John Williamson

    GREAT WORK HERE. Thank you for the detailed instructions :)

  • http://blog.chinonino.info mosoo

    Thanx a lot, that did the trick for my crappy WinXP machine. You saved me a lot of hassle. Cheers.

  • DM

    Those instructions were perfect!!! Thank You very much! You made me look like a champ ;)

  • Kevin Felch

    I had a similar problem with VMWare Fusion and went through the steps described above using Terminal but did not find any .lck files to remove. I also tried seeing the .lck files using the steps indicated to see them in the Finder but again there weren’t any .lck files. Any other ideas to try to remedy the locked virtual machine problem?

  • http://www.kenclarksblog.com Ken Clark

    Kevin,

    I am not sure about that one. I have had the error I describe in this article occur a couple times, but it always creates the .lck files. If you find out how to resolve the problem you’re having, I’d appreciate if you can post a follow-on comment to this thread in the event other folks run into the same issue as well. Good luck,

    Ken

  • Ian Oliver

    Dear Ken, Thank you so much for your advice on correcting the locked XP under VM Fusion, I’m not a software type but your easy to follow advice worked a treat!

    Thank you, Ian Oliver in Singapore

  • http://www.kenclarksblog.com Ken Clark

    Ian–

    No problem! Happy to help!

    Ken

  • Tal Schoenfeld

    Thank you very very much ,man. A simple solution, when you see what’s under your nose. and today, I didn’t. I was too angry after a vm server I worked on for 2 days crashed,… :-)

  • CP

    Hey Ken, Thanks a lot! You saved me quite a headache! Cole

  • FrSnyd

    Here is another pragmatic way that worked great for me: http://www.themacbistro.com/forums/showthread.php?t=996Quit Fusion

    1. Find your Virtual machine package User/Home/Documents/virtualmachine

    2. ⌘+click/Right click choose show package content

    3. Delete any folders and files ending .lck

    4.Launch VM fusion and you should be good to Go

    I hope this may be of help for others

  • http://www.kenclarksblog.com Ken Clark

    Thanks for the tip. That is great! –Ken

  • Paul Campbell

    Excellent. Thanks for the information on sorting this out. The power went on my MAC and when I couldn’t take control of the locked VM I thought that was it!! Panic set in.

    These easy to follow instructions worked a treat. Thanks again.

    Paul

  • Gregory Nail

    Just wanted to make a note because I went round and round not realizing this. When the problem occurred I made the assumption I just needed to get rid of the lck files but for whatever reason the fix did not work. So I too went to the internet searching to find some information on the issue. As you see I found your blog and this gave me some reassurance that I wasn’t missing something but what was wrong…

    Well to have it I had multiple VMs that were running during the system crash. For whatever reason I had to delete all the lock files from all the VM before starting any of the VMs so that I would not get this error. So if the above does not fix your issue. Go ahead and make certain that none of your other VMs have any lock files floating around.

  • http://www.residentialtraining.co.uk Joe Jenkins

    Well that was weird.

    I just started to do as you were saying. I went to close everything down, but accidentally clicked file>>Close

    This actually solved the problem, then next time i started up VMware Fusion, it was no longer locked.

  • Carey

    Thank you sir. I figured there were lck files after dealing with them in ESX and Workstation land but didn’t know exactly where to look. Much obliged.

  • Rahul

    Thanks! I just migrated between macbook pro’s due to an Nvidia issue – this blog saved my life!

  • PER

    Thanks!

    It worked as a charm. Excellent guide. I was afraid my data was gone forever.

  • http://joyya.blogspot.com ijoyya

    Great Job Buddy U really worked wisely and securely

    Thanks for Sharing in a superbWay

  • http://joyya.blogspot.com ijoyya

    for users who could not see any locked file

    create it your self

  • http://www.matthewsetter.com Matthew Setter

    Worked great for me. Thanks for the information.

    Matt

  • Ashish

    Sweet! thanks for saving my day!

  • http://www.facebook.com/HarryBilbao Harry Bilbao

    Oi… Smart arse!

    Well done… Your tips worked 100% i used the terminal option and it was PERFECT!

    Merry Xmas

    Harry

  • Richard Hassinger

    Over a year later… helped me out. My issue was moving the vm from one user to another on the same machine. Googled on the erorr message, got the solution. Thanks!

  • Quan

    Great, Thanks a lot, Ken. Very useful post
    Quan Phi

  • Kishore

    Thanks a ton.. That was spot on.. My VM is back up and running…

  • Bruce Maryanoff

    This problem happened spontaneously while having my Mac on sleep overnight. No power failure in sight. I was really bummed out over it and super-pissed at VM Ware for not even mentioning it on their website. I am not very computer literate and decided to try this solution with considerable trepidation. To my amazement it worked. I have to say, “You da' Man”. Thanks a lot.

  • Marshall

    You're still the man… thanks for the VMWare lock fix.

  • Kishan

    Thanks a lot

  • http://topsy.com/trackback?utm_source=pingback&utm_campaign=L1&url=http://kenclark.me/2008/12/this-virtual-machine-appears-to-be-in-use/ Tweets that mention This Virtual Machine Appears To Be In Use… — Ken Clark — Topsy.com

    [...] This post was mentioned on Twitter by Justin Haskell. Justin Haskell said: VMware Locked filed prevent using the VM – http://urlzen.com/1si4 [...]

  • http://www.facebook.com/chrirule Chris Rule

    Worked like bacon… !

  • Manos Semertzides

    Great job! This was a great hint. I was able to “Show Package Contecnts” on my VM, find the “Windows XP Professional.vmx.lck” file, and just moved it out of the package. Worked like a charm!

  • Tom di Giovanni

    (hugs) Works like a charm – thanks very much for taking the time to share this with the world :)

  • Yime

     Thanks for the solution. It worked like magic. 

  • Sanmiwale

    Please can anyone tell me if it is possible to change one or all of my virtual switch port to promiscuous mode on in a virtual environment ?

    I have 6 guest O/S connected using Host- Only Option; but put one one of the machine to monitor all traffic on the virtual switch.  

  • Sanmiwale

    Please can anyone tell me if it is possible to change one or all of my virtual switch port to promiscuous mode on in a virtual environment ?

    I have 6 guest O/S connected using Host- Only Option; but put one one of the machine to monitor all traffic on the virtual switch.  

  • unreal4u

    in my case vmware said my virtual machine was already running, ownership taking was unsuccessful.

    Thanks to this tip i’ve got my vm machine back! Thanks!

  • Kevin

    Really helpful. Thanks!

  • http://twitter.com/murphymac MurphyMac

    Thanks kenclark.me, just what I needed.

Previous post:

Next post: