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.

@coder-backend
Copy link

coder-backend commented Jul 2, 2020

C:\WINDOWS\system32>C:\Progra~1\Oracle\VirtualBox\VBoxManage.exe controlvm default poweroff

VBoxManage.exe: error: Could not find a registered machine named 'default'
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 383 of file VBoxManageControlVM.cpp

Any Solution


There is a clue in the error message.
"Could not find a registered machine named 'default'"

What is your machine name?

@Dorbah
Copy link

Dorbah commented Aug 20, 2020

Right mouse click on virtual machine and select "Create shortcut on Desktop" then open properties of this shortcut and in command line you will see your machine name like "41fdff23-d740-47c0-898e-0f62c2c8b056" ( "C:\Program Files\Oracle\VirtualBox\VirtualBoxVM.exe" --comment "bitnami-gitlab" --startvm "41fdff23-d740-47c0-898e-0f62c2c8b056" )

@cvs-cvs
Copy link

cvs-cvs commented Jul 29, 2024

IMG_5501

Hello .I want to install 2nd Kali on virtual box and run them at the same time. But only one of them works. I get this error. Can you please help?

@hsiboy
Copy link
Author

hsiboy commented Jul 30, 2024

The clue is in the error message. The disk you booted the first VM from is still being used by the first VM so you can not use it for the second VM.
Clone it.

@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