Go to file
graysky 8c5d854a36 back to user.slice
It seems that as long as the Kodi menu is used to call a shutdown or reboot,
the services will allow the application to gracefully exit including saving
settings, uptime etc.  This will only NOT occur if the user calls the box to
shutdown or reboot via a call to systemctl for the reasons cited in previous
commits.

While not optimal, it is consistent with the same thing happening if others
users are logged into the box, working, and a sysadmin calls the systemctl
to reboot.  The result is users will lose work/data.

Going back to the user.slice is better for USB mounts, and for pulseaudio
sessions as well.
2021-01-03 21:15:41 -05:00
init back to user.slice 2021-01-03 21:15:41 -05:00
Makefile back to user.slice 2021-01-03 21:15:41 -05:00
MIT restore call to kodi-standalone, fixes #26 2020-11-08 08:30:46 -05:00
README.md back to user.slice 2021-01-03 21:15:41 -05:00

kodi-standalone-service

Systemd service units to run Kodi in standalone mode without the need for a DE. X11, Wayland, and GBM are supported.

Which one to choose?

In terms of functionality, X11 is probably the most mature and feature rich. Wayland is next in line and should be considered on-par with X11, however, a known limitation of Wayland is having the resolution and frame rate set in the compositor rather than in kodi's GUI. As well, Wayland currently does not support VT switching. GBM has some known features it lacks compared the X11 and Wayland. A complete list can be found in Kodi issue 14876.

Another factor that may affect choice is the number of dependencies required to run which will vary distro-to-distro.

Installation

Arch Linux

Arch Linux users can find a PKGBUILD in the AUR that will take care of everything. Simply install and use.

ARM distros

Users of ARM distros such as Arch ARM, Raspberry Pi OS (formerly Raspbian), etc. should NOT use these files since their official corresponding kodi packages supply their own version of a service. If you are knowledgeable enough with your distro, feel free to use/modify.

Ubuntu

For the kodi user to access devices on /dev/ttyxxxx, users will need to edit init/sysusers.conf and uncomment the line corresponding to enable membership in the dialout group.

Other distros (manual installation)

Users of other distros can just run make install as the root user. Then, as the root user:

  • Run systemd-sysusers
  • Run systemd-tmpfiles --create

Note that the kodi user's home directory is /var/lib/kodi/ in this example, NOT /home/kodi/ like a regular user.

Usage

Simply start/enable the requisite service.

Dependencies

  • kodi (x11 or wayland or gbm)
  • libinput and cage (for running wayland)
  • libinput (for running gbm)
  • xorg-server and xorg-xinit (for running x11)

Passing environment variables to the service

Should the need arise, one can pass environment variables to the service by creating /etc/conf.d/kodi-standalone and populating it with the needed variables.

Acknowledgments

Much of the credit for this service goes to the Arch Linux maintainers of the official kodi package. Note that they removed it upon the 1.16-1 release of Xorg.

Tips and Tricks

Service not starting

Most users should not need /etc/X11/Xwrapper.config since the created X server becomes the controlling process of the VT to which it is bound. Most users does not mean all users. There have been reports of some AMD users still requiring this file. As well, users of Xorg's native modesetting driver may also require it.

The recommendation is to first try starting kodi-x11.service without it, but if the service fails to start X, you may need to create /etc/X11/Xwrapper.config which should contain the following:

needs_root_rights = yes

Running Kodi web service on a privileged port

Users wishing to run the kodi web service on a privileged port (i.e. <1024) can simply use a systemd drop-in modification as follows:

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE