Linux HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation
#18
(2016-08-07, 23:09)solbero Wrote:
(2016-08-05, 19:17)geckow Wrote: Thank you very much for your tutorial, everything works well (just had some crashes with latest Kodi build) ! I am just wondering why do you use Minimal Xubuntu desktop, isn't Lubuntu minimal installation lighter ? (it also already includes openbox)

After some tests, it seems to work a bit better with Lubuntu (less ressources consumption), I'll report my experiences when I will have time !

I’m glad that you enjoyed the guide.

I considered using Lubuntu Minimal Desktop. However, my reasons for choosing Xubuntu Minimal Desktop are:
  • Xubuntu includes PulseAudio. Needed by quite a lot of Steam games. However some (such as Hyper Light Drifter) work with ALSA.
  • Xubuntu includes Bluez for Bluetooth. I need it to pair PS3 controllers.
  • Xubuntu includes NetworkManager. I use NetworkManager to manage my VPN.
Also, I’m more familiar configuring stuff in Xubuntu, and XFCE comes with some nice default apps. Even though this guide consists of terminal commands, I worked from the Xubuntu desktop a lot while figuring stuff out. So I wanted something I’m familiar with, and I do not have a lot of experience with LXDE.

For a setup like this, where you boot directly into Kodi, the desktop environment that is installed doesn’t really matter—you never boot in to it, you boot into Openbox instead. However, the other choices in the MinimalCD installation such as Unity or Gnome would bundle a bunch of processes that would begin at startup and slow everything down (notice that they do not have a minimal version). That‘s why you‘d want the minimal desktops. They are just the minimal needed.

As such, Lubuntu Minimal Desktop is as a good a choice as Xubuntu Minimal Desktop. In Lubuntu, you wouldn’t have to install Openbox as you point out, but you might have to install some other programs which are included in Xubuntu Minimal Desktop. Both work for this kind of setup, so choose the one you like. Big Grin

TL;DR: Both Xubuntu Minimal Desktop and Lubuntu Minimal Deskop work for this kind of setup.

You're right, I didn't know for PulseAudio !
On top of that, performances are quite similar, I installed both on virtual machines :

Xubuntu Minimal:
67 seconds boot
165MB-171MB RAM consumption
2705MB (Kodi displays 2,7G) disk space used
Kodi 16.1 Git:c327c53 Apr 25 2016

Lubuntu Minimal:
54 seconds boot
126MB-136MB RAM consumption
2563MB (Kodi displays 2,7G) disk space used
Kodi 16.1 Git:c327c53 Apr 25 2016

(2016-08-08, 17:13)DJBenson Wrote: Thanks for the guide, I've followed it and have everything working but on the occasions that Kodi crashes, how does one automatically restart Kodi?

From what I can gather, Kodi is running within LightDM/Openbox so the only way to get Kodi back up is to restart LightDM - but that's beyond the capabilities of my wife if I'm not at home.

When I used a systemd service for Kodi, it would automatically restart on crash, but now I've moved to the LightDM/Openbox method of launching Kodi, I have no idea how to automatically respawn Kodi (or relaunch LightDM) if/when Kodi crashes.

EDIT: I actually managed to work this out myself using a mixture of the kodi-openbox-session binary and the kodi.system systemd script.

If you want Kodi to automatically restart on crash, you will need to;

Code:
Remove (or comment out) the following from /etc/lightdm/lightdm.conf

[Seat:*]
autologin-user=[USER]
autologin-session=kodi-openbox

Disable the lightdm service
Code:
sudo systemctl disable lightdm

Create a new systemd file for kodi
Code:
sudo nano /etc/systemd/system/kodi.system

and enter the following code;
Code:
[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

# if you need the MySQL DB backend, use this block instead of the previous
After = systemd-user-sessions.service network.target sound.target mysql.service # Remove mysql.service if you are not using the mysql backend for kodi or kodi and mysql are installed on different machines
Wants = mysql.service # Remove this line if you are not using the mysql backend for kodi or kodi and mysql are installed on different machines

[Service]
User = kodi2 # Use your kodi user here
Group = kodi2 # Use your kodi user here
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-openbox-session -- :0 -nolisten tcp vt7
Restart = always # You may need to tweak this option, see https://www.freedesktop.org/software/systemd/man/systemd.service.html for the list of restart options. 'always' pretty much means you cannot exit kodi (gracefully or otherwise) without it restarting. This works for me but my kodi box is dedicated to kodi so I have no need to access X any other way.
RestartSec = 5

[Install]
WantedBy = multi-user.target

Be sure to check the inline comments in the service file above as some options are optional depending upon your setup (i.e. the mysql.service is only relevant IF you are using mysql for kodi AND both kodi and mysql are installed on the same physical machine)

Enable the new kodi service
Code:
sudo systemctl enable kodi.service

Reboot.

Now Kodi will launch (using openbox) via systemd and will relaunch if it crashes.

I have found a much simpler way to do that with a built-in kodi-openbox feature, just add the following at the end of ~/.kodi-openbox/onfinish and ~/.kodi-openbox/onkill
Code:
/usr/bin/kodi-openbox-session
Reply


Messages In This Thread
RE: HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation - by geckow - 2016-08-09, 01:03
Logout Mark Read Team Forum Stats Members Help
HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation4