Opened 10 years ago
Last modified 7 years ago
#12477 new defect
Can't operate any more on a locked VM -- a way to force lock removal is needed
Reported by: | Alex | Owned by: | |
---|---|---|---|
Component: | VM control | Version: | VirtualBox 4.3.4 |
Keywords: | lock | Cc: | |
Guest type: | Windows | Host type: | Linux |
Description
Sometimes it happens that a VM stops or hangs for some unknown reason and it becomes impossible to operate on it any more because vbox says it's locked.
For example:
$ VBoxManage controlvm xyz poweroff VBoxManage: error: The virtual machine is being powered down VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component Console, interface IConsole, callee nsISupports VBoxManage: error: Context: "PowerDown(progress.asOutParam())" at line 222 of file VBoxManageControlVM.cpp
and trying to start it gives:
$ VBoxHeadless -s xyz Oracle VM VirtualBox Headless Interface 4.3.4 (C) 2008-2013 Oracle Corporation All rights reserved. VBoxHeadless: error: The machine 'xyz' is already locked for a session (or being unlocked) VBoxHeadless: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports VBoxHeadless: error: Context: "LockMachine(session, LockType_VM)" at line 955 of file VBoxHeadless.cpp
Now I'm stuck: the only way I know to solve this problem is to completely shutdown vbox and/or restart the server, but this forces to shutdown all the other running vms, and thats not really easy on some situation.
I suppose that a way to force the removal of a lock is much needed.
Attachments (1)
Change History (5)
comment:1 by , 10 years ago
comment:2 by , 9 years ago
I'm seeing this after a newly imported VM failed to launch.
$ VBoxManage startvm 8388e6ca-e9fb-4861-adce-8456ddd585ef --type emergencystop
VBoxManage: error: The machine 'Perf02' is not locked by a session
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LaunchVMProcess(a->session, sessionType.raw(), env.raw(), progress.asOutParam())" at line 592 of file VBoxManageMisc.cpp
$ VBoxManage startvm 8388e6ca-e9fb-4861-adce-8456ddd585ef --type stop
VBoxManage: error: The machine 'Perf02' is already locked by a session (or being locked or unlocked)
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LaunchVMProcess(a->session, sessionType.raw(), env.raw(), progress.asOutParam())" at line 592 of file VBoxManageMisc.cpp
I also can't remove or release the hard disk through the Virtual Media Manager UI. Remove is greyed out and release gets:
Failed to open a session for the virtual machine Perf02. An unexpected process (PID=0x000017CF) has tried to lock the machine 'Perf02', while only the process started by LaunchVMProcess (PID=0x00007802) is allowed.
Result Code: E_ACCESSDENIED (0x80070005)
Component: Machine
Interface: IMachine {480cf695-2d8d-4256-9c7c-cce4184fa048}
comment:3 by , 9 years ago
I met the same problem and this is 18 months later than it was reported; any chance will this be fixed?
$ VBoxManage startvm 9351c302-61cd-4fb4-b86a-1254aebfc4d5 --type emergencystop VBoxManage: error: The machine 'vbox7_default_1434661800786_61027' is not locked by a session VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports VBoxManage: error: Context: "LaunchVMProcess(a->session, sessionType.raw(), env.raw(), progress.asOutParam())" at line 592 of file VBoxManageMisc.cpp $ VBoxManage --version 4.3.28r100309
comment:4 by , 7 years ago
Updated from VirtualBox 5.0 to the latest 5.1.10 and this has become a constant issue on CentOS 7.2 x86_64.
This is from packer.io 0.12.0 (Windows 10 guest):
==> virtualbox-iso: Gracefully halting virtual machine... virtualbox-iso: Removing floppy drive... ==> virtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxManage: error: The machine 'packer-virtualbox-iso-1482149848' is already locked for a session (or being unlocked) ==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports ==> virtualbox-iso: VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 1038 of file VBoxManageStorageController.cpp ==> virtualbox-iso: Unregistering and deleting virtual machine... ==> virtualbox-iso: Error deleting virtual machine: VBoxManage error: VBoxManage: error: Cannot unregister the machine 'packer-virtualbox-iso-1482149848' while it is locked ==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports ==> virtualbox-iso: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 155 of file VBoxManageMisc.cpp ==> virtualbox-iso: Deleting output directory... Build 'virtualbox-iso' errored: Error removing floppy controller: VBoxManage error: VBoxManage: error: The machine 'packer-virtualbox-iso-1482149848' 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 1038 of file VBoxManageStorageController.cpp ==> Some builds didn't complete successfully and had errors: --> virtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxManage: error: The machine 'packer-virtualbox-iso-1482149848' 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 1038 of file VBoxManageStorageController.cpp
And this is from Vagrant 1.9.1 (Fedora 24 guest):
vagrant destroy -f ==> fedora: Forcing shutdown of VM... ==> fedora: Destroying VM and associated drives... There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["unregistervm", "55b1d781-d3d5-4732-96d3-94a8eed5bbc2", "--delete"] Stderr: VBoxManage: error: Cannot unregister the machine 'gpii-pouchdb-lucene-tests_fedora_1481303873647_68219' while it is locked VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 155 of file VBoxManageMisc.cpp
by , 7 years ago
Attachment: | packer-virtualbox-iso-1482149848.log added |
---|
On the webservice API, you can pass 'emergencystop' as type on LaunchVM method to abort an unresponsive VM - results the status 'Aborted'. It's like having shutoff power to your pc, and you lose changes. Not sure if it's an applicable parameter on VBoxManage, might as well give it a try..
VBoxManage startvm --type emergencystop