After a preseed installation of ubuntu (or any linux dist) I want to display a message/warning for the user that some installation or configuration is happening during the first boot. Unfortunately anything related to x11 isn't going to work due to security restrictions (root cannot display for a user).
I decided to use dialog for this reason with a self-destroying service (best method I found so far).
The service is trying to execute the following script (replaced with a sleep because it's not relevant). I am trying to change to tty2 to display the dialog, doing some driver installation (which can't be compiled during the preseed), adding printers, etc pp.
Using a VM in virtual box this is working perfectly fine. Unfortunately, using machines, this doesn't work. It changes to tty2 but all I get is a black screen (in this case for the duration of the sleep) before it switches to the login manager.
This works using XDM/SDDM in the Before-Statement but not with GDM3 and it needs to work with the latter.
I tried adding display-manager in the Before-Statement and several services listed in display-manager.service but wasn't successful. It may be due to the nature of the gdm3-binary itself.
Question: How can I delay the gdm/display-manager.service upstart until my service finishes? Or are there better methods to display a warning until my script is done?
The service
[Unit]
Description=FirstBoot
Wants=network-online.target
After=getty@tty2.service plymouth-quit.service network.target network-online.target
Before=gdm3.service
Requires=cups.service
[Service]
Type=oneshot
ExecStart=/bin/bash /home/admin00/firstboot.sh
ExecStop=/bin/systemctl disable firstboot.service
ExecStopPost=/bin/sh -c 'rm /etc/systemd/system/firstboot.service'
StandardInput=tty
TTYPath=/dev/tty2
TTYReset=yes
TTYVHangup=yes
[Install]
WantedBy=multi-user.target
The script
#!/bin/bash
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
if ! chvt 2 &>/dev/null; then
break
fi
(
sleep 30s
) | dialog --title "IT Afterconfiguration" --infobox "\n P L E A S E\n W A I T\n\n Your system is being configured" 8 40
dialog --no-cancel --no-ok --pause ' Continuing in ...' 6 27 5 --
rm -rf $ABSOLUTE_PATH
òneshotas you can see above. But I will try it withRemainAfterExittomorrow and give feedback! Thanks for the reply. – Sefer Aug 04 '19 at 23:04WantedBy=should rather begraphical.targetinstead ofmultiuser.target. That way the system is up except for the graphical desktop. See target units here - not tested, though. You could display a non-GUI message there. – FelixJN Sep 06 '19 at 10:31