Sample Header Ad - 728x90

Service not displaying custom message on plymouth's splash screen during reboot

0 votes
1 answer
329 views
OpenSUSE Leap 15.6. I have a systemd service which backups the system to a NFS share just before the latter is unmounted using rsnapshot:
[Install]
WantedBy=multi-user.target

[Service]
ExecStop=sh -c 'systemctl list-jobs | grep -q "poweroff.target.*start" && mountpoint -q /mnt/nas/backup && rsnapshot -V alpha'
RemainAfterExit=true
TimeoutStopSec=infinity

[Unit]
After=mnt-nas-backup.mount
Description=rsnapshot
The systemctl list-jobs | grep -q "poweroff.target.*start" && mountpoint -q /mnt/nas/backup shananigans are just guards set in place to make sure that the service won't run on reboot and that it will run only on poweroff, if the NFS share is accessible: you can ignore those. For any practical purpose, the ExecStop action is just running rsnapshot -V alpha. I thought it would be nice for plymouth to display a relevant message such as "Backing up..." on the poweroff's splash screen while the ExecStop action is running. Mind you, this is uncharted territory for me. First I started plymouth on /dev/tty3 from the fully booted-up system, and I tried displaying a simple message by running:
sudo plymouthd --no-daemon --tty=/dev/tty3
In one terminal and:
sudo plymouth display-message --text="Test"
In another terminal. This worked perfectly. After that, I copied the backup service to /etc/systemd/system/test.service and edited it so that the thing would just display a message on plymouth's splash screen and wait, changing TimeoutStopSec to 60 as a safety measure:
[Install]
WantedBy=multi-user.target

[Service]
ExecStop=sh -c 'plymouth display-message --text="Test"; sleep 30'
RemainAfterExit=true
TimeoutStopSec=60

[Unit]
After=mnt-nas-backup.mount
Description=test
sudo systemctl enable --now test.service and sudo reboot. Of course, the poweroff process hangs for 30 seconds with no message on plymouth's splash screen. Although technically I should make sure plymouth-reboot.service is still up when the service runs, since I latched this using After=mnt-nas-backup.mount, plymouth-reboot.service being up is basically guaranteed, and proof of that is the fact that I can see the service running and hanging the poweroff process. I thought maybe some kernel parameter was preventing plymouth from displaying messages. So I changed:
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent preempt=full mitigations=auto quiet security=apparmor"
to:
GRUB_CMDLINE_LINUX_DEFAULT="splash preempt=full mitigations=auto quiet security=apparmor"
and ran sudo grub2-mkconfig -o /boot/grub2/grub.cfg (basically changing splash=silent to splash). quiet should be irrelevant here, however I also tried removing quiet at some point; security=apparmor also should be irrelevant since there are no apparmor profiles configured for plymouth. No dice. Any idea what could be preventing this from working? Here's the contents of plymouth-reboot.service, which isn't shedding any light for me:
[Unit]
Description=Show Plymouth Reboot Screen
After=getty@tty1.service display-manager.service plymouth-start.service
Before=systemd-reboot.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionVirtualization=!container

[Service]
ExecStart=/usr/sbin/plymouthd --mode=reboot --attach-to-session
ExecStartPost=-/usr/bin/plymouth show-splash
Type=forking
RemainAfterExit=yes
Asked by kos (4255 rep)
Aug 11, 2024, 08:04 AM
Last activity: Aug 24, 2024, 10:13 AM