Linux How to run only Kodi without a desktop environment?
#1
I was quite fond of the Kodibuntu ISO, but needed ubuntu 14 so did it manually. Now I have a desktop environment and when Kodi hangs I have to reboot the whole system to get it back (or login via ssh, and use display export). How do I get it so there is no desktop behind Kodi, and that it autorestarts if the process is terminated?

Also, if there is a startup animated Kodi screen for ubuntu 14, could somebody please point me to it?
Reply
#2
Why the need for a 14.04 version? And if you only require Kodi, perhaps a minimal setup like LibreELEC is an option.
Reply
#3
I think it was a compiler, or one of the libraries needed that forced me over. This is my only linux box, so it does other things, just none of them are graphical.
Reply
#4
Take a look here, it might help

https://forum.kodi.tv/showthread.php?tid=231955
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#5
Here's my systemd unit. It supports ConsoleKit/PAM (for reboot/shutdown from within kodi) and should start a bit earlier than the one linked by @nickr 
Code:
[Unit]
Description = Kodi Media Center (X11-standaone)
After = network.target sound.target dbus.service polkit.service upower.service udisks.service
[email protected]

[Service]
User = kodi
Group = kodi
Type = simple
TTYPath=/dev/tty1
ExecStart = /usr/bin/xinit /usr/bin/ck-launch-session /usr/bin/dbus-launch --exit-with-session /usr/local/bin/kodi.sh -- :0 -nolisten tcp vt1
Restart = always
RestartSec = 5

[Install]
WantedBy = multi-user.target

Also /usr/local/bin/kodi.sh:
Code:
#!/bin/sh
#
# Script to start kodi based on /usr/bin/kodi but uses systemd for process hypervising
#

bin_name=kodi
SAVED_ARGS="--standalone"
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
LIBDIR="/usr/lib64"
CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME}
USERDATA_DIR="${HOME}/.${bin_name}"

# Fix wasting RAM due to fragmentation
export MALLOC_MMAP_THRESHOLD_=131072

"$LIBDIR/${bin_name}/${bin_name}.bin" $SAVED_ARGS
exit $?
Reply
#6
(2017-11-25, 21:02)wellspokenman Wrote: I was quite fond of the Kodibuntu ISO, but needed ubuntu 14 so did it manually. Now I have a desktop environment and when Kodi hangs I have to reboot the whole system to get it back (or login via ssh, and use display export). How do I get it so there is no desktop behind Kodi, and that it autorestarts if the process is terminated?

Also, if there is a startup animated Kodi screen for ubuntu 14, could somebody please point me to it?
 I can't help you but wanted you to know i'm in the exact same situation as you and have tried the link you've been sent about Intel VAAPI howto and followed it to the letter and yet still get the crashes and no-one seems to be able to help.  It's a shame they stopped Kodibuntu but they didn't have the resources to put into it.  I'm running a HP Microserver that was stable for years in the days of Kodi 12  but no more . I am sorry to say i'm looking at retiring it as a media centre (shame that will be) and buying a 4K capable dedicated media player Sad
Lounge rig: nVidia Shield - Official Kodi
Bedroom rig: Amazon Fire TV - Kodi 17.3
Backend: HP Microserver, Ubuntu, JBOD
Reply
#7
I don't have/use a Linux desktop environment here. The only thing you need is xserver. Kodi needs some way to output audio/video. In my case, I simply SSH into the keyboardless/mouseless box, open a fullscreen window with xinit, then start Kodi. A/V is sent to my surround receiver via Nvidia HDMI, and then on to my tv from there. I navigate Kodi using an IR remote w/LIRC. No desktop needed or wanted.
Reply
#8
Why not use LibreELEC?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
(2017-12-12, 17:25)teriyaki Wrote: The only thing you need is xserver. Kodi needs some way to output audio/video.
^- This. An alternative would be to use Wayland instead of X11 but that's not stable yet.
Quote:In my case, I simply SSH into the keyboardless/mouseless box, open a fullscreen window with xinit, then start Kodi.
The sytemd unit I posted above automates that process: It starts xinit, inside of it a ConsoleKit/PolKit session is started (so you're abe to shutdown/reboot the whole system from within Kodi by adding a simple PolKit rule, see https://wiki.gentoo.org/wiki/Kodi#Shutdown for more details) as well as a dbus session and finally Kodi:
Code:
ExecStart = /usr/bin/xinit /usr/bin/ck-launch-session /usr/bin/dbus-launch --exit-with-session /usr/local/bin/kodi.sh -- :0 -nolisten tcp vt1
Also systemd will restart the whole thing in case Kodi (or the Xserver) crashes, see:
Code:
Restart = always
RestartSec = 5
So no need for a keyboad or SSH no matter what.
 
(2017-12-13, 03:21)nickr Wrote: Why not use LibreELEC?
While LibreELEC is fine if you want to use Kodi only it's locked-down core OS isn't enough for power users. For example I tried to use a RaspberryPi 3 as a Kodi Box and a bluetooth audio sink at the same time. For that I needed to run PulseAudio but no matter what you try, you'll always get a one second audio delay on LibreELEC when using PulseAudio. On other distros it simply works.
Reply
#10
not sure of your experience with Ubuntu, couldn't you accomplish this by logging out of your desktop environment then choosing kodi instead of Ubuntu to login to.  you'd have to kill kodi-standalone from a virtual terminal
Reply
#11
New systemd unit for Kodi 18 with Wayland instead of X11:
Code:
[Unit]
Description = Kodi Media Center (Wayland)
After = network.target sound.target dbus.service polkit.service upower.service udisks.service
Conflicts = [email protected]

[Service]
User = kodi
Group = kodi
Type = simple
TTYPath=/dev/tty1
PAMName=login
UtmpIdentifier=tty1
UtmpMode=user
ExecStart = /usr/local/bin/kodi-wayland.sh
Restart = always
RestartSec = 2

[Install]
WantedBy = multi-user.target
And /usr/local/bin/kodi-wayland.sh :
Code:
#!/bin/sh

/usr/bin/weston --tty=1 &

# Wait for weston to startup
while [ ! -S "/run/user/${UID}/wayland-0" ]; do
        sleep 0.2;
done

bin_name=kodi-wayland
SAVED_ARGS="--standalone"
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
LIBDIR="/usr/lib64"
CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME}
USERDATA_DIR="${HOME}/.${bin_name}"

# Fix wasting RAM due to fragmentation
export MALLOC_MMAP_THRESHOLD_=131072

"${LIBDIR}/kodi/${bin_name}" $SAVED_ARGS
exit $?
In case you don't have any keyboard/mouse attached don't forget to add the following to ~kodi/.config/weston.ini :
Code:
[core]
idle-time=0
require-input=false
Reply
#12
I run mine on an Ubuntu server 16.04 base installation. Let's me us the box as a full home server as well as HTPC. Simple systemd service I found on the kodi wiki, although now it says it's not advised to use it. I don't know why. Works just fine for me and I don't plan on upgrading my HTPC / server till 20.04
Code:
jason@failbox:~$ cat /etc/systemd/system/kodi.service 
[Unit]
Description = Kodi Media Center

# if you don't need the MySQL DB backend, this should be sufficient
After = systemd-user-sessions.service network.target sound.target mysql.service
Wants = mysql.service

[Service]
User = kodimain
Group = kodimain
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-standalone -- :0 -nolisten tcp vt7
Restart = always
RestartSec = 5

[Install]
WantedBy = multi-user.target
Reply

Logout Mark Read Team Forum Stats Members Help
How to run only Kodi without a desktop environment?0