How to start virtualmachine from terminal?

I can not run a Virtualbox Machine from command line what do I exactly need? I did a bit research first but this command did not work for me:

vboxmanage startvm win7 --type headless

Result is:

VBoxManage: error: Could not find a registered machine named 'win7'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 575 of file VBoxManageMisc.cpp
  • "win7" is the VM I'm trying to run.
  • I can run this VM via phpVirtualBox addon perfectly fine.
  • After launching this vm via phpVirtualBox I can perfectly RDM from Linux or Windows.
  • I'm running this VM on Ubuntu Server 14.04.03 amd64 headless installation.
  • Virtualbox version is: 4.3.34r104062
  • I don't know how to register this VM from terminal as its files located in a USB hdd using the NTFS partition.

My aim was to run this vm on system boot, preferably a bit delayed.

I'm ready to provide any other information needed.

4

1 Answer

Here is a way to start a virtual machine from terminal :

Open Virtual Box, right-click on the virtual machine. Then click on Create shortcut on desktop.

enter image description here

Go to the desktop, right-click on the shortcut and edit it.

enter image description here

Then copy the command and paste it into the terminal.

/usr/lib/virtualbox/VirtualBox --comment "Ubuntu" --startvm "cea829eb-85fe-4842-b98e-e98603094be0"

or you can start in terminal like this.

Get your UUID of VM

cd "VirtualBox VMs"
cd your-virtualpc-name
cat your-virtualpc-name.vbox-prev |grep Machine

output should look like this.

neil@ASUS:~/VirtualBox VMs/Ubuntu$ cat Ubuntu.vbox-prev |grep Machine <Machine uuid="{cea829eb-85fe-4842-b98e-e98603094be0}" name="Ubuntu" OSType="Ubuntu" snapshotFolder="Snapshots" lastStateChange="2015-11-22T08:47:08Z"> <ExtraDataItem name="GUI/RestrictedRuntimeMachineMenuActions" value="SaveState,PowerOff"/> </Machine>
neil@ASUS:~/VirtualBox VMs/Ubuntu$ 

Copy the Machine uuid

and run it in the command like so. With the quote marks

VBoxHeadless --startvm "cea829eb-85fe-4842-b98e-e98603094be0"
7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like