Giter VIP home page Giter VIP logo

kodi-standalone-service's Introduction

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 extra setup.

  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.

Notes for users of Proxmox

If running kodi containerized on Proxmox, see Issue #47.

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

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

kodi-standalone-service's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kodi-standalone-service's Issues

kodi-wayland exits but can cause seg fault without data loss

Since moving out of user.slice, I am unsure how to cleanly kill kodi with the wayland service. Currently, stopping it can end in a seg fault but after kodi cleanly writes out its data to disk. Moving it back under user.slice would not be a solution due to how systemd brutally kills user.slice stuff.

For now, this is probably the best compromise as it retains the functionality of kodi saving data on a reboot/shutdown command.

# systemctl stop kodi-wayland
...
Dec 29 06:59:29 myth2 systemd[1]: Stopping Kodi standalone (Wayland)...
Dec 29 06:59:31 myth2 cage[2788]: /usr/bin/kodi: line 219:  2794 Segmentation fault      (core dumped) ${KODI_BINARY} $SAVED_ARGS
Dec 29 06:59:31 myth2 cage[2788]: Crash report available at /var/lib/kodi/kodi_crashlog-20201229_065931.log
Dec 29 06:59:34 myth2 systemd[1]: kodi-wayland.service: Succeeded.
Dec 29 06:59:34 myth2 systemd[1]: Stopped Kodi standalone (Wayland).

And

% tail -f /var/lib/kodi/.kodi/temp/kodi.log
2020-12-29 11:59:29.878 T:139754774538944  NOTICE: Quitting due to POSIX signal
2020-12-29 11:59:29.969 T:139754774538944  NOTICE: Stopping player
2020-12-29 11:59:29.969 T:139754774538944  NOTICE: Storing total System Uptime
2020-12-29 11:59:29.970 T:139754774538944  NOTICE: Saving settings
2020-12-29 11:59:29.973 T:139754774538944  NOTICE: Saving skin settings
2020-12-29 11:59:29.973 T:139754774538944  NOTICE: Stopping all
2020-12-29 11:59:29.974 T:139754774538944   DEBUG: NetworkMessage - Signaling network services to stop
2020-12-29 11:59:29.974 T:139754774538944   DEBUG: NetworkMessage - Waiting for network services to stop
2020-12-29 11:59:29.974 T:139754774538944  NOTICE: stopping zeroconf publishing
2020-12-29 11:59:29.974 T:139754774538944  NOTICE: stop dvd detect media
2020-12-29 11:59:29.974 T:139754756888128   DEBUG: Thread ActiveAE 139754756888128 terminating
2020-12-29 11:59:29.975 T:139754544821824   DEBUG: Thread AESink 139754544821824 terminating
2020-12-29 11:59:30.176 T:139754774538944  NOTICE: Application stopped
2020-12-29 11:59:30.376 T:139754774538944  NOTICE: XBApplicationEx: destroying...
2020-12-29 11:59:30.376 T:139753773053504   DEBUG: Thread PeripEventScanner 139753773053504 terminating
2020-12-29 11:59:30.433 T:139753798231616   DEBUG: Thread PeripBusUSBUdev 139753798231616 terminating
2020-12-29 11:59:30.433 T:139753789838912   DEBUG: Thread PeripBusCEC 139753789838912 terminating
2020-12-29 11:59:30.433 T:139753781446208   DEBUG: Thread PeripBusAddon 139753781446208 terminating
2020-12-29 11:59:30.549 T:139754774538944  NOTICE: unload skin
2020-12-29 11:59:30.549 T:139754774538944    INFO: Unloading old skin ...
2020-12-29 11:59:30.550 T:139754774538944   DEBUG: ------ Window Deinit (Home.xml) ------
2020-12-29 11:59:30.550 T:139754774538944   DEBUG: FreeVisualisation() done
2020-12-29 11:59:30.556 T:139754774538944   DEBUG: Previous line repeats 1 times.
2020-12-29 11:59:30.556 T:139754774538944   DEBUG: CloseBundle - Closed bundle
2020-12-29 11:59:30.559 T:139754774538944   DEBUG: Stopping Wayland message pump
2020-12-29 11:59:30.559 T:139754133993024   DEBUG: Wayland message pump stopped
2020-12-29 11:59:30.559 T:139754133993024   DEBUG: Thread Wayland message pump 139754133993024 terminating
2020-12-29 11:59:30.559 T:139754774538944  NOTICE: unload sections
2020-12-29 11:59:30.560 T:139754774538944   DEBUG: LogindUPowerSyscall - delay lock sleep released
2020-12-29 11:59:30.560 T:139753764660800   DEBUG: Thread Timer 139753764660800 terminating
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17f09c00 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e49b80 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e35f00 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e2fec0 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e5ba90 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e13b10 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e30020 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e1ec60 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e03860 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17f28d30 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944    INFO: ADDON: cpluff: 'An unreleased information object was encountered at address 0x55eb17e57ef0 with reference count 1 when destroying the associated plug-in context. Not releasing the object.'
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 0 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 1 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 2 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 3 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 4 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 5 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 6 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 7 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 8 --> 0 instances
2020-12-29 11:59:30.561 T:139754774538944   DEBUG: object 9 --> 0 instances
2020-12-29 11:59:30.566 T:139754766132800   DEBUG: Thread Lirc 139754766132800 terminating
2020-12-29 11:59:30.569 T:139754774525504   DEBUG: Thread Announce 139754774525504 terminating
2020-12-29 11:59:30.570 T:139754774538944  NOTICE: XBApplicationEx: application stopped!

[Help] : Kodi service stops displaying after a while of inactivity.

Hello,

I have been using this service to run Kodi on my Raspberry Pi 4, without a DE.
But unfortunately, I noticed that Kodi goes into sleep with no output. (I use HDMI CEC to control Kodi). I tried to use some of the common solutions on Google, but no luck (most of them are geared to projects having DE/WM)
Is there something I can do to ensure Kodi doesn't stop the display, or should it be an issue with the OS?

ERROR: Unable to create GUI. Exiting in kodi-gbm

I can't make gobi-gbm works under my ubuntu 22.04 server (In Proxmox under LXC container but it's unrelated probably).

Here the logs:

Apr 21 16:21:23 Kodi systemd[1]: Started Kodi standalone (GBM).
Apr 21 16:21:23 Kodi kodi-standalone[454]: ERROR: Unable to create GUI. Exiting
Apr 21 16:21:23 Kodi kodi-standalone[465]: ERROR: Unable to create GUI. Exiting
Apr 21 16:21:23 Kodi kodi-standalone[476]: ERROR: Unable to create GUI. Exiting
Apr 21 16:21:24 Kodi kodi-standalone[445]: /usr/bin/kodi --standalone  has exited in an unclean state 3 times in the last 1 seconds.
Apr 21 16:21:24 Kodi kodi-standalone[445]: Something is probably wrong
Apr 21 16:21:24 Kodi killall[482]: kodi.bin: no process found
Apr 21 16:21:24 Kodi systemd[1]: kodi-gbm.service: Control process exited, code=exited, status=1/FAILURE
Apr 21 16:21:24 Kodi systemd[1]: kodi-gbm.service: Failed with result 'exit-code'.

Here is my kodi:

root@Kodi:~# kodi -v
Kodi Media Center 20.2 (20.2.0) Git:20230630-5f418d0b13
Copyright (C) 2005-2021 Team Kodi - http://kodi.tv

And here all the lines I used from a clean install:

git clone https://github.com/graysky2/kodi-standalone-service.git
cd kodi-standalone-service
make install
systemd-sysusers
systemd-tmpfiles --create
mkdir /etc/sysusers.d/
cat <<EOF > /etc/sysusers.d/kodi-standalone.conf
# override these settings by copying this to /etc/sysusers.d/ and modifying it therein

# Type Name ID GECOS Home directory Shell
g kodi - -
u kodi - "Kodi User" /var/lib/kodi

# supplemental groups
m kodi audio
m kodi optical
m kodi video

# other groups, see: /usr/lib/sysusers.d/arch.conf or basic.conf
# m kodi network
# m kodi power
# m kodi tty
# m kodi disk
# m kodi storage

# Ubuntu users only
# uncomment the following line if the kodi user needs access to /etc/ttyxxxx
# https://github.com/graysky2/kodi-standalone-service/issues/14
m kodi dialout

# uncomment the following line if you're running Ubuntu >=20 since they created
# a new render group of which the kodi user needs to be a member
m kodi render
EOF
systemctl mask systemd-logind
pam-auth-update
systemctl enable kodi-gbm
reboot

Did I miss a step ? I have no desktop environment installed at all.

EDIT:
I have those logs in kodi:

2024-04-21 16:44:44.587 T:552     error <general>: DBus error: org.freedesktop.DBus.Error.ServiceUnknown - The name org.freedesktop.UPower was not provided by any .service files
2024-04-21 16:44:44.598 T:552   critical <general>: CApplication::CreateGUI - unable to init windowing system

I'm messing up some stuff probably.
I'm trying to avoid having any desktop environment like LXQt.
Do I have to get a display server like X11 or Wayland installed at least ?

I understood that GBM was enough for kodi-gbm. It's already installed on my Ubuntu server by default as I'm aware. So I probably miss something.

Run kodi additionally to the display-manager

Hi,

I've tried without success to run kodi-standalone-service additionally to the displaymanager. The idea is that it should be always possible to get a full desktop.

Do you have an idea how to achive this? I've changed the install section in the unit file to WantedBy=multi-user.target

Best,
Stefan

block by prompt "[sudo] password for kodi"

I was using kodi stand alone on raspi with bullseye. It was working like a charm.

I re-installed a brand new "bookworm" system, and now I am stuck with this prompt on the screen:
"[sudo] password for kodi"

I made sure boot preference is set to a graphical target.
I can find a file named "/etc/sudoers.d/020_kodi"
I can manually launch kodi in userspace through ssh.

Any idea of whats going on ?

Why is the kodi user now always in the "input" group?

So far membership to the "input" group was only required for the "gbm" variant as it is accessing input devices directly without any display server handling this task.

But now you have the group membership directly in the "sysuser" file. Why? It is still additionally as supplementary group in the gbm service file.

If it is not really needed for all cases of running Kodi, I think the group membership should be removed again.

Use AmbientCapabilities=CAP_NET_BIND_SERVICE

Use AmbientCapabilities=CAP_NET_BIND_SERVICE in kodi.service to allow kodi use port 80 for webserver.

Patch

diff --git a/init/kodi.service b/init/kodi.service
index a3bbd75..549c4b9 100644
--- a/init/kodi.service
+++ b/init/kodi.service
@@ -12,6 +12,7 @@ TTYPath=/dev/tty1
 ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -nolisten tcp vt1
 Restart=on-abort
 StandardInput=tty
+AmbientCapabilities=CAP_NET_BIND_SERVICE
 
 [Install]
 WantedBy=multi-user.target

This should be work only with systemd >= 230

Conflict with ARM packages instead of abusing "arch"?

I'm currently working on merging back some changes I did for "vdr4arch" and one change we had was a different way to prevent conflicts with ARM.

The PKGBUILD should be arch=any as it only contains scripts and nothing else.

To properly prevent installing on ARM, together with the specialized kodi builds there, would be to add something like this to your PKGBUILD:

conflicts=("kodi-c1", "kodi-c2", "kodi-imx", "kodi-odroid", "kodi-rbp", "kodi-rbp-git", "kodi-rbp3", "kodi-rbp4")

libcec/ubuntu: Needs membership of dialout group

I'm not quite sure how to handle this, but on Ubuntu the kodi user needs to be a member of the dialout group in order to be able to access /dev/ttyXXXX devices.

This happens b/c of the following udev rule in Ubuntu (I would imagine Debian has the same):

rules.d/50-udev-default.rules:25:KERNEL=="tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"

This could be fixed by adding a m kodi dialout but it'll result in the creation of the dialout group on other systems like Arch.

Environment files start with "-"

The EnvironmentFile parameters start with "-". This means that the environment files weren't getting loaded. They're empty by default, of course, but I need to explicitly supply my LIBVA driver.

Headless scraping?

Not really an issue with this software but rather a question

If I use this to run Kodi without the GUI, what would be the easiest way of initiating the scraping process?
I've read about either using a MySQL Setup and somehow making the dbs on my own (?) although I can't find a cli scraper and something with kodi-send.

Does anyone have experience regarding this?
Thanks for the help

Cannot mount nfs share

When I'm trying to add nfs to kodi sources, it always fails. Seems like permission issue? Here's output:

2022-06-12 20:02:34.510 T:2143    ERROR <general>: GetDirectory - Error getting nfs://hostserv.serv/mnt/nas/transmission/
2022-06-12 20:02:34.510 T:2143    ERROR <general>: CGUIDialogFileBrowser::GetDirectory(nfs://hostserv.serv/mnt/nas/transmission/) failed
2022-06-12 20:02:36.426 T:2143    ERROR <general>: NFS: Failed to mount nfs share: /mnt/nas/transmission (mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13))
2022-06-12 20:02:36.426 T:2143    ERROR <general>: GetDirectory - Error getting nfs://hostserv.serv/mnt/nas/transmission/
2022-06-12 20:02:36.426 T:2143    ERROR <general>: CGUIDialogFileBrowser::GetDirectory(nfs://hostserv.serv/mnt/nas/transmission/) failed
2022-06-12 20:02:37.149 T:2143    ERROR <general>: NFS: Failed to mount nfs share: /mnt/nas/transmission (mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13))
2022-06-12 20:02:37.149 T:2143    ERROR <general>: GetDirectory - Error getting nfs://hostserv.serv/mnt/nas/transmission/
2022-06-12 20:02:37.149 T:2143    ERROR <general>: CGUIDialogFileBrowser::GetDirectory(nfs://hostserv.serv/mnt/nas/transmission/) failed
2022-06-12 20:02:38.091 T:2143    ERROR <general>: NFS: Failed to mount nfs share: /mnt/nas/transmission (mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13))
2022-06-12 20:02:38.091 T:2143    ERROR <general>: GetDirectory - Error getting nfs://hostserv.serv/mnt/nas/transmission/
2022-06-12 20:02:38.091 T:2143    ERROR <general>: CGUIDialogFileBrowser::GetDirectory(nfs://hostserv.serv/mnt/nas/transmission/) failed
2022-06-12 20:02:39.115 T:2143    ERROR <general>: NFS: Failed to mount nfs share: /mnt/nas/transmission (mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13))
2022-06-12 20:02:39.115 T:2143    ERROR <general>: GetDirectory - Error getting nfs://hostserv.serv/mnt/nas/transmission/
2022-06-12 20:02:39.115 T:2143    ERROR <general>: CGUIDialogFileBrowser::GetDirectory(nfs://hostserv.serv/mnt/nas/transmission/) failed

ARM Support?

The readme states

Users of ARM distros such as Arch ARM, Raspbian, etc. should NOT use these files.

I tried running this in a olinuxino A20 and it seems to work. Why doe you say not to use these files?

Alias=display-manager.service supersedes WantedBy=graphical.target

If you have a look at the latest service files for, for example, GDM, you'll see that "WantedBy=graphical.target" seems to be obsolete and replaced by "Alias=display-manager.service".

Maybe you can have a look at this and possible replace the old line with the new one.

kodi-wayland fails to start

I started getting this error this week when starting kodi-wayland:

Dec 16 16:53:22 redacted systemd[1]: Started Kodi standalone (Wayland).
Dec 16 16:53:23 redacted cage[513]: 00:00:00.000 [ERROR] [../cage.c:293] XDG_RUNTIME_DIR is not set in the environment
Dec 16 16:53:23 redacted systemd[1]: kodi-wayland.service: Main process exited, code=exited, status=1/FAILURE
Dec 16 16:53:23 redacted systemd[1]: kodi-wayland.service: Failed with result 'exit-code'.

kodi user needs to be in sudo group on Raspbian

To be able to install the Widevine CDM on Raspbian (arm), the kodi user needs to be able to execute some commands as root, and therefor needs to be a member of the sudo group (or have a special sudoers file).

running this on RaspiOS is easier than README suggests

I think the notes for RaspiOS users are outdated. To get Kodi running on the latest RaspberryPI OS Lite Images all there is to do is to run these commands as root:

apt install kodi libgl1-mesa-dri git
git clone --depth 1 https://github.com/graysky2/kodi-standalone-service
cd kodi-standalone-service
make install
systemd-sysusers
systemd-tmpfiles --create
systemctl enable kodi.service
systemctl set-default graphical.target
reboot

I have tested this using a CM4 with both 32bit and 64bit images.

kodi-wayland encrypted h.264 video streams show as flickering screens dominated by a primary color.

I really don't know what project this issue should be filed against, but if I want to use Netflix or Amazon VOD, I need to use the X11 service rather than Wayland.

The videos I noticed this with were Netfix videos, which showed as green screens with moving static that flashed cyan, and Amazon VOD videos, which showed as magenta screens with moving static. German television is geoblocked instead of encrypted, and that played fine with an H.264 stream.

The audio was fine. The X11 standalone Kodi plays the Netflix and Amazon VOD videos fine, so that's an acceptable workaround I'll be using for the foreseeable future.

kodi.log with debug logging enabled only reported the stream buffering events, it didn't complain about the video stream.

Let me know if there's something I can do to get this issue to the right project.

Server is already active for display 0 when staring kodi-x11

Trying to get this working on Ubuntu, so that I can run Kodi as a headless server on the desktop and use a Chromebook to watch stuff from it, using the web interface. This works if I manually start Kodi on the desktop and put the window out of the way somewhere, but I'd rather it was running as a service.

This is what I'm running on the desktop:

$ neofetch --backend off
--------------------- 
OS: Ubuntu 20.04.1 LTS x86_64 
Kernel: 5.4.0-52-generic 
Shell: bash 5.0.17 
Resolution: 1920x1080, 1920x1080, 1920x1080 
DE: Xfce 
WM: Xfwm4 
WM Theme: Arc-Dark 
Theme: Arc-Dark [GTK2/3] 
Icons: Papirus-Dark [GTK2/3] 
Terminal: kitty 
CPU: Intel i7-6700K (8) @ 4.200GHz 
GPU: Intel HD Graphics 530 
Memory: 21669MiB / 64206MiB 

To install kodi-standalone, I did this:

$ sudo mkdir /usr/lib/systemd/system
$ sudo cp init/*.service /usr/lib/systemd/system/
$ sudo cp init/sysusers.conf /usr/lib/sysusers.d/
$ sudo nano /usr/lib/sysusers.d/sysusers.conf

$ sudo systemd-sysusers
Creating group kodi with gid 996.
Creating group optical with gid 995.
Creating user kodi (Kodi User) with uid 996 and gid 996.

$ sudo cp init/tmpfiles.conf /usr/lib/tmpfiles.d/
$ sudo systemd-tmpfiles --create

$ sudo cp polkit/10-kodi.rules /usr/share/polkit-1/rules.d/
$ sudo udevadm control --reload-rules && sudo udevadm trigger

Then I tried to start it:

$ sudo systemctl start kodi-x11.service 
$ systemctl status kodi-x11.service 

● kodi-x11.service - Kodi standalone (X11)
     Loaded: loaded (/usr/lib/systemd/system/kodi-x11.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-12-18 15:28:44 PST; 8s ago
    Process: 577130 ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1 (code=killed, sig>
    Process: 577136 ExecStop=/usr/bin/killall --user kodi --exact --wait kodi-x11 (code=exited, status=1/FAILURE)
   Main PID: 577130 (code=killed, signal=HUP)

Dec 18 15:28:44 duncan-desktop systemd[1]: Started Kodi standalone (X11).
Dec 18 15:28:44 duncan-desktop killall[577136]: kodi-x11: no process found
Dec 18 15:28:44 duncan-desktop systemd[1]: kodi-x11.service: Control process exited, code=exited, status=1/FAILURE
Dec 18 15:28:44 duncan-desktop systemd[1]: kodi-x11.service: Failed with result 'exit-code'.

So, then... I tried it again...

$ sudo systemctl start kodi-x11.service
$ systemctl status kodi-x11.service 

● kodi-x11.service - Kodi standalone (X11)
     Loaded: loaded (/usr/lib/systemd/system/kodi-x11.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2020-12-18 15:29:14 PST; 4s ago
   Main PID: 577220 (xinit)
      Tasks: 2 (limit: 76980)
     Memory: 1.9M
     CGroup: /system.slice/kodi-x11.service
             └─577220 /usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1

Dec 18 15:29:14 duncan-desktop xinit[577248]: Fatal server error:
Dec 18 15:29:14 duncan-desktop xinit[577248]: (EE) Server is already active for display 0
Dec 18 15:29:14 duncan-desktop xinit[577248]:         If this server is no longer running, remove /tmp/.X0-lock
Dec 18 15:29:14 duncan-desktop xinit[577248]:         and start again.
Dec 18 15:29:14 duncan-desktop xinit[577248]: (EE)
Dec 18 15:29:14 duncan-desktop xinit[577248]: (EE)
Dec 18 15:29:14 duncan-desktop xinit[577248]: Please consult the The X.Org Foundation support
Dec 18 15:29:14 duncan-desktop xinit[577248]:          at http://wiki.x.org
Dec 18 15:29:14 duncan-desktop xinit[577248]:  for help.
Dec 18 15:29:14 duncan-desktop xinit[577248]: (EE)

$ systemctl status kodi-x11.service 

● kodi-x11.service - Kodi standalone (X11)
     Loaded: loaded (/usr/lib/systemd/system/kodi-x11.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2020-12-18 15:33:42 PST; 6min ago
    Process: 577817 ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1 (code=exited, status=1/FAILURE)
   Main PID: 577817 (code=exited, status=1/FAILURE)

Dec 18 15:33:27 duncan-desktop xinit[577827]: Please consult the The X.Org Foundation support
Dec 18 15:33:27 duncan-desktop xinit[577827]:          at http://wiki.x.org
Dec 18 15:33:27 duncan-desktop xinit[577827]:  for help.
Dec 18 15:33:27 duncan-desktop xinit[577827]: (EE)
Dec 18 15:33:42 duncan-desktop xinit[577817]: No protocol specified
Dec 18 15:33:42 duncan-desktop xinit[577817]: /usr/bin/xinit: giving up
Dec 18 15:33:42 duncan-desktop xinit[577817]: /usr/bin/xinit: unable to connect to X server: Resource temporarily unavailable
Dec 18 15:33:42 duncan-desktop xinit[577817]: /usr/bin/xinit: server error
Dec 18 15:33:42 duncan-desktop systemd[1]: kodi-x11.service: Main process exited, code=exited, status=1/FAILURE
Dec 18 15:33:42 duncan-desktop systemd[1]: kodi-x11.service: Failed with result 'exit-code'.

Not sure if relevant, but I only have one xorg process running:

$ pgrep -af xorg
1543 /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

Not sure where to go from here?

breaks under systemd_homed

attempted to use this on a new install of Arch today.
fot the error: pam_systemd_home(login:account): Not a user managed by systemd-homed: No home for user kodi I attempted to set up kodi as a systemd_homed user to no avail, when i did that it wanted to prompt for authentication
pam_systemd_home(login:account): conversation failed
pam_systemd_home(login:account): Failed to prompt for password/prompt.

README for other distros is misleading

Thanks for the great systemd script and the README. There is only few information about that really elegant way to use kodi without a fiddling with sessions and graphical login managers.

But the following commands use a misleading path. The kodi user needs write access to it's home directory and not only to the .kodi folder. The .kodi folder will be automatically generated by the kodi executable, when it does not already exist.

Misleading:

mkdir /var/lib/kodi/**.kodi**
chown -R kodi:kodi /var/lib/kodi/**.kodi**

Better could be:

mkdir /var/lib/kodi
chown -R kodi:kodi /var/lib/kodi

When adding the user it is assigned to group kodi, but the group was not added. There are some groups that are not available on every distro. I would recommend to add the important ones. The comment 'kodi user' is not that useful, because the username speaks for itself. ;-)

Misleading:

useradd -c 'kodi user' -u 420 -g kodi -G audio,video,network,optical \
-d /var/lib/kodi -s /usr/bin/nologin kodi

Better could be:

groupadd kodi
useradd -u 420 -g kodi -G audio,video -d /var/lib/kodi -s /usr/bin/nologin kodi

I hope I could help in some way by sharing my experiences with your guide.
Have fun
Best regards

kodi-gdm udev permission problems

CUDMABufferObject::Register - unable to open /dev/udmabuf: Permission denied
CDMAHeapBufferObject::Register unable to open /dev/dma_heap/system: Permission denied

To fix udambuf need to add kodi to kvm group

To fix dma_heap it needs udev rules
SUBSYSTEM=="dma_heap", KERNEL=="linux*", GROUP="kvm", MODE="0660"
SUBSYSTEM=="dma_heap", KERNEL=="system", GROUP="kvm", MODE="0660"

Does not work on raspi os

I am trying to make it work on an install of raspi OS lite.

But the service is not run at start. It is enabled but the log seems to imply it is not even started. May be a condition is not met ?

More oever, when I start to run it manually (from ssh) with systemctl start kodi-gbm, I got a prompt on tty1 from sudo like [sudo] password for kodi.
I am confused as to why a password is needed and sudo at all ? especially that kodi user has no password.

I am new to raspi OS. It was just working fine on archlinux ARM. :-(

kodi user does not have correct group memberships for latest libCEC

hi! I'm using the kodi-standalone-service package from the Arch AUR. I upgraded everything a little while ago and found the system could no longer connect to my Pulse-Eight CEC remote control adapter. This turns out to be a permissions issue: /dev/ttyACM0 is (now) owned by the uucp group, of which kodi is not a member. Adding the group membership manually fixed it for me.

/etc/conf.d/kodi-standalone overwrites existing config

I just found out that since commit 546b686, the installed example config file overwrites any existing config file. :-( It is not properly registered as a backup configfile in pacman (which would create a .pacnew version instead).

Please add backup=('etc/conf.d/kodi-standalone') to the PKGBUILD.

Why there is mysqld.service in the After option?

I don't share the library of my kodi installation, but I happen to have mariadb installed (for zoneminder), having 'mysqld.service' in the 'After' option of the kodi unit file makes the initialization of kodi be delayed until mariadb finish loading, which is completely unnecessary in my case, but may be required if the library sharing feature of kodi is being used.
How can we satisfy both use cases?
1 - not delaying the start of kodi if the library sharing feature is not being used, or the mysql that has the library is not on this machine, but mysql happens to be installed;
2 - start kodi after mysql, if the library sharing feature is being used AND the library is in a database in the same machine as kodi.

kodi-wayland.service does not exit cleanly when stopped

# stop kodi-wayland
# status kodi-wayland
● kodi-wayland.service - Kodi standalone (Wayland)
     Loaded: loaded (/usr/lib/systemd/system/kodi-wayland.service; disabled; vendor preset: disabled)
     Active: failed (Result: core-dump) since Thu 2020-10-15 08:43:00 EDT; 3s ago
    Process: 1488 ExecStart=/usr/bin/cage -- /usr/bin/kodi-standalone (code=dumped, signal=SEGV)
   Main PID: 1488 (code=dumped, signal=SEGV)

Oct 15 08:42:10 boxcar systemd[1]: Started Kodi standalone (Wayland).
Oct 15 08:42:10 boxcar systemd[1488]: pam_systemd_home(login:account): systemd-homed is not available: Unit dbus-org.freedesktop>
Oct 15 08:42:10 boxcar systemd[1488]: pam_unix(login:session): session opened for user kodi(uid=989) by (uid=0)
Oct 15 08:42:41 boxcar systemd[1]: Stopping Kodi standalone (Wayland)...
Oct 15 08:43:00 boxcar systemd[1]: kodi-wayland.service: Main process exited, code=dumped, status=11/SEGV
Oct 15 08:43:00 boxcar systemd[1]: kodi-wayland.service: Failed with result 'core-dump'.
Oct 15 08:43:00 boxcar systemd[1]: Stopped Kodi standalone (Wayland).

Conflict when using `/dev/tty` in Proxmox LXC

Hello,

I use a strange setup, where I use kodi-standalone in a Linux container (LXC) on a Proxmox virtual environment (PVE).
My container runs Ubuntu 22.04 without a desktop environment, and I chose the GBM service.

When using the default TTYPath=/dev/tty1 in kodi-gbm.service, there seem to be conflicts with the Proxmox terminal, which apparently also uses tty1.

To be precise, I get notified by bash when launching the terminal:

Last login: Sat Dec 30 22:04:28 UTC 2023 on tty1
-bash: cannot set terminal process group (119): Inappropriate ioctl for device
-bash: no job control in this shell

When I change that offending line in kodi-gbm.service to TTYPath=/dev/tty2, that goes away.
I wonder if that is a good way of solving it, as I don't really understand what kodi uses /dev/ttyX for.

Probably unrelated, but I see this in the status output of the service:

# service kodi-gbm status
* kodi-gbm.service - Kodi standalone (GBM)
     Loaded: loaded (/lib/systemd/system/kodi-gbm.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-12-30 22:09:10 UTC; 3min 42s ago
   Main PID: 137 (kodi-standalone)
      Tasks: 32 (limit: 38159)
     Memory: 277.8M
        CPU: 11.837s
     CGroup: /system.slice/kodi-gbm.service
             |-137 /bin/sh /usr/bin/kodi-standalone
             |-155 "(sd-pam)" "" ""
             |-165 /bin/sh /usr/bin/kodi --standalone
             `-172 /usr/lib/x86_64-linux-gnu/kodi/kodi.bin --standalone

Dec 30 22:09:10 media-player systemd[1]: Started Kodi standalone (GBM).
Dec 30 22:09:10 media-player systemd[137]: pam_unix(login:session): session opened for user kodi(uid=999) by (uid=0)
Dec 30 22:09:10 media-player systemd[137]: pam_systemd(login:session): Failed to create session: Seat has no VTs but VT number not 0

Note that error for creating a session - I don't know what that means. Do you have an idea?

Thanks in advance!

Kodi won't exit when running kodi.service

As per my post on the AUR page, Kodi hangs when I try to exit the program when it is launched via the kodi.service on boot.

The same issue does not arise when running Kodi as my normal user from within a desktop session (tried on i3).

I've tried a few things (disabling Restart= in unit file, commenting out crash handler in kodi-standalone script, polkit rule for kodi user) with no joy.

I then found this post on the Kodi forum. I amended the ExecStart line in the unit file to include the dbus-launch command and I can now shut down and reboot successfully.

The only weird bit I'm now seeing is that the terminal is sometimes receiving messages that you'd typically see in dmesg (apologies, I don't know what they're called!).

I don't know if this causes any other issues or not as I'm no a linux expert.

Very happy to test other things if you have any other ideas.

Where should I put screen blanking preventing code?

This is not really an issue, just need some insight to where should I put line like:

xset s off -dpms

I usually can put this line on my ~/.xinitrc, can I put this on /var/lib/kodi/.xinitrc and make sure it run?

keyboard does not work after switching between virtual terminals

When switching to vt2 (tty2) by strg+alt+f2 and after returning to vt1 (tty1) the keyboard is not recognised any more. The only thing the keyboard does is to switch by strg+alt+f1 to +f6. Do I have to change something in the configuration of the virtual terminals or the kodi standalone service?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.