Page 1 of 1

Unabte to start VM in headless mode !!

Posted: 16. Feb 2018, 15:16
by vincen
Hi

So I'm running Virtualbox 5.1.14 on Ubuntu 16.04. I have few virtual machines running in it without problems. Today I created a new VM with Ubuntu server in it. My goal is to be able to start it automatically in headless mode at boot of host system. First I wanted to test it in command line to be sure of syntax but I run into trouble for that.

I tried that syntax:
vboxheadless -startvm "7f527b43-569f-4d2c-98d6-8aef4d033122"
but Virtualbox always reports machine or uuid unknown unless I got the uuid just in previous command:
vboxmanage showhdinfo /home/vincen/VirtualBox\ VMs/Home-Assistant/Home\ Assistant.vdi
UUID: 7f527b43-569f-4d2c-98d6-8aef4d033122
Parent UUID: base
State: created
Type: normal (base)
Location: /home/vincen/VirtualBox VMs/Home-Assistant/Home Assistant.vdi
Storage format: VDI
Format variant: fixed default
Capacity: 8192 MBytes
Size on disk: 8194 MBytes
Encryption: disabled
I tried also using name between quotes as indicated in documentation but exactly the same. What am I missing here ?

Thanks

Vincèn

Re: Unabte to start VM in headless mode !!

Posted: 16. Feb 2018, 18:15
by andyp73
As it is the output from the showhdinfo command it looks like that UUID is for the disk image.

I start my headless VMs with VBoxManage so based on your output try:
VBoxManage startvm "Home-Assistant" --type headless
-Andy.

Re: Unabte to start VM in headless mode !!

Posted: 16. Feb 2018, 21:09
by socratis
You can use "VBoxManage --type headless" or "VBoxHeadless" to start a VM, same end result.
What you can't do is to start a hard disk. A hard disk cannot start without a computer.

Re: Unabte to start VM in headless mode !!

Posted: 17. Feb 2018, 09:58
by vincen
andyp73 wrote:As it is the output from the showhdinfo command it looks like that UUID is for the disk image.
I start my headless VMs with VBoxManage so based on your output try:
VBoxManage startvm "Home-Assistant" --type headless
Thanks for details but not better :(
root@serveur:~# vboxmanage startvm "Home-Assistant" --type headless
VBoxManage: error: Could not find a registered machine named 'Home-Assistant'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 572 of file VBoxManageMisc.cpp
root@serveur:~#
socratis wrote:You can use "VBoxManage --type headless" or "VBoxHeadless" to start a VM, same end result.
What you can't do is to start a hard disk. A hard disk cannot start without a computer.
Yep sorry for confusion between UUID of a drive image and the one of the computer itself ;) so I tried the command using the machine ID (found in the text file of description of the VM !) but same error too :(
root@serveur:/home/vincen/VirtualBox VMs/Home-Assistant# vboxmanage startvm 74ba0593-0324-401c-9175-55e209c1852e --type headless
VBoxManage: error: Could not find a registered machine with UUID {74ba0593-0324-401c-9175-55e209c1852e}
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 572 of file VBoxManageMisc.cpp
root@serveur:/home/vincen/VirtualBox VMs/Home-Assistant#

Re: Unabte to start VM in headless mode !!

Posted: 17. Feb 2018, 10:05
by vincen
oki found the issue and I have to apologise :( I'm stupid :oops: If I do the command with the correct user account it'll be much better !! Command works perfectly when used in original user account in which are the virtual machines ;)

Side question: if I run the command in a terminal and close terminal process will detach and continue or I'll kill the running virtual machine ?

Re: Unabte to start VM in headless mode !!

Posted: 17. Feb 2018, 10:13
by socratis
You seriously need to look up the name of the VM that you're about to launch headless. The error tells you that no such VM exists; believe it. For starters, you seem to have manually intervened with the names. Check the differences of the VM folder and the VDI:
Dir: Home-Assistant
VDI: Home Assistant
You see the difference?

Whatever you have in your VirtualBox Manager as the VM name, that's what you got to put in the "<VM_Name>" field:
  • VBoxManage startvm "<VM_Name>" --type headless     or
    VBoxHeadless -s "<VM_Name>"

Re: Unabte to start VM in headless mode !!

Posted: 17. Feb 2018, 11:09
by andyp73
vincen wrote:Side question: if I run the command in a terminal and close terminal process will detach and continue or I'll kill the running virtual machine ?
They will keep running. Some of mine are started through an init script on a machine that no-one ordinarily ever logs into.

-Andy.