12. Automatic Guest Start
In this section we will show how the guest can be started automatically after hypervisor boot.
This will start the VM automatically during boot. The guest desktop will not be shown:
gedit /hv/VMs/vm1/vm_start.sh
uncomment ./vmrun.sh
The guest desktop can be started manually:
cd /hv/VMs/vm1
./vmview.sh
Hint
Automatic VM startup is done on behalf of the systemd service controlled via /etc/systemd/system/hv_vm1_start.service
.
This service can be enabled or disabled as shown below (it is enabled by default)
sudo systemctl enable /hv/services/hv_vm1_start.service
sudo systemctl disable hv_vm1_start
The Shutdown Hook /hv/VMs/vm1/vm_shutdown_hook.sh
is called when the guest is shut down (or crashes) by /hv/VMs/vm1/shutdown_svc.sh
.
You may adjust the files according to your needs.
13. Graphics (Desktop) configuration
13.1. Display both, Host and Guest Desktop
To automatically start the guest, see the previous chapter. In such case you may want the guest desktop to be shown automatically (after login into the hyperivosr host). Run the following script to show the guest desktop automatically after logging in into the hypervisor host:
cd /hv/home/.config/autostart
./install_autostart.sh
Caution
Do not run install_autostart.sh
with sudo!
You may want to also enable autologin on the host:
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
Hint
Automatic desktop startup after login is done by ~/.config/autostart/autostart_svc.sh
created by install_autostart.sh
which also adapts the sudoers list automatically.
Disabling desktop autostart can be achieved by removing the files created at ~/.config/autostart
:
rm ~/.config/autostart/autostart*
You may adjust the files according to your needs.
13.2. Display Guest Desktop only
When shipping the system to customers you may want to only display the guest desktop in full screen (= kiosk) mode. If kiosk mode is enabled you run the Windows guest in full screen mode without the option to switch back to the hypervisor host.
This will enable the kiosk mode after the next start of the guest VM:
gedit /hv/VMs/vm1/vmconfig.sh
export kiosk_mode=1
When using the kiosk mode with the previously shown automatic VM start and auto-login the hypervisor desktop is no longer required and should be disabled. In this case the guest is also started faster after power on.
Execute the following command to configure the host into a console-only mode.
sudo systemctl set-default multi-user.target
Without showing desktop you need to enable the hv_vm1_start_nodsktp.service to start the guest.
sudo systemctl enable /hv/services/hv_vm1_start_nodsktp.service
After rebooting $ sudo reboot
, the guest should be started automatically in kiosk mode without showing the host desktop.
Hint
If you want to reactivate the host desktop, run
sudo systemctl disable hv_vm1_start_nodsktp
sudo systemctl set-default graphical.target
sudo reboot
If you want to temporary start the host desktop, run
startx
sudo apt-get purge lightdm
Information about the Hypervisor system services components, which are automatically started.
hv_part.service - assigns PCI Ethernet Cards to a RTOS (see Hypervisor Quickstart Guide)
hv_rtos_start.service - starts a RTOS guest (see Hypervisor Quickstart Guide)
hv_vm1_start.service - starts a Windows/Ubuntu guest with desktop (see Windows Guest Guide)
hv_vm1_start_nodsktp.service - starts a Windows/Ubuntu guest with desktop (see Windows Guest Guide)
Each service depends on previous ones and waits for it before its start.
Hint
It is also possible to completely hide all logging messages during the computer boot.
Open /boot/grub/grub.cfg
and find your boot configuration used for the deployment mode. It begins with “menuentry ..”
text.
Find a linux kernel boot line looking like “linux /boot/vmlinuz-5.5.0-41-generic “. Add parameters
.. code-block:: bash
“quick splash console=ttyS0”.
Save file and reboot.
Hint
It is also possible to completely hide login/password prompt, that is displayed before a VM Guest window is shown in the kiosk mode. Execute the following command: .. code-block:: bash
“systemctl disable getty@tty1.service” and reboot.
You should see no login prompt anymore. The screen should remain black and then VM Desktop should be displayed. If you wish to log in, press a hot key Ctrl-Shift-F2..F6.
13.3. Guest Desktop via Pass-Through
Using graphics pass-through mode the integrated graphics hardware is assigned to the Windows guest and no longer available for the host. This described in the Passthrough Guide