9. Automatic Startup

9.1. Hypervisor Host autologin

If you want to enable automatic login to the Hypervisor Host after booting has finished, follow the next steps.

sudo -e gedit /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
# autologin-settings to be appended
autologin-user=insert_your_username_here
autologin-user-timeout=0

9.2. Automatic guest startup

9.2.1. Enable autostart

In this section we will show how one or multiple guests can be started automatically after the Hypervisor has finished booting.

9.2.1.1. Introduction

To automatically start guests after the hypervisor finished booting, you need to adjust the /hv/config/usr_guest_autostart.config file.

gedit /hv/config/usr_guest_autostart.config

All guests that shall be started automatically have to be included here by inserting its respective guest foldername. The following example configuration will automatically start 4 guests, located in the folder guest0001 to guest0004.

/hv/guests/guest0001
/hv/guests/guest0002
/hv/guests/guest0003
/hv/guests/guest0004

The configuration settings will only become effective after running the command hv_set_autostart. This command requires the hypervisor root configuration file name as parameter. The root configuration file used by the System Manager is located in /hv/config/hv.config. The root configuration file used by the RT-Linux example guest configuration is located in /hv/guests/examples/rt-linux/hv.config.

hv_set_autostart -enable HYPERVISOR_ROOT_CONFIG_FILENAME

Hint

This command will copy, rename and adjust the hv_guest_autostart.service template located in the guest folders into the /hv/services/hv_guest_autostart-GUEST.service (where GUEST is the guest foldername).
Then it will enable a respective systemd service located in /etc/systemd/system.
This service will automatically start the guest after booting the system.

Caution

If you change the settings in usr_guest_autostart.config you need to first disable the autostart configuration and then re-enable the new configuration:

hv_set_autostart -disable
hv_set_autostart -enable HYPERVISOR_ROOT_CONFIG_FILENAME

9.2.1.2. Automatic startup of example guests (RT-Linux)

Uncomment the line /hv/guests/examples/rt-linux show_console in usr_guest_autostart.config to automatically configure starting the example RT-Linux guest. You may also uncomment the line /hv/guests/examples/windows show_console to automatically configure starting the example virtual KVM guest (e.g. Windows or Ubuntu).

;###################################################
; user specific guest autostart configuration script
;###################################################

; autostart example RT-Linux guest
; if guest console shall be shown automatically, use parameter show_console
/hv/guests/examples/rt-linux show_console

; autostart example Windows guest
; if guest console shall be shown automatically, use parameter show_console
/hv/guests/examples/windows show_console

; autostart example Ubuntu guest
; if guest console shall be shown automatically, use parameter show_console
; /hv/guests/examples/ubuntu show_console

; autostart system manager created guests (to be removed if system manager supports autostart handling)
; if guest console shall be shown automatically, use parameter show_console

Then enable autostart:

hv_set_autostart -enable /hv/guests/examples/rt-linux/hv.config

9.2.1.3. Automatic startup of System Manager managed guests

Currently, the System Manager does not support setting autostart configuration from within the GUI. It is required to add additional lines /hv/guests/guestXXXX show_console in usr_guest_autostart.config to automatically configure starting System Manager generated guests.

;###################################################
; user specific guest autostart configuration script
;###################################################

; autostart example RT-Linux guest
; if guest console shall be shown automatically, use parameter show_console
/hv/guests/examples/rt-linux show_console

; autostart example Windows guest
; if guest console shall be shown automatically, use parameter show_console
/hv/guests/examples/windows show_console

; autostart example Ubuntu guest
; if guest console shall be shown automatically, use parameter show_console
; /hv/guests/examples/ubuntu show_console

; autostart system manager created guests (to be removed if system manager supports autostart handling)
; if guest console shall be shown automatically, use parameter show_console
/hv/guests/guest0001
/hv/guests/guest0002

When enabling autostart, the /hv/config/hv.config file needs to be used:

hv_set_autostart -enable /hv/config/hv.config

9.2.1.4. Standard console mode

The show_console parameter following the guest foldername will automatically launch a console window to the guest when logging in into the Hypervisor Host.

The following example configuration will automatically start 3 guests, located in the folder guest0001 to guest0003. A console window will be displayed for guest 1 and 3.

/hv/guests/guest0001 show_console
/hv/guests/guest0002
/hv/guests/guest0003 show_console

Hint

Here, the hv_guest_autostart_xfce.sh template will also be copied, renamed and adjusted into /hv/services/hv_guest_autostart_xfce-GUEST.sh.
When rebooting and after logging in, the Hypervisor will read the autostart.desktop file located in the home folder in ~/.config/autostart. This file points to a script file /hv/bin/xfce-hv_autostart.sh which launches all console windows that are configured in usr_guest_autostart.config.

9.2.1.5. Standalone console mode

The standalone_console parameter following the guest foldername will automatically launch a full screen console window to the guest when logging in into the Hypervisor Host.

The following example configuration will automatically start 3 guests, located in the folder guest0001 to guest0003. A full screen console window will be displayed for guest 3.

/hv/guests/guest0001
/hv/guests/guest0002
/hv/guests/guest0003 standalone_console
By default, the monitor/display is configured to never turn off.
This can be adjusted by editing the script /hv/bin/guest_autostart_standalone_dispconf.sh and commenting out the respective commands.
# disable DPMS (Energy Star) features
# sudo xset -dpms >>$HV_BIN/guest_autostart_standalone_dispconf.log 2>&1

# turn off screen saver
# sudo xset s off >>$HV_BIN/guest_autostart_standalone_dispconf.log 2>&1

Caution

You should disable the Hypervisor Host desktop to assure the standalone console mode works properly. See section Disable Hypervisor Host desktop how to disable the Hypervisor Host desktop.

Caution

In the current RTOSVisor version, the standalone_console only works for the guest which is started last.

Caution

The standalone_console must not be used in conjunction with graphics passthrough.

Hint

This command will copy, rename and adjust the hv_guest_autostart_standalone.service template located in the guest folders into the /hv/services/hv_guest_autostart_standalone-GUEST.service (where GUEST is the guest foldername).
Then it will enable a respective systemd service located in /etc/systemd/system.
This service will automatically start the guest after booting the system.

Caution

Only one single KVM guest (no RTOS guest) can use the standalone console. Furthermore, if one guest is using the standalone console, no other guests can use the standard console anymore.

9.2.2. Disable autostart

To disable automatic start of guests, run the command

hv_set_autostart -disable

A complete reset of the autostart configuration can be done using the following command (it will not change the configuration settings in usr_guest_autostart.config):

hv_set_autostart -reset

9.2.3. Verify autostart

To show the current autostart configuration, run the command

hv_set_autostart -show

9.3. Hypervisor Host services

The hypervisor is using systemd services to automatically start guests, drivers etc. All services are located in the /hv/services folder. Active services will have a link set in /etc/systemd/system which point to the respective service file in /hv/services

The following services exist:

hv_sysmgr.service               - start the graphical System Manager web server backend
hv_loaddriver.service           - load the basic hypervisor drivers
hv_part.service                 - hypervisor partitioning, e.g. assigns PCI Ethernet Cards to a RTOS
hv_usbip_expose.service         - expose USB devices to Real-time guests
hv_vmf_autostart.service        - start the Virtual Machine Framework (the RTOS-VM Hypervisor) and load the hypervisor configuration
hv_guest_autostartXxxx.service  - start one specific guest

9.4. Autostart RT-Linux Applications

Automatic startup of RT-Linux applications is configured in the guest.config file located in the guest folder (section [Rtos\Autostart\1]). By default automatic start is enabled.

If this autostart section is active, the autostart script autostart.sh will be executed after RT-Linux has booted. This file is located in the files subfolder of the guest folder.

You may adjust both files according to your needs.