Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
Linux HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation
#1
Update: New guide

I have written a new guide which uses Lutris for game managment. This setup gives a more seamless experience launching games from Kodi. It supports Steam, GOG, Itch.io, emulators and several more game sources.

You can find the new guide on GitHub.

-----

Introduction

This HOW TO will explain how I set up my HTPC running Kodi, Steam and EmulationStation on a minimal Ubuntu 16.04 install. The HOW TO will cover the specific topics of gluing Kodi, Steam and EmulationStation into a coherent media center solution. Therefore, this HOW TO will not cover configuration of Kodi, Steam nor EmulationStation. However, I will link to other guides that cover these topics where they are relevant.

The HOW TO assumes that you have a basic understanding of terminal commands and SSH. If these two words do not carry any meaning to you, read these two articles: Connecting via SSH to your server and Common SSH commands.

If anything seems unclear in this guide, if any commands are wrong, or if you have any advice on how any of the steps can be done better, please don’t hesitate to make a reply.


Updates

30.11.2016 – Fixed typoes. Thanks Rokys.
29.08.2016 – Removed adding USER to the ‘audio’ group in 3.1. See this post for more info.
18.08.2016 – Added sed command to to 7.5.
03.08.2016 – Added to 8.2 how to change splash screen.


1. MinimalCD install of Ubuntu 16.04

1.1 Create a bootable USB drive

Download the Ubuntu 16.04 MinimalCD ISO image for your architecture (most likely 64-bit). Create a bootable USB drive with the image. There are many programs available which could be used to create a bootable USB drive, but one that is cross-platform is UNetBootIn, you can also have a look at the Ubuntu documentation if you are unsure how to do it.

Boot your HTPC from the USB drive. Make sure that it is connected to the Internet with a cable, as the MinimalCD image downloads all its packages during installation.


1.2 Installation
Installation is straight forward, but it looks intimidating since it is not in a fancy GUI. However, if you are unsure consult this guide or follow Step 1.3 from this thread.

IMPORTANT: There are a few options, explained underneath, that are specific to this installation.
  • Make a note of the hostname you give your HTPC. Also make sure that there is no other computer on you LAN with this hostname.
  • Choose a decent password for your user. The user you create during the installation will be the administrator user for this installation. This user will hereafter be referred to as ADMIN. However, Kodi and all programs associated with it will be run by a user with limited privileges.
  • When creating the user, make sure you do not encrypt the user’s Home directory.
  • Allow the system to install security updates automatically. This is not strictly necessary, but it improves security.
  • When prompted to install software select the following: Minimal Xubuntu desktop, SSH server. Select software with SPACE, confirm with ENTER.

Finish the installation, remove the USB drive and reboot. You should be greeted by the login screen for your ADMIN user.


2. SSH

2.1. Connect to the HTPC using SSH

For Linux and OSX, connect to your HTPC using SSH from a terminal instance. Replace [ADMIN] with the username for ADMIN and [HOSTNAME] is the HTPC’s hostname selected during install.
Code:
ssh [ADMIN]@[HOSTNAME]

If you are connecting through a computer running Windows, download PuTTY and follow this guide.

You should be prompted to trust the connection, then enter your ADMIN password when prompted.


3. Creating a user with limited priviledges

3.1. Creating a user

Kodi and its associated programs will be run by a user with limited privileges. The reason is security. The user which will be running programs will have no password and will login automatically. Therefore the user should be as restricted as possible. You can assign this user any username you like, but make a note of it. The user created in the following steps will be referred to as USER.

Create a user with password disabled. Replace [USER] with you preferred username.
Code:
sudo adduser --disabled-password --gecos "" [USER]

Assign the necessary privileges to the user.
Code:
sudo usermod -a -G cdrom,video,plugdev,users,dialout,dip,input,netdev [USER]


4. Installing programs

4.1. Adding program PPAs

Ubuntu 16.04 ships with Kodi, Steam, RetroArch and Dolphin available in its repositories. However, by adding third party PPAs, it is possible to get the latest stable version of the programs. All of the following commands are issued through SSH as the ADMIN user.

First, add the Kodi Stable PPA.
Code:
sudo apt-add-repository ppa:team-xbmc/ppa

Then, add the RetroArch PPA.
Code:
sudo apt-add-repository ppa:libretro/stable

Add the EmulationStation PPA.
Code:
sudo apt-add-repository ppa:emulationstation/ppa

And finally, the Dolphin PPA.
Code:
sudo apt-add-repository ppa:dolphin-emu/ppa

Now, get the latest package lists and install the programs.
Code:
sudo apt-get update
sudo apt-get install kodi retroarch libretro-* emulationstation* dolphin-emu steam

Also, at this point, it is a good idea to check for any general updates to Ubuntu 16.04.
Code:
sudo apt-get upgrade && sudo apt-get dist-upgrade


5. Install Openbox and a kodi-openbox Xsession

5.1. Install Openbox
To be able to run external programs (such as Steam), you need to run Kodi on top of a window manager in a Xsession.

Fist you need to install Openbox.
Code:
sudo apt-get install openbox


5.2. Install Kodi-Openbox Xsession

There are several guides on this forum and the web in general that explains how to set up an Xsession for Kodi to run in. These solutions usually involves a lot of scripting. The easiest solution I have found is to download kodi-openbox created by the GitHub user lufinkey. This is a collection of scripts that includes an Openbox Xsession that runs Kodi and a script that will launch external programs and manage their windows.

To install kodi-openbox Xsession, download the latest .zip file from the GitHub master branch. The file is named “openbox-kodi-master.zip” by the below code.
Code:
wget -O openbox-kodi-master.zip https://github.com/lufinkey/kodi-openbox/archive/master.zip

Extract the .zip file.
Code:
unzip openbox-master.zip

If you get a prompt telling you are missing the package unzip, install it.
Code:
sudo apt-get install unzip

Move into the extracted directory, create a .deb package from the extracted content and install the .deb.
Code:
cd kodi-openbox-master
bash ./build.sh
sudo dpkg -i kodi-openbox.deb


6. Auto login and Xsession

6.1. Enable auto login in LightDM

When the HTPC is powered on it should automatically log in USER into the kodi-openbox Xsession. To accomplish this you need to configure LightDM, Xubuntu’s login manager.

Open up the LightDM configuration file. The file will be created automatically if it doesn’t exist.
Code:
sudo nano /etc/lightdm/lightdm.conf

Paste in the following configuration. Make sure that you replace [USER] with your USER’s username. Remember that you need to use CTRL+SHIFT+V to paste in a terminal instance.
Code:
[Seat:*]
autologin-user=[USER]
autologin-session=kodi-openbox

Save the file by pressing CTRL+X and then press ENTER.


6.2 Log into the kodi-openbox Xsession

First, you need to reboot the HTPC to make all the changes you have made has an effect.
Code:
sudo reboot

Congratulations, if everything went well, you should now have launched Kodi in the Openbox Xsession.


7. Add menu items for Steam and EmulationStation to Aeon Nox

7.1. Using SSH as USER
Connect to your HTPC again through SSH. You should be logged in as ADMIN, but for the next steps you need to change to USER. You need to change users since the files downloaded and configured by ADMIN are not accessible to USER, and because you will place and configure files in USER’s Home directory which is not accessible to ADMIN.

Change user in SSH. Replace [USER] with USER’s username.
Code:
sudo su - [USER]


7.2. Install the Aeon Nox skin

I am using the Aeon Nox skin in this HOW TO. The home menu of this skin is easy to customize, which is needed to add menu items for Steam and EmulationStation. How to install this skin is explained well on the Kodi Wiki.


7.3. Download and install Advanced Launcher

Download Advanced Launcher from Angelscry’s GitHub repo. To do so, issue the following command through SSH:
Code:
wget -O advanced-launcher-master.zip https://github.com/angelscry/plugin.program.advanced.launcher/archive/master.zip

Angelscry has discontinued the add-on, but it is the best way I have found on launching external applications in Kodi. If you know of a different add-on or solution that acomplishes this task in a more graceful way, please let me know.

In Kodi, add the Advanced Launcher add-on. How to install an add-on from a .zip is explained on the Kodi Wiki. The .zip is located in the Home folder and is named advanced-launcher-master.zip.


7.4. Configure Advanced Launcher

Navigate to your program add-ons in the Aeon Nox skin. It is located on the Home Screen under the title Apps.

To add a launcher for Steam do the following:
  • Open the add-on
  • Open the Default folder
  • Bring up the Context Menu and select Standalone Launcher
  • In the Path dialogue that appers select Root and navigate to: /usr/bin/kodi-openbox-runprogram. Press Done.
  • In the Arguments dialogue enter the argument: steam -bigpicture
  • In the Title dialogue enter the name Steam
  • In the Platform dialogue select Linux
  • Leave the next two dialogues blank.
Mark the Steam launcher and bring up the Context Menu and add it to Favorites.

Create a launcher for EmulationStation:
  • Open the add-on
  • Open the Default folder
  • Bring up the Context Menu and select Standalone Launcher
  • In the Path dialogue that appers select Root and navigate to: /usr/bin/kodi-openbox-runprogram. Press Done.
  • In the Arguments dialogue enter the argument: emulationstation
  • In the Title dialogue enter the name Emulation
  • In the Platform dialogue select Linux
  • Leave the next two dialogues blank.
Mark the Emulation launcher and bring up the Context Menu and add it to Favorites.


7.5. Edit favorites.xml

There is a bug in Advanced Launcher/Kodi that launches a favorite with Kodi’s PlayMedia function instead of the RunPlugin function. To fix this you need to edit the favourites.xml manually.

Open the favourites.xml (make sure you are USER):
Code:
nano ~/.kodi/userdata/favorites.xml

Replace PlayMedia with RunPlugin for the favorites Steam and Emulation.

If your favourites.xml doesn’t contain any other favorites, it is possible to replace PlayMedia with RunPplugin automatically with the sed command.
Code:
sed -i -e 's/PlayMedia/RunPlugin/g' ~/.kodi/userdata/favorites.xml


7.6. Add Home Menu items to Aeon Nox

To add Steam to the Home screen items to Aeon Nox, follow these steps:
  • Mark the System Home menu item. In the sub-menu that appears select Skin Settings
  • In the dialogue that appears, select Setup the Aeon Nox main menu
  • In the left hand list, scroll down to Custom 1
  • Toggle the button next to enabled
  • Edit the Label to STEAM
  • Select Default Select Action, scroll down to Favorites, select it and select the Steam favorite
To add Emulation Station to the Home screen items to Aeon Nox, follow these steps:
  • In the left hand list, scroll down to Custom 2
  • Toggle the button next to enabled
  • Edit the Label to EMULATION
  • Select Default Select Action, scroll down to Favorites, select it and select the Emulation favorite
That’s it! When you select the Home menu item from Aeon Nox, it should launch the application. Steam does not need any special configuration. EmulationStation, on the other hand, is a beast. EmulationStation’s documentation and this guide gives a nice and simple introduction to configuring it.


8. Miscellaneous

8.1 Remove grey Openbox background

To remove the default, grey Openbox background that appears when you launch external applications and replace it with a nice black one, do the following:

Install hsetroot (remember to be logged in as ADMIN)
Code:
sudo apt-get install hsetroot

Switch to USER
Code:
sudo su - [USER]

Copy the default Openbox configuration files to USER’s Home directory
Code:
cp -R /etc/xdg/openbox ~/.config/

Open autostart with nano
Code:
nano ~/.config/openbox/autostart

Paste in the following at the end of the file:
Code:
# Set a background color
hsetroot -solid black

Restart and you are done.


8.2 Add Kodi splash screen

If you want to get rid of the Xubuntu splash screen, it is possible to change it to a Kodi one. teeedubb on this forum has made/adapted a Kodi splash screen for Ubuntu 16.04.

Download the .deb as ADMIN
Code:
wget https://dl.dropboxusercontent.com/u/22410524/xbmc/plymouth-theme/plymouth-theme-kodi-logo.deb

Install the .deb
Code:
sudo dpkg -i plymouth-theme-kodi-logo.deb
Reply
#2
Thanks for this. I am in the middle of trying to set something up.
However, what I am trying to do is a bit different.

I have two SSDs. One for Windows 7 and the second SSD for Kodi running under Ubuntu.

I have a third 1 TB HD for data including media which is formatted in NTFS.
Ubuntu recognized the data drive.

However, I don't know how to get Kodi to communicate with it...that is I am not using a networked server....I want to connect to a drive in the same PC.

If you know how to do that it would be very helpful.

Thanks
Reply
#3
log in at Ubuntu (I guess it's a complete dual boot system) and show us the output of

Code:
mount

and

Code:
cat /etc/fstab

If the drive is correctly mounted it's easy to access it via its mountpoint, which will be shown either in the fstab or from the "mount" command.

By adding the source, you will need to specify a path to its mountpoint. If a HDD is mounted it's not shown as a "drive" like you know it from windows. Under Linux everything is a "file" and drives are mounted to folders. Mostly under /media/.... but let's see what those commands say.
Reply
#4
I have the screen shots of the above two commands. However, I suspect the drive is mounted because as you can see from the third screen shot, the icon of the e: (data) drive, can be seen on the left hand panel. I opened it up and it is the data drive.

The problem is being able to access the drive in Kodi. I do not see it there. I created the kodi Upload folder for movies etc. that I get from using kodi.

Please forgive me...I really know very little about Ubuntu...have never used it...just using it to create duel boot system to separate kodi from windows.

I do not know how to insert images...here are links though to the images:

http://imageshack.com/a/img924/8053/h0P6Gc.png
http://imageshack.com/a/img923/6960/LBrxiN.png
http://imageshack.com/a/img923/107/WWQghP.png
Reply
#5
I ran into some issues starting steam...received the below error:

Code:
X Error of failed request:  BadValue (integer parameter out of range for operation)

I found instructions from this site which indicates to do the below:

Code:
sudo su - [USER]

Code:
cd $HOME/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu
mv libstdc++.so.6 libstdc++.so.6.bak
cd $HOME/.steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu
mv libstdc++.so.6 libstdc++.so.6.bak

after i received the above I ran:

Code:
DISPLAY=:0 steam

and all seems to be fine...

nice guide..thanks!
Reply
#6
188pilas, are you using a Nvidia graphics card? I have not experienced a similar issue, but I think the reason is that I‘m using Intel‘s Integrated Graphics.

I glanced over the link to AskUbuntu you posted, and your error seems to be caused by the graphics driver. Could you see if following this answer solves the issue. Removing Steam‘s bounded libraries as you have done is a hackish workaround, and it could limit performance.

You can do so by quitting Kodi, which should take you to LightDM. Log in as ADMIN, and then follow the steps in the linked post.
Reply
#7
(2016-08-04, 00:17)solbero Wrote: 188pilas, are you using a Nvidia graphics card? I have not experienced a similar issue, but I think the reason is that I‘m using Intel‘s Integrated Graphics.

I glanced over the link to AskUbuntu you posted, and your error seems to be caused by the graphics driver. Could you see if following this answer solves the issue. Removing Steam‘s bounded libraries as you have done is a hackish workaround, and it could limit performance.

You can do so by quitting Kodi, which should take you to LightDM. Log in as ADMIN, and then follow the steps in the linked post.


I am running an nVidia graphics card on host PC and on client PC I am using an Intel nuc D34010WYK.


Sent from my iPhone
Reply
#8
(2016-08-04, 00:54)188pilas Wrote: I am running an nVidia graphics card on host PC and on client PC I am using an Intel nuc D34010WYK.

I see, so you are streaming to your HTPC from another machine. I don‘t have any experience with Steam streaming, but as long as the fix you supplied works for you, great!
Reply
#9
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 !
Reply
#10
thanks for the great tutorial Smile
Reply
#11
it happens on my machine that the system is already running before the network is brought up completly and so PleXMBC cannot connect. How can I change it so that the network is brought up first and then Kodi is started ?
Reply
#12
Use the forum search: lightdm wait for network
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#13
(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.
Reply
#14
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.
Reply
#15
Thanks for the guide, I've always used KodiBuntu before, but I like this better. Cool

Now I just need to figure out es_systems.cfg lol
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation4
This forum uses Lukasz Tkacz MyBB addons.