This will sort out the permissions warning mentionned in #27.
The RuntimeDirectory is created in /run/kodi with the necessary
permissions, %t points at /run.
See systemd.exec(5) and systemd.unit(5).
If I call systemctl to shutdown or reboot, the effect is that it does
not honor kodi-x11.service's ExecStop= line which results in an
unclean exit of kodi and of data loss since kodi writes out some data
when it exits. By contrast, calling systemctl to stop the service
works as expected.
It seems systemd treats processes in user.slice differently that those
in system.slice and that removing PAMName=login was to blame for kodi's
processes running in user.slice.
Discussion:
https://lists.freedesktop.org/archives/systemd-devel/2020-December/045713.htmlhttps://bbs.archlinux.org/viewtopic.php?id=261684
Calling the kodi-xxx target in ExecStart= was not actually the key to
fixing the shutdown bugs in 847b6ec65. Adding the ExecStop= calling
killall to the exact target was needed.
This commit restores the call to kodi-standalone to allow the
"RestartApp" built in to work again and adds the key ExecStop= with
killall.
Direct call to kodi-xxx in ExecStart= allows direction of kill signal to that
rather than to kodi-standalone wrapper. This allows the kill signal to hit
the indented executable. As well, using killall in the ExecStop= allows for
synchronous stopping and for kodi to do shutdown housekeeping tasks such as
saving settings, stopping services (web, zeroconf, etc.) and unloading things.
Use the same dependencies and their order in both systemd units.
Add additional units of services that kodi uses.
Don't use "Requires=", kodi can run without a network connection.
Export WINDOWING=x11 in kodi.service to skip the autodetection that /usr/bin/kodi-standalone performs.
Give kodi-gbm.service the privileges of input group, this allows removing the kodi user from that group's membership since kodi.service does not need it.
Improve service description.
Use graphical.target, Xorg and graphical applications should only be started in graphical.target not in multi-user.target.