Gitlab runner does not seem to start cloned virtualbox vm

Hi all,

Been trying to setup a runner on windows 10 with virtualbox ubuntu vm as executor.

Unfortunately it does not work most of the time, and I am constantly getting this error:

ERROR: Preparation failed: VBoxManageOutput error: vboxmanage.exe: error: The VM session was closed before any attempt to power it on

vboxmanage.exe: error: Details: code E_FAIL (0x80004005), component SessionMachine, interface ISession

Online research suggested to discard saved vm state, but I have none. I actually have disable_snapshots set to true in config.toml

Every time I kick start a CI job on gitlab web interface, I was able to see a clone being created in VirtualBox Manager window. However I see that the clone vm remains in “powered off” state until eventually gitlab runner complains that the session was closed before any attempt made to boot the vm.

For clarification, gitlab runner is started as a service by nt authority\system account.
The vm was also created with the same account.

At this point I am not sure if Gitlab runner did not issue the command to boot the vm or there was something wrong with the vm in virtualbox.

Any suggestion to troubleshooting is appreciated.


I seem to have found the root cause of my problem.

After a successful CI job runs, I still have 3 VBoxHeadless.exe process left running.
If I kill those and all other processes related to virtualbox, then the next CI job will run fine.

I guess the question becomes is it that the gitlab runner never properly cleans up after a CI job or is it that virtualbox never properly cleans up after itself.