• Stars
    star
    158
  • Rank 237,131 (Top 5 %)
  • Language Roff
  • Created about 10 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use systemd to allow for standalone operation of kodi.

kodi-standalone-service

Run Kodi as an unprivileged user in standalone mode without the need for a full Desktop Environment. X11, Wayland, and GBM are supported.

Which one to choose?

In terms of functionality, GBM is currently the most feature rich. It is the only one of the three options able to display HDR content. X11 and Wayland are both a close second and should be considered on-par with GBM, 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 (likely users of Arch clones) can find a PKGBUILD in the AUR that will take care of everything. Simply install and use.

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
  • 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.

Dependencies

Note that I list some dependencies below that the Arch package already has listed as dependencies. This is to help users of other distros whose kodi packages may not have these listed. If you're installing this from the AUR package listed above, just pay attention to pacman's post-install message which calls out the Arch-specific optdepends needed for the various service files to work.

  • kodi (>=19.1 on Arch Linux, lower versions may work with other distros)
  • cage, libinput, and xorg-xwayland (for running wayland)
  • libinput (for running gbm)
  • xorg-server and xorg-xinit (for running x11)

Notes for users of non-Arch Linux distros

  1. Users of Ubuntu β‰₯20.0 will need to edit /etc/sysusers.d/kodi-standalone.conf and uncomment the line adding kodi user to the render group.

  2. Users of Ubuntu wishing the kodi user to access devices on /dev/ttyxxxx, will need to edit /etc/sysusers.d/kodi-standalone.conf and uncomment the line adding the kodi user to the dialout group.

Notes for Users of RPiOS

To use this with RPiOS Lite (Rasbian 11: Bullseye, Kodi 19.4: Matrix) requires an extra step.

  1. Ensure that the boot preference is set to a graphical target.
    sudo systemctl set-default graphical.target
    This causes the kodi service to launch automatically on boot via display-manager.target.
  2. Install the kodi-eventclients-kodi-send package and see shutdown/reboot.

Usage

Simply start/enable the requisite service.

Passing environment variables to the service

Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/kodi-standalone and they will be passed along to the service.

Notes on system shutdown/reboot

Be aware that these services run Kodi in systemd's user.slice not in the system.slice. In order to have Kodi gracefully exit, the system should be called to shutdown or to reboot using the respective Kodi actions not by a call to systemctl. Failure to do so will result in an ungraceful exit of Kodi and the saving of GUI settings, Kodi uptime etc. will not occur. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run Kodi in systemd's system.slice instead, doing so makes it difficult to use USB mounts within Kodi and to use pulseaudio for Kodi sessions.

Recommended methods to reboot/shutdown

Here are several options:

  • Select the corresponding option under Power menu in the Kodi GUI.
  • Use the official Android/iOS remote app.
  • If a CLI option is preferred, use kodi-send to issue a Reboot or ShutDown() like so:
$ kodi-send -a "Reboot"
$ kodi-send -a "ShutDown()"

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

More Repositories

1

profile-sync-daemon

Symlinks and syncs browser profile dirs to RAM thus reducing HDD/SDD calls and speeding-up browsers.
Shell
899
star
2

kernel_compiler_patch

Kernel patch enables compiler optimizations for additional CPUs.
652
star
3

xscreensaver-aerial

xscreensaver that randomly selects one of the Apple TV4 aerial movies
Shell
426
star
4

anything-sync-daemon

Symlinks and syncs user specified dirs to RAM thus reducing HDD/SDD calls and speeding-up the system.
Shell
345
star
5

pulseaudio-ctl

Control pulseaudio volume from the shell or mapped to keyboard shortcuts. No need for alsa-utils.
Shell
275
star
6

lostfiles

Simple script that identifies files not owned by any Arch Linux package.
Shell
270
star
7

profile-cleaner

Simple script to vacuum and reindex sqlite databases used by Firefox and by Chrome/Chromium.
Shell
203
star
8

modprobed-db

Keeps track of EVERY kernel module that has ever been probed. Useful for those of us who make localmodconfig :)
Shell
171
star
9

clean-chroot-manager

Wrapper script for managing clean chroots under Arch Linux
Shell
110
star
10

configs

User and system config files.
Shell
53
star
11

ovpngen

Generate an OpenVPN Connect private tunnel profile in the unified format
Shell
44
star
12

hosts-update

Updates /etc/hosts with the mvps blocklist to prevent thousands of parasites, hijackers and unwanted adware/spyware/privacy websites from working.
Shell
42
star
13

sleepnoise

Turn a Raspberry Pi into a white noise generator
Shell
36
star
14

auto-reencode

Mass convert wmv and flv files to mp4 contained x264 files using ffmpeg.
Shell
19
star
15

adblock-by_haarp

A clean, lean and mean adblocking script for TomatoUSB routers
Shell
19
star
16

bin

Collection of scripts perhaps of utility to others.
Shell
17
star
17

lxc-service-snapshots

Run disposable (read-only then delete) Linux containers (LXC) to serve up OpenVPN (server only), Pi-Hole, or WireGuard.
Shell
17
star
18

newsboat_custom_stuff

Hacky shell scripts to generate RSS feeds on the fly for newsboat
Shell
15
star
19

mplayer-resumer

An mplayer wrapper script that will resume playback of previously-stopped video where you left off. Written by Bob Igo.
Perl
14
star
20

streamzap

Linux Streamzap USB remote config files for lirc, mplayer and kodi
Python
12
star
21

mandb-ondemand

Rebuilds the manpage index database on-demand to speed-up pacman operations.
Makefile
11
star
22

arris-capture

Shell script to log Arris power levels, signal-to-noise ratio and frequencies. Ready to graph in dygraph.
Shell
11
star
23

backdrop-randomizer

Companion for xfdesktop which randomly cycles through wallpapers without repeating.
Shell
9
star
24

distccd-arch-arm

Provides an Arch ARM client with Systemd services/environment files to make use of distcc-alarm naively.
Makefile
8
star
25

kodi-logger

Keeps track of every video you watch on kodi (xbmc).
Shell
8
star
26

raspberrypi-kodi-service

Systemd service unit to run with minimal frame buffer to save GPU memory
7
star
27

kodi-prevent-xscreensaver

Keep xscreensaver from coming on when kodi is active.
Makefile
6
star
28

crosstool-ng_for_distcc

Build your own toolchain with crosstool-ng for Arch ARM volunteers to help build x86_64 stuff
5
star
29

RT-N66U

Miscell. scripts the Asus RT-N66U running TomatoUSB can use.
4
star
30

linux-optimized

more or less the old linux-ck but without ck patches since they are no longer maintained
Shell
4
star
31

odroid-auto-bridge

Simple method to create a network bridge for the ODROID-C1+/C2/XU4.
Makefile
4
star
32

governor-switcher

Systemd units to toggle between ondemand and performance based on time of day.
Makefile
3
star
33

sb6121-capture

Shell script to log SB6121 power levels, signal-to-noise ratio and frequencies.
Shell
2
star
34

getpkg

Alternative to ABS, uses svn to pull Arch Linux PKGBUILD and associated files
Shell
2
star
35

multilame

Pseudo multi-threaded bash script to parallel encode .wav to .mp3 via lame
Shell
2
star
36

odroid-c2-rtc

Setup RTC shield for C2 on Arch ARM
Makefile
2
star
37

makechapterlist

Trivial bash script to make a chapter list file that MP4Box can use.
Shell
2
star
38

buildhelper

helper for building with devtools-alarm on Arch ARM using distcc
Shell
1
star
39

distccd-alarm

1
star
40

kodi-raspberry-pi3

Optimize kodi for the Cortex-A72 processor found on the Raspberry Pi 4
1
star