Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Cannot boot into kodi
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
gflohr
n00b
n00b


Joined: 18 Sep 2024
Posts: 3

PostPosted: Wed Sep 18, 2024 8:47 pm    Post subject: Cannot boot into kodi Reply with quote

In brief: Starting kodi as user kodi from the console without an X server works. But I cannot start it from lightdm as display manager.

In detail:

I have created a user kodi with these groups:

Code:
$ groups kodi
audio cdrom dialout video cdrw usb input users render kodi


I can start the binaries "kodi" and "kodi-standalone" without problems. Next, I tried to boot into kodi, following the instructions from https://wiki.gentoo.org/wiki/Kodi. In a nutshell, that means setting the display manager ito "lightdm", and starting the services "dbus" and "display-manager". The configuration "/etc/lightdm/lightdm.conf" looks like this:

Code:
[Seat:*]
autologin-user=kodi
user-session=kodi
autologin-user-timeout=0


The kodi session definition "/usr/share/xsessions/kodi.desktop":

Code:
[Desktop Entry]
Name=Kodi
Comment=This session will start Kodi media center
Exec=kodi-standalone --debug
TryExec=kodi-standalone --debug
Type=Application
Keywords=audio;video;media;center;tv;movies;series;songs;remote;
Icon=kodi


The "--debug" was added by me.

With this setup, kodi bails out with an error in "/home/kodi/.kodi/temp/kodi.log":

Code:
...
2024-09-18 23:20:27.760 T:2466    debug <general>: CWinSystemGbm::InitWindowSystem - not allowed to run GBM under a window manager
2024-09-18 23:20:27.760 T:2466    debug <general>: CApplication::CreateGUI - unable to init gbm windowing system
...


The kodi source code reveals that this error occurs, when either "DISPLAY" or "WAYLAND_DISPLAY" is set.

I therefore tried to unset the DISPLAY environment variable in "/etc/lightdm/Xsession" but now kodi fails to become the DRM master:

Code:
...
2024-09-18 23:33:01.285 T:2689    debug <general>: CDRMUtils::InitDrm - failed to set drm master, will try to authorize instead: Permission denied
2024-09-18 23:33:01.285 T:2689    error <general>: CDRMUtils::InitDrm - failed to authorize drm magic: Permission denied
...


With "fuser -a /dev/dri/*," I can see that "/bin/X" has the file "/dev/dri/card0" opened, and I assume that this causes the problem. This is actually clear because Kodi is not supposed to be run this way.

In case it matters, these are the use flags for kodi and lightdm:

Code:
$ emerge -vp kodi lightdm
...
[ebuild   R    ] x11-misc/lightdm-1.32.0-r2::gentoo  USE="elogind gnome gtk introspection -audit -non-root -qt5 -systemd -vala" 0 KiB
[ebuild   R   ~] media-tv/kodi-21.1::gentoo  USE="bluetooth cec css gbm optical system-ffmpeg udev webserver xslt -X -airplay -alsa -bluray -caps -dbus -doc -eventclients -gles -lcms -libusb -lirc -mariadb -mysql -nfs -pipewire -pulseaudio -samba -soc -test -udf -upnp -vaapi -vdpau -wayland -zeroconf" CPU_FLAGS_X86="sse sse2 sse3 sse4_1 sse4_2 -avx -avx2" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11" 0 KiB


I should mention that kodi-21.1 is marked unstable at the type of this writing but I think that this should not cause the issue. The check against the environment variables "DISPLAY" and "WAYLAND_DISPLAY" was added to kodi four years ago.

The system is not a desktop system and not meant to run any other GUI application. It is essentially used as a file server and for kodi.

So, what is the recommended approach to boot into kodi?
Back to top
View user's profile Send private message
gflohr
n00b
n00b


Joined: 18 Sep 2024
Posts: 3

PostPosted: Wed Sep 18, 2024 9:24 pm    Post subject: Reply with quote

One approach that works is to write a dedicated service instead of using a display manager.

/etc/init.d/kodi:

Code:
#! /sbin/openrc-run

name="kodi daemon"
supervisor=supervise-daemon
description="A software media player and entertainment hub for digital media"
command=/usr/bin/kodi
command_args="--standalone"
pidfile="/var/run/kodi.pid"
command_user="kodi:kodi"
command_background=true

depend() {
   use net
   after bootmisc consolefont modules netmount
}


Edit: add dependencies and supervisor.

That works but is there any disadvantage compared to the lightdm approach?


Last edited by gflohr on Thu Sep 19, 2024 7:22 am; edited 1 time in total
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 652

PostPosted: Thu Sep 19, 2024 1:39 am    Post subject: Re: Cannot boot into kodi Reply with quote

gflohr wrote:
That works but is there any disadvantage compared to the lightdm approach?

The only downside I can think of is that if Kodi crashes the whole graphical environment will be "torn down and rebuilt", but once you get into "autologin kiosk mode" it's pretty much "whatever works for you" territory.
Personally I've always done it with inittab entries
Code:
c8:45:respawn:/sbin/mingetty --autologin mythtv tty8
a careful ~/.bash_profile
Code:
case $(tty) in
        *tty8)
                startx
                exit
                ;;
esac
and ~/.xinitrc
Code:
/home/mythtv/bin/kodi-looper >/dev/null 2>&1 &
/usr/bin/dwm
~/bin/kodi-looper:
#!/bin/bash
until ps -eo command|grep -q "^/usr/bin/dwm";do sleep 0.25;done
while ps -eo command|grep -q "^/usr/bin/dwm";do
    /usr/bin/kodi
done

It's quite an old set-up, hence the user being "mythtv". I used to drop mythfrontend on top of twm, but dwm is better for plugging in a keyboard and running diagnostics*, kodi just inherited that environment.
A display manager "feels" like an unnecessary layer of complication compared to a line in inittab, but it's one of those things - whatever works best for you is the "right way" to do it.

*tape the important shortcut key combos to the bottom of the KB, if you forget them like I do between "breakages".
Back to top
View user's profile Send private message
gflohr
n00b
n00b


Joined: 18 Sep 2024
Posts: 3

PostPosted: Thu Sep 19, 2024 7:27 am    Post subject: Re: Cannot boot into kodi Reply with quote

[quote="Ralphred"]
gflohr wrote:
That works but is there any disadvantage compared to the lightdm approach?

The only downside I can think of is that if Kodi crashes the whole graphical environment will be "torn down and rebuilt", but once you get into "autologin kiosk mode" it's pretty much "whatever works for you" territory.

Fair point. I have added this line to my init script "/etc/init.d/kodi":

Code:
supervisor=supervise-daemon


I have also edited my previous post to include the line.

Kodi indeed crashes from time to time but with the supervisor line, it comes up again.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum