My VM in virtualbox can not start due to this error, I don't want to destroy it and reinstall it again, anyway to recover it ?

There was an error while executing VBoxManage, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "319fcce3-e8ff-4b6f-a641-3aee1df6543f", "--natpf1", "delete", "ssh"]

Stderr: VBoxManage: error: The machine 'centos64_c6402_1454036461345_59755' is already locked for a session (or being unlocked)
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 493 of file VBoxManageModifyVM.cpp
share|improve this question

Running this on the command line unlocked the VM:

vboxmanage startvm <vm-uuid> --type emergencystop

Where <vm-uuid> is the number in the error message: Command: ["modifyvm", "<vm-uuid>" [...]. After that I was able to control the VM (start, halt, etc). Using Virtualbox 4.1 on Ubuntu.

share|improve this answer
    
thanx man, this really helped me, I had some issues regarding a shared folder in docker. I couldn't delete the shared folder (error: Could not find a shared folder named 'ourspends'), and also, upon creating, it was saying that it already exists (Could not create a shared folder 'ourspends' mapped to '/home/relu/projects/ourspends' (VERR_ALREADY_EXISTS)) – Relu Mesaros Sep 22 '16 at 23:19
    
Where do I run this exactly? Obviously, this is not from within the VM itself, as the "vboxmanage" command relates to the VBox software on the hosting machine and the VM itself doesn't recognize this. On the other hand, this command is unknow also to my hosting machine (in my case, it's Windows 10). So... what do I need to run this command then? – TheCuBeMan Mar 16 '17 at 11:29
    
I executed it in a terminal using Linux. I guess that in Windows it can be executed in a Command Prompt (cmd). It was tested with VirtualBox 4.1 – Gonzalo Matheu Mar 16 '17 at 11:55
    
Thanks, works like a charm. Should be accept as answer. – davidbonachera Apr 7 '17 at 9:31
    
Grande Gonza!! Jaja :) – facundofarias Apr 10 '17 at 8:48

Having the same issue I found that there was a process running actually locking the vm:

501 79419 79323   0  2:18PM ??         0:39.75 /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless --comment default --startvm 1d438a2e-68d7-4ba2-bef9-4ea162913c1b --vrde config

Make sure you don't have a process stuck trying to start the vm:

ps -ef | grep -i "vbox"
share|improve this answer
    
This worked for me. I killed all processes returned by the ps -ef statement and then "vagrant destroy" worked again. – thebiggestlebowski Mar 16 '17 at 12:30

In Windows Task Manager, I ended any tasks related to Virtual Box (you can see they start with a V in Task Manager like Vbox Headless.exe, etc). Once I did that, I was able to get this error to go away (the above 'vboxmanage startvm ...etc...' solutions here did not work for me).

share|improve this answer

If you have a settings window open for that box in the VirtualBox GUI, you may run into this error. Just close the settings window and try again.

share|improve this answer

I've encounter the same error message today:

>me@myhost:~$ ps -ef | grep -i "vbox"

me  3064     1  0 08:51 ?        00:00:00 /usr/lib/virtualbox/VBoxXPCOMIPCD

me  3089     1  0 08:51 ?        00:00:00 /usr/lib/virtualbox/VBoxSVC --auto-shutdown

me  3126  3089 27 08:51 ?        00:00:39 /usr/lib/virtualbox/VBoxHeadless --comment RHEL5 64-bit desktop --startvm e5c598d8-1234-4003-a7c1-b9d8af15dfe7 --vrde config

me  3861  3415  0 08:53 pts/1    00:00:00 grep --color=auto -i vbox*

Gergely's answer solves it perfectly. It turned out that I've a crontab set at reboot to boot the virtual machine, which initiated the three VBox process shown above

me@myhost:~$ crontab -l

@reboot me /usr/bin/vboxmanage startvm "RHEL5 64-bit desktop" --type headless
share|improve this answer

The only option that worked for me was to kill all the processes matching ps axl|grep -i vbox.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.