Systemd service units to run Kodi in standalone mode without the need for a DE. Both X11 and GBM are supported (makes little sense to use Wayland in standalone mode).
Arch Linux users can find a PKGBUILD in the AUR that will take care of everything. Simply install and use.
Users of Arch ARM should NOT use this method as the distro package provides analogous functionality.
Users of other distros should install the following files:
init/kodi.service
andinit/kodi-gbm.service
to/usr/lib/systemd/system
init/sysusers.conf
to/usr/lib/sysusers.d
, then runsystemd-sysusers
init/tmpfiles.conf
to/usr/lib/tmpfiles.d
, then runsystemd-tmpfiles --create
Note that the kodi user's home directory is /var/lib/kodi/
in this example, NOT /home/kodi/
like a regular user.
Simply call the requisite service to start, for kodi-x11:
systemctl start kodi
Or for kodi-gbm:
systemctl start kodi-gbm
-
kodi (x11 or gbm)
-
polkit
-
xorg-server and xorg-xinit (for running x11)
-
libinput (for running gbm)
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.
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.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
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