Skip to content

Instantly share code, notes, and snippets.

@hsiboy
Last active September 29, 2024 21:39
Show Gist options
  • Save hsiboy/7ef27ab2f14e76f5c3f4 to your computer and use it in GitHub Desktop.
Save hsiboy/7ef27ab2f14e76f5c3f4 to your computer and use it in GitHub Desktop.
rescue a VM from VBOX_E_INVALID_OBJECT_STATE

Issue

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "c8f076e7-b65f-4a48-9632-b65af0e27ba7", "--natpf1", "delet
e", "ssh"]

Stderr: VBoxManage.exe: error: The machine 'default' is
already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), c
omponent Machine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at lin
e 471 of file VBoxManageModifyVM.cpp

How to fix?

1st try and force power off of VM

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>VBoxManage.exe controlvm default poweroff
'VBoxManage.exe' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\system32>C:\Progra~1\Oracle\VirtualBox\VBoxManage.exe controlvm default
poweroff
VBoxManage.exe: error: The virtual machine is being powered down
<b>VBoxManage.exe: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002)</b>, compo
nent Console, interface IConsole, callee IUnknown
VBoxManage.exe: error: Context: "PowerDown(progress.asOutParam())" at line 222 o
f file VBoxManageControlVM.cpp

ok, still have problem, lets try something else...

C:\Windows\system32>C:\Progra~1\Oracle\VirtualBox\VBoxManage.exe startvm default
--type emergencystop

Fixed!

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...

Other issues:

VBOX_E_INVALID_OBJECT_STATE (0x80BB0007)

Solution: After the vm exports the .ovf, use the vbox to open the .vmdk. You don't have to import .ovf.

In windows you can kill the VboxHeadless.exe process in task manager. CMD prompt was opened in Administrative mode.

@cvs-cvs
Copy link

cvs-cvs commented Jul 30, 2024

hsiboy Thank you. I didn't try to copy it, but when I downloaded it from kali.org for the second time and tried it, the place was changed with the one I downloaded the first time and it didn't work. I hope now it works 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment