0

On my lubuntu 24.04 distribution I have installed the hypervisor Oracle VirtualBox 7.1.6 and I have imported a Virtual Machine (called my-virtual-machine below in this question).

Start and Power Off a Virtual Machine by command lines

I have found how to start and power off a Virtual Machine by command line:

  1. To start a Virtual Machine:
/usr/bin/VBoxManage startvm 'my-virtual-machine' --type gui
  1. To power off a Virtual Machine:
/usr/bin/VBoxManage controlvm 'my-virtual-machine' acpipowerbutton

Descriptions of my needs

I have the following needs:

  1. to start my-virtual-machine (the Guest) automatically at boot time of my Host (that is lubuntu 24.04)
  2. to Power Off my-virtual-machine at the shutdown of the Host
  3. the Virtual Machine must to be start with the GUI and not headless

By this post, which is very old and refers to VirtalBox 4.2 but seems yet valid for VirtualBox 7.1, I'm able to solve my first request and perhaps the second request.

The problem is the third request because the method explained by the post allows to start the virtual machine at boot of the Host system but in headless mode and not with the GUI. When the Vitual Machine is correctly started I can see the following 2 process by ps aux command:

> ps aux | grep VBox
[...] /usr/lib/virtualbox/VBoxHeadless --comment my-virtual-machine --startvm 546632bd-b8bd-4f2d-b2a1-8657b968378a --vrde config
[...] /usr/lib/virtualbox/VBoxSVC --auto-shutdown --inherit-startup-pipe 7

Question

How to start a Oracle VirtualBox VM with GUI (and not headless) at boot time of the Host system and power off the VM at the shutdown of the Host system?

User051209
  • 539
  • 1
  • 7
  • 24

1 Answers1

0

I have found a useful work-around: first of all the start of the Virtual Machine headless must be rimain exactly how it is described in the question. In fact normally it is not necessary to start the GUI of the Virtual Machine, but only in some rare cases.

Manual start of the Oracle VirtualBox GUI

After the boot process of the Host is completed and when is necessary to start the GUI of the Vitual Machine I can start the Orcale Virtualbox GUI by a double click on the VirtualBox Icon, or by the command VirtualBox executed in a terminal.
In my case it is opened the image showed below: Oracle VirtualBox GUI with VM running

The image highlights that:

  1. the Virtual Machine is Running
  2. the button on the top right change from Start to Show.

Show the VM GUI by the button Show

Clicking on the button Show (which is highlighted in the previous image) it is possible to start the GUI of the Virtual Machine.
This is exactly what I want because, the headless starting of the Virtual Machine it is sufficient in most cases of boots of the system, and only sometimes it is necessary open the GUI of the Virtal Machine.

User051209
  • 539
  • 1
  • 7
  • 24