Page 1 of 1

Running in Headless mode with non standard file structure

Posted: 29. Oct 2020, 18:33
by MoulderUtes
Just want so say I'm new to this so some go easy.
I installed a VirtualBox to D:\VirualBox (I didnt see the spelling error at the time)
I set up the VM install location to D:\VB os's\ (so there is a Debian folder with the logs, snapshots, Debian.vbox , Debian.vdi, etc inside)
I also was trying things so I set up a batch script in C:\Users\bryce (default cmd directory) that says (see below) so I dont have to change directory every time

Code: Select all

@echo off
"D:\VirualBox\VBoxManage.exe" %*
I want to run headless mode and ssh into the server because I feel it is easier (things like monitor scaling, pasting, etc). After researching some I found this script-

Code: Select all

vboxmanage startvm {"vmname" or UUID} --type headless 
When I change it to say {"Debian"} and run it in cmd I get-

Code: Select all

VBoxManage.exe: error: Could not find a registered machine named '{Debian}'
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 722 of file VBoxManageMisc.cpp
I next tried it at D:\VirualBox and got-

Code: Select all

VBoxManage.exe: error: Could not find a registered machine named '{Debian}'
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee IUnknown
VBoxManage.exe: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 722 of file VBoxManageMisc.cpp
As a last resort I tried it at D:\VB os's and got

Code: Select all

'vboxmanage' is not recognized as an internal or external command,
operable program or batch file.
How do I run headless mode with a non stand file structure?
Can I write a batch script to do this from desktop?
How do I modify that script for other VM in the future?

Any help would be greatly appreciated and welcomed.

Re: Running in Headless mode with non standard file structure

Posted: 29. Oct 2020, 18:37
by scottgus1
That non-standard Virtualbox install location is going to bite you somehow somewhere. I recommend uninstalling Virtualbox and reinstalling it in the default "C:\Program Files". You can force new guests onto the D drive if you want, using the main Virtualbox window, File menu, Preferences, General, Default Machine Folder.

However, the 'vboxmanage' command doesn't have the curly braces when using the VM's name:

vboxmanage startvm "vmname" --type headless

Try

vboxmanage startvm "Debian" --type headless

Also note the vm name is case sensitive. Debian != debian, etc.

Re: Running in Headless mode with non standard file structure

Posted: 29. Oct 2020, 18:46
by MoulderUtes
Thanks scottgus1 that worked! :D
Also how would I do a soft shutdown would it be

Code: Select all

vboxmanage stopvm "Debian"
Thanks and man your fast to respond.

EDIT: Definitely not stopvm but is it close session?
EDIT 2: Just realized in headless mode I can just send power off if I view it from the gui.

Re: Running in Headless mode with non standard file structure

Posted: 29. Oct 2020, 19:01
by scottgus1
MoulderUtes wrote:your fast to respond.
Just happened to be sitting here for now. Thanks!

The manual has all the vboxmanage commands, section 8. There isn't a 'stopvm', but there is:
VBoxManage controlvm "vmname" acpipowerbutton: Sends an ACPI shutdown signal to the VM, as if the power button on a real computer had been pressed.
Set your VM's OS to respond nicely with a shut-down to the power button being pressed, then issuing this command will start a peaceful shutdown.

Generally speaking, 'controlvm' contains everything you can do to a VM from the host command line while the VM is running.

Another command you might like is:
vboxmanage startvm "vmname" --type separate
This one shows the headless guest's screen in a window that can be closed again with the window's Machine menu, 'Detach GUI' command, while the guest stays running headless. You can start headless then run 'separate' to show the window, or start 'separate' from the beginning then go to headless later. There is no vboxmanage command to close the window while leaving the guest running, but you can assign a Host-key-combination to the menu command, I use Host-D. See the main Virtualbox window, File menu, Preferences, Input, Virtual Machine tab, Detach GUI setting.

FWIW 'Headless' isn't real server-room-style "headless", it's more like 'Monitorless'. The guest OS GUI still calculates and is ready to show soon as the guest Virtualbox window is brought up.

Re: Running in Headless mode with non standard file structure

Posted: 29. Oct 2020, 19:11
by MoulderUtes
Thanks, I'll go read through the manual. But it seems to be working. Thanks for the heads up on the headless. I am just running a terminal only debian so not much processing power being used on the terminal. Is there anyway to close a thread? Im going to look around and see if I have the option but once again thank you.

Re: Running in Headless mode with non standard file structure

Posted: 29. Oct 2020, 19:19
by scottgus1
No need to close, the forum's not like a ticket-based structure.

Glad you're up and running!