VM fails to start with result E_FAIL (0x80004005)

Discussions about using Linux guests in VirtualBox.
Post Reply
MacNala
Posts: 176
Joined: 12. Oct 2008, 00:20
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7, 10, 11 & Ubuntu 20.04 & 22.04
Location: UK
Contact:

VM fails to start with result E_FAIL (0x80004005)

Post by MacNala »

I am using VB 6.1.26 in a windows 10 host and have many Windows 10 Guests and few Linux/Ubuntu servers.
In trying to automate a start - headless I developed 3 BAT files vbxlu2 start.bat, vbxlu2 save.bat and vbxlu2 poff.bat included here.
Yesterday I was doing further testing and have obviously caused a problem because running the start followed by the poff and then start again caused the VM to fail to start with the attached error.
repeated attempts to restart the VM also failed what allowed the VM to start and stop normally using the VB Manager problem
Attachments
VBXLU2 .bats.txt
Combined to overcome file limitation and .bat not allowed
(665 Bytes) Downloaded 12 times
vbxlu2 failure.txt
(247 Bytes) Downloaded 10 times
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VM fails to start with result E_FAIL (0x80004005)

Post by scottgus1 »

Re the error, it seems that the Virtualbox environment wasn't ready, it could be that the VM was still shutting down. If you try starting the VM normal, not headless, then monitor when your batch file continues on after ordering the VM start, you'll probably see that the vboxmanage command completes when the VM window is opened, but well before the OS finishes booting. This is because vboxmanage only handles setting up the 'hardware' and kicking off the OS, not the full OS boot. The same thing can happen in the shutdown, if you ran 'vbxlu2 start.bat' before 'vbxlu2 poff.bat' was complete.

You would need a bit of feedback in your batch file to read when the VM is truly off or on. The output of this command:

vboxmanage showvminfo "vm name"

includes a line starting with "State:" that tells what the VM is doing. Piping the output of 'showvminfo' through 'find' for the desired State, then reading 'find's errorlevel can report to the batch file if the VM is ready to start, already running, etc.

Can you start your VM manually?

Also, be aware that 'poweroff' is like pulling the plug on a computer, and only really old or special OS's can handle abrupt power loss correctly. 'acpipowerbutton' in compatible OS's will start a normal shutdown, if the OS is set to handle a tap of the 'power button' as a shut-down command (most modern and some older OS's can do this).
MacNala
Posts: 176
Joined: 12. Oct 2008, 00:20
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7, 10, 11 & Ubuntu 20.04 & 22.04
Location: UK
Contact:

Re: VM fails to start with result E_FAIL (0x80004005)

Post by MacNala »

Thanks for the pointer to the showvminfo.
Yes, the VM can be started manually and has been working hard trying to keep up with the changes I am making to get it ready for my main project.
Regarding the power off, I am sure that is what caused the problem in the first place.
I note there is an option to send the the shutdown command under the close button.
Is there a similar one in vboxmanage?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VM fails to start with result E_FAIL (0x80004005)

Post by scottgus1 »

MacNala wrote:there is an option to send the the shutdown command under the close button.
Is there a similar one in vboxmanage?
Yes:
scottgus1 wrote:'acpipowerbutton' in compatible OS's will start a normal shutdown, if the OS is set to handle a tap of the 'power button' as a shut-down command
VBoxManage controlvm "VM name" acpipowerbutton
MacNala
Posts: 176
Joined: 12. Oct 2008, 00:20
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7, 10, 11 & Ubuntu 20.04 & 22.04
Location: UK
Contact:

Re: VM fails to start with result E_FAIL (0x80004005)

Post by MacNala »

I apologise. I did not fully read your earlier reply which included the way to check for the required state.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: VM fails to start with result E_FAIL (0x80004005)

Post by scottgus1 »

No problem! It's really easy to miss stuff, I do it myself at times.
Post Reply