This is an old revision of the document!
Table of Contents
Installing Kodi 20.1 on GNU/Linux Debian 12
This is an updated recipe to install Kodi as a media center on a Debian machine. The service will start automatically at bootstrap and will run under an unprivileged user. A login manager (e.g. LightDM) and a window system (e.g. X11 or Wayland) are not required.
- kodi 20.1 Nexus
- Linux kernel 6.1.0
Installing without X, Wayland, LightDM or whatever
During the Debian install, the tasksel will ask you what environment do you want to install. Deselect all the Debian desktop environments and enable only the SSH server.
Debian packages to install:
- kodi - Depends on kodi-bin and kodi-data.
- kodi-inputstream-adaptive - Required e.g. by the YouTube addon.
- kodi-peripheral-joystick - Requied if you want to control Kodi e.g. with a SNES controller.
- kodi-repository-kodi - The official Kodi repository addon.
- kodi-visualization-spectrum
- acpi-support - Required to support e.g. power button actions.
Starting Kodi as unprivileged user
It is advisable to run the Kodi media player under an unprivileged user, it is common practice to create the user kodi:
adduser kodi
Add the user to the standard Debian groups, to allow using the hardware (mainly the video and the input groups):
cdrom:x:24:kodi floppy:x:25:kodi audio:x:29:kodi dip:x:30:kodi video:x:44:kodi plugdev:x:46:kodi users:x:100:kodi input:x:102:kodi netdev:x:106:kodi
You can start Kodi from a console virtual terminal just executing kodi-standalone; the script will launch the program without a window manager and the windowing method will be the Generic Buffer Manager (GBM), because we did not install X11 nor Wayland.
Power off System and Reboot options in the Exit menu
There is an obsolete recipe that suggests to install Kodi as a systemd service under the control of the kodi user. Using polkit and acpi-support you should be able also to enable the Power off System and Reboot options in the Kodi exit menu. This seems no longer possibile, because the systemd-logind.service imposes that you have a full terminal session to do things like poweroff the system.
This means that if you run Kodi as a systemd service under the kodi user, you cannot give enough permissions to the process to let the Power off System and Reboot options appear in the Exit menu of Kodi.
So the recommended way to run Kodi as a startup service and as unprivileged user, is to enable the aoutlogin of the kodi user on a virtual terminal of the console and create a .profile script that will launch the kodi-standalone program.
Start at bootstrap
/etc/systemd/system/getty@tty1.service.d/autologin.conf
[Service] ExecStart= ExecStart=-/sbin/agetty --autologin kodi --noclear %I $TERM
The first ExecStart=
line will clear the eventually existing definition inherited by the getty@.service
service. The second ExecStart=-
(with the dash) instructs systemd to execute the program agetty and threat any error as non fatal. The %I placeholder is replaced by the terminal name (tty1 in our example). Finally the environment variable $TERM
is passed to agetty, hopely it is initailized by the system to the correct value.
/home/kodi/.profile
# Start the Kodi media center, only if text console on VT1. if [ -z "$DISPLAY" -a "$(tty)" = "/dev/tty1" ]; then while true; do kodi-standalone echo "Sleeping 15 seconds before restarting Kodi; press Ctrl-C to interrupt..." sleep 15 done fi
Installing Kodi 21 Omega on Debian 12 Bookworm
I decided to upgrade to Kodi 21 Omega on my home media center, based on Debian 12 Bookworm. I For this purpose I took advantage of the Deb-multimedia repository, which packages Kodi 21 ad bookworm-backports. So the upgrade was:
- From: Kodi 20.1 (Nexus) di Debian 12 Bookworm
- To: Kodi 21.2 (Omega) di deb-multimedia bookworm-backports
I added the Deb-multimedia repositories into a file named /etc/apt/sources.list.d/dmo.sources:
Types: deb URIs: https://www.deb-multimedia.org Suites: bookworm Components: main non-free Signed-By: /usr/share/keyrings/deb-multimedia-keyring.pgp Enabled: yes Types: deb URIs: https://www.deb-multimedia.org Suites: bookworm-backports Components: main Signed-By: /usr/share/keyrings/deb-multimedia-keyring.pgp Enabled: yes
It is required to install the deb-multimedia keyring to authenticate the packages:
wget https://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2024.9.1_all.deb dpkg -i deb-multimedia-keyring_2024.9.1_all.deb
apt update apt upgrade
Then I installed the new packages:
apt -t bookworm-backports install \ kodi \ kodi-data \ kodi-eventclients-common \ kodi-inputstream-adaptive \ kodi-inputstream-ffmpegdirect \ kodi-inputstream-rtmp \ kodi-peripheral-joystick apt --fix-broken install
The kodi-data package did not install cleanly because it needs to overwrite a file belonging to another package (due different packaging from official Debian and Deb-multimedia). So I downloaded two packages and installed them with a force option:
apt download kodi/bookworm-backports apt download kodi-data/bookworm-backports dpkg -i --force-overwrite kodi*.deb
I installed the kodi-inputstream-ffmpegdirect package because it seems to be required to play streams that use MPEG-DASH or similar formats, especially those that are not DRM-protected. The Dynamic Adaptive Streaming over HTTP is used also by YouTube.
Real Time Messaging Protocol (RTMP) is a proprietary network protocol developed by Adobe Inc. to transmit audio, video and other data over the Internet. YouTube does not uses RTMP.