Failed to create the VirtualBox object - bash

I was trying to login into the already existing vm using vagrant in bash. But it says failed to start or it's not running.
This is a already existing vm in the local.
I tried
$vagrant global-status -> to get the vm id.
then,
$vagrant up <id> ->to start the vm.
Got the following error,
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["showvminfo", "cd2ec772-3e94-476f-a0d9-59c3d2768fb5"]
Stderr: VBoxManage.exe: error: Failed to create the VirtualBox object!
VBoxManage.exe: error: Code REGDB_E_CLASSNOTREG (0x80040154) - Class not registered (extended info not available)
VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or failed to start.

Related

Trying to run a couple of VMs using Vagrant. On running vagrant up command I get Call to virDomainCreateWithFlags failed: internal error

Trying to run a CentOS 7 VM on Virtual Box using vagrant on my Fedora 35 machine.
On running the run the vagrant up & vagrant up --debug commands I get the following message as output.
There was an error talking to Libvirt. The error message is shown
below:
Call to virDomainCreateWithFlags failed: internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=virbr0 --fd=27: failed to communicate with bridge helper: Transport endpoint is not connected
stderr=failed to get mtu of bridge `virbr0': No such device
So I was making a rookie mistake of not properly defining the VM provider in vagrant up command. Running vagrant up --provider virtualbox fixed this issue.

Jenkins unable to start Oracle VirtualBox

I have a batch file I have made that runs Oracle's VirtualBox in the headless mode. When I run the command in the windows command prompt it works fine without any errors.
C:\Program Files\Oracle\VirtualBox>VBoxManage startvm "Ubuntu" --type headless
Waiting for VM "Ubuntu" to power on...
VM "Ubuntu" has been successfully started.
C:\Program Files\Oracle\VirtualBox>
However, when I call the batch script that has the same command via Jenkins I get the following error:
C:\Program Files\Oracle\VirtualBox>VBoxManage startvm "Ubuntu" --type headless
VBoxManage.exe: error: Failed to create the VirtualBox object!
VBoxManage.exe: error: The object is not ready
VBoxManage.exe: error: Details: code E_ACCESSDENIED (0x80070005), component VirtualBoxClientWrap, interface IVirtualBoxClient
Every VirtualBox command called from Jenkins gives the same error.
C:\Program Files\Oracle\VirtualBox>VBoxManage sharedfolder add "Ubuntu" --name BranchRepo --hostpath "A PATH" --automount
VBoxManage.exe: error: Failed to create the VirtualBox object!
VBoxManage.exe: error: The object is not ready
VBoxManage.exe: error: Details: code E_ACCESSDENIED (0x80070005), component VirtualBoxClientWrap, interface IVirtualBoxClien
Any suggestions as to how to fix this issue? Is there some particular way to grant Jenkins the required permissions?
It seems that that the user with which it runs has incorrect permissions.
You can try and run Jenkins' service as a separate local admin user.
Start => 'services' => Scroll to the Jenkins service => right click => properties => "log on" => "this account" => specify a local admin account.
Edit:
Editing the "Registry Editor" worked

OpenStack training-labs - VBoxManage.exe: error: Invalid machine group

I am trying to install OpenStack instance into VirtualBox VMs as on https://wiki.openstack.org/wiki/Documentation/training-labs#Building_the_cluster
after ./osbash.sh -w cluster I get error
VBoxManage.exe: error: Invalid machine group 'C:/Program Files/Git/labs'
Yes, C:/Program Files/Git is location of git-bash.exe that is actual Git-Windows Bash, but how to make osbash.sh proceed with correct machine group name?
The scripts are stable Mitaka from http://docs.openstack.org/training_labs/ for Windows
http://tarballs.openstack.org/training-labs/dist/labs-stable-mitaka.zip
Paul#aspire MINGW64 /d/Workspaces/OpenStack/labs-stable-mitaka/labs/osbash
$ ./osbash.sh -b cluster
Base disk: base-ssh-mitaka-ubuntu-14.04-server-amd64
Distribution name: ubuntu
Virtualization provider: virtualbox
Creating Windows batch scripts: no
Creating cluster on this machine: yes
VM access method: ssh
GUI type: headless
2016年09月20日 18:09:36 osbash starting
Creating basedisk.
2016年09月20日 18:09:36 osbash vm_install starts.
Asked to delete VM "base" (not found)
Creating VM "base"
VBoxManage.exe: error: Invalid machine group 'C:/Program Files/Git/labs'
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "ComposeMachineFilename(bstrName.raw(), bstrPrimaryGroup.raw(), createFlags.raw(), bstrBaseFolder.raw(), bstrSettingsFile.asOutParam())" at line 264 of file VBoxManageMisc.cpp
FAILURE: VBoxManage: createvm --name base --register --ostype Ubuntu_64 --groups /labs
P.S. The same error when trying the latest master from git://git.openstack.org/openstack/training-labs.git
Raised bug https://bugs.launchpad.net/labs/+bug/1625562
The documentation may have mislead you. You don't need a POSIX environment to build the cluster on Windows and (as you found out) using the bash scripts does not work on Windows.
All you need is a VirtualBox installation and the content of the zip file you downloaded. There is no need to add VBoxManage to the Path, the scripts should find the executable anyway.
The zip file you downloaded contains the Windows batch files that build the cluster on Windows in the wbatch directory. Just double-click them: 1) create_hostnet 2) create_base 3) create_ubuntu_cluster_node
That's all. The scripts will set up the VMs, download the Ubuntu ISO image and build the OpenStack cluster.

Windows Docker Toolbox won't start

Attempting to start up Docker Toolbox 1.12.0 on Windows 10 and getting the following error
Running pre-create checks...
Creating machine...
(default) Copying C:\Users\abc\.docker\machine\cache\boot2docker.iso to C:\Users\abc\.docker\machine\machines\default\boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
Error creating machine: Error in driver during machine creation: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe createvm --basefolder C:\Users\abc\.docker\machine\machines\default --name default --register failed:
VBoxManage.exe: error: Code REGDB_E_IIDNOTREG (0x80040155) - Interface not registered (extended info not available)
VBoxManage.exe: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 272 of file VBoxManageMisc.cpp
Looks like something went wrong in step ´Checking if machine default exists´... Press any key to continue...
Has anyone encountered this error before?
Re-installing VirtualBox and then restarting my machine fixed the problem. Hopefully this fixes yours too.
You can solve this problem by reinstalling VirtualBox, and choosing repair mode.
C:\Program Files\Docker Toolbox\installers\virtualbox -> virtualbox.exe.
After finishing the process, restart you machine and smile!

VAGRANT UP not working when executed via BAMBOO

I am trying to work with Vagrant and Bamboo together. I created custom box which I put on a web server from which it is getting downloaded when doing vagrant up. When I do it manually on the computer everything goes as expected.
When I try this via Bamboo however, the folder for local box in c:\Windows\System32\config\systemprofile\.vagrant.d\boxes is not created and subsequently fails as vagrant is not able to do import.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'http://127.0.0.1:8000/k.box'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["import", "-n", "C:/Windows/System32/config/systemprofile/.vagrant.d/boxes/http-VAGRANTCOLON--VAGRANTSLASH--VAGRANTSLASH-127.0.0.1-VAGRANTCOLON-8000-VAGRANTSLASH-k.box/0/virtualbox/box.ovf"]
Stderr: 0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage.exe: error: Appliance read failed
VBoxManage.exe: error: Could not read OVF file 'box.ovf' (VERR_PATH_NOT_FOUND)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component ApplianceWrap, interface IAppliance
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 307 of file VBoxManageAppliance.cpp
Did any of you encountered similar problem?
Thank you.
After some investigation I found the reason for this. The problem is that by default .vagrant.d folder is created in C:\Windows\SysWOW64\config\systemprofile when the vagrant is run via Bamboo. This is the folder where the boxes are stored after download.
The PROFILEUSER environment variable is set to C:\Windows\System32\config\systemprofilefor SYSTEM user. Subsequently after downloading the box it went to look for it into .vagrant.d folder inside PROFILEUSER folder instead of the one that really stored the box.
This problem was solved by setting VAGRANT_HOME environment variable to C:\Windows\SysWOW64\config\systemprofile\.vagrant.d. After this, vagrant looks into correct folder for stored boxes.

Resources