This guide describes how to get Kodi running on Debian Bookworm based Raspberry Pi OS Lite 64Bit without having to run the full LXDE GUI of the desktop version.
It is based on this guide.
First, install kodi as usual with
apt install kodi
Then add a systemd service file to start Kodi (as /etc/systemd/system/kodi.service
):
[Unit]
Description=Kodi standalone
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
[email protected]
[Service]
User=pi
Group=pi
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/kodi-standalone
ExecStop=/usr/bin/killall --exact --wait kodi.bin
Restart=on-abort
StandardInput=tty
StandardOutput=journal
[Install]
Alias=display-manager.service
Note: On service start /usr/bin/kodi-standalone
is executed, which calls /usr/bin/kodi
which in turn calls sudo openvt
and sudo service
. This makes it necessary to add the following file as /etc/sudoers.d/030-kodi-standalone
:
pi ALL=(ALL) NOPASSWD:/usr/bin/kodi,/usr/lib/kodi,/usr/share/kodi,/usr/bin/kodi-standalone,/usr/lib/kodi/kodi.bin,/usr/bin/killall,/usr/sbin/service,/usr/bin/openvt
Next is telling RPI OS Lite, that it should boot to graphical target instead of console only with:
sudo systemctl set-default graphical.target
Note, that the kodi.service file provides display-manager.service as alias. This is why it gets executed if graphical.target is set as boot preference!
Last step is adding the service to execution at startup with:
sudo systemctl enable kodi
At the next reboot, kodi should become visible on screen.
typo: please fix
suderos.d
-->sudoers.d