How to install Kodi media player to Ubuntu 18.04 (Bionic Beaver) Desktop

Kodi Startup Logo

We recently wanted to install the Kodi media player software to a system running Ubuntu 18.04 desktop.  Here is the procedure we followed.  Not all of these steps are necessary, and we will tell you which ones are optional.

1. Optional – Install openssh-server and/or vino

If you install openssh-server you will be able to ssh into your system from another computer on your network (which gets you to a Linux command prompt, similar to running the Terminal program), and this will make things easier if you wish to do any of the installation steps from a different system. Similarly, vino allows you to use any VNC client to remotely access the desktop on your system. If you plan to do all the configuration directly on the Ubuntu desktop system then you do not need either of these. To install openssh-server do this:

sudo apt install openssh-server

If you want to install vino there is a two step process, and the second step must be done directly from the system running Ubuntu 18.04 desktop – you cannot do it through a ssh connection. The first step is probably only necessary if you did a minimal install of Ubuntu, but you can try it anyway just to make sure it’s installed:

sudo apt install vino

Then, to make it possible to connect from a remote client (particularly one running on a non-Linux system), open a Terminal window on the Ubuntu system and enter this:

gsettings set org.gnome.Vino require-encryption false

Note that “Vino” is capitalized in the above line – it won’t work if the V is lowercase. After doing this you should be able to set up Screen Sharing from the System Settings menu. If you aren’t familiar with that process, see this tutorial.

2. Optional – Set a static IP address

If this is going to be primarily a media center or home theater computer, you may want to be able to always find it at the same IP address on the network. If that is the case, consider giving it a static IP address. This is done by clicking on the Network icon in the upper right of the desktop and changing the settings associated with the correct network interface. If you are not familiar with this process, see this page but scroll down to the section headed “Ubuntu Desktop” – it’s where you will find the first screenshot on the page.

3. Optional – If you are using wired Ethernet, disable the Wi-Fi interface

While you are in the network settings, it’s a good idea to disable the Wi-Fi interface if you don’t plan on using it. If you try to connect to any type of streaming content, such as YouTube, you will generally have a far more reliable connection if only a wired connection is available.

4. Install Kodi

Now that we have the preliminaries out of the way, it is time to install Kodi. The process is quite simple and can be found at their page, HOW-TO:Install Kodi for Linux but it is so easy we can tell you how to do it here. Just open a terminal window or ssh session and enter the following. The first line is probably not needed, because the “software-properties-common” package appears to be already installed in Ubuntu, but just to be on the safe side you may want to run it anyway:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install kodi

5. Optional – If you run a backend system such as Tvheadend in order to use the Live TV and PVR features of Kodi, install the appropriate PVR client add-on. Instructions can be found on this page. If you don’t know what a backend system is, you can skip this step for now, but at some point you may want to read up on Tvheadend and how it is used with Kodi.

At this point you should find the icon for Kodi among your applications, and you should be able to launch it and control it with your keyboard. You will want to go through the settings and set it up the way you like. Also, if you installed a PVR add-on, you will need to configure and enable it. And, you may want to install some additional Kodi add-ons, which can be found on this page.

PLEASE NOTE: The add-ons at the above link are free and legal addons from the official Kodi site. We STRONGLY recommend that you DO NOT install add-ons from any other site. If an add-on has not been accepted into the official Kodi repository, there is a good chance it is illegal in many parts of the world, and that it could irreparably damage your Kodi installation or even your system. In the worst case, it may contain a virus or a “trojan horse” program designed to steal your personal information and passwords. There are a few benign Kodi add-ons from third-party sites, mostly ones still in the development stage where the author hopes to get them accepted into the official Kodi repository, but unless you are knowledgeable enough to figure out which add-ons can damage your system and which cannot, we’d recommending avoiding add-ons from third-party sites like the plague. If you have ever read any negative articles about “illegal Kodi boxes”, these are boxes that have been pre-loaded with illegal and often poor quality add-on software, that are usually sold at a highly inflated price and that contain apps that will stop working in a matter of days or weeks, at which point you find out the seller has left town never to be seen again. Kodi itself is a free and legal program, as are the add-ons that are found at the official Kodi site.

6. Optional – Make a Windows MCE compatible remote work correctly in Kodi

If you have a Windows Media Center Edition compatible remote attached to your system and you have its infrared receiver connected, you will probably find that some buttons (such as ENTER or OK) do not work in Kodi. In past versions of Ubuntu the simple solution was to install a program called LIRC, but the version of LIRC in the Ubuntu 18.04 repository is buggy and doesn’t work correctly. The fix for that is found in our previous article, Make LIRC work in Ubuntu 18.04, so that you can use your infrared remote in Kodi.

7. Optional, for users with Intel graphics only – Create a Xorg configuration for smoother video playback (this section added October 2, 2018):

We’ve been watching a thread on the Kodi forum called “v18 – Is there a guide to perfect playback in Ubuntu 18.04 Deskop using VAAPI graphics?” that you may want to read.  But the gist of it seems to be that starting in Ubuntu 18.04, by default the video driver used is not the best driver for use with Kodi.  As user “yasij” wrote:

…Xorg has been the default in every [Ubuntu] release except 17.10, which has Wayland.

In 16.10, Ubuntu switched to using the modesetting driver with glamor on Intel gen4 graphics and newer instead of xserver-xorg-video-intel.

But Kodi works best with the xserver-xorg-video-intel driver – Team-Kodi Developer “FernetMenta” wrote:

You really should create a xorg.conf that forces intel driver. Otherwise it would use modeset driver that causes stuttering on most hardware.

And in an earlier message he wrote:

Make sure you have TripleBuffer disabled in xorg.conf. This is enabled by default

If you don’t already have a Xorg configuration file, the easiest way to do this seems to be this:

sudo mkdir -p /etc/X11/xorg.conf.d
sudo cp /usr/share/doc/xserver-xorg-video-intel/xorg.conf /etc/X11/xorg.conf.d/10-intel.conf

(Note there are only two lines above; if the second one wraps on your screen it’s still all one line.)

Then edit the 10-intel.conf file – this shows using nano, but feel free to use another text editor if you prefer:

sudo nano /etc/X11/xorg.conf.d/10-intel.conf

Right after the existing line Driver "intel" add this new line:

Option "TripleBuffer" "false"

Check to make sure you have not made any mistakes. At this point it should look something like this (the commented out line may or may not be present):

Section "Device"
        Identifier "Intel"
        Driver "intel"
        Option "TripleBuffer" "false"
#       Option "AccelMethod" "uxa"
EndSection

Press Ctrl-X to exit, and save the file.

It might be a good idea at this point to make sure you can ssh into your system, just in case your hardware is different and this change prevents the desktop from starting up.

Reboot the system, and after it comes back up you should hopefully find that video playback in Kodi is steadier.  If for any reason this change has caused problems, simply remove the new file:

sudo rm /etc/X11/xorg.conf.d/10-intel.conf

And reboot. Note that if your desktop won’t start up, you’ll need to do this in a ssh session or from a command prompt. If the desktop won’t start, it may mean you have incompatible hardware (are you certain you have Intel graphics?).

Also, if you are an AMD user, you may have to perform some additional steps – see at least the second post in this thread. At the very minimum, it appears you may need to use Kodi version 18 (Leia) and do this (again, this is for AMD users only):

AMD users that want to use kodi v18 with vaapi (Take care: v17 won’t work), you need to install mesa 18.0.1 or later. You can do this via Paulo’s ppa:

sudo add-apt-repository ppa:paulo-miguel-dias/pkppa
sudo apt-get update
sudo apt-get dist-upgrade

We are not AMD users, so you are kind of on your own with the instructions in that thread – good luck!

8. Optional – Install Gnome Tweaks

One other thing you may wish to do is install Gnome Tweaks if you have not done so already. Just go to the Ubuntu Software Center and search for “Gnome Tweaks” and install it, and you will have more control over how your desktop looks and operates. For example, if you want to remove the trashcan icon from the desktop, see this article. But a better use might be to turn off animations, which could slow down an underpowered system and which some users find annoying. You can turn off animations in the Gnome Tweaks Appearance tab.

Make LIRC work in Ubuntu 18.04, so that you can use your infrared remote in Kodi

remote.png

If you are a Kodi user and have recently tried to upgrade your system to Ubuntu 18.04, and then tried to install and use LIRC to make your infrared remote control work the way it should, you may have discovered that it doesn’t work. For one thing, you don’t get the configuration menu during the install process, so you can’t select your make and model of remote. Even the old standby of using sudo dpkg-reconfigure lirc to bring up the configuration menu doesn’t work anymore.

Chances are you searched the web for an answer, but perhaps you never found anything that would make your remote work as smoothly as it used to in past versions of Ubuntu. Even if you got the remote to work in Kodi, you probably got double button presses or a lack of response to button presses on some buttons at random times, and maybe certain buttons would not work at all. We have heard of Kodi users giving up and going back to Ubuntu 16.04 because of this issue!

It turns out that the issue may not be with Ubuntu OR Kodi.  It appears the problem is that the Ubuntu 18.04 repositories contain a newer version of LIRC, that just doesn’t work properly.  We found that going back to an old version, specifically LIRC 0.9.0, is the answer – install that, and you do get a version of LIRC that works in Ubuntu 18.04 and that makes your remote work smooth as silk in Kodi.  Well, at least it did for ours, which is a standard Windows MCE compatible remote similar to the one pictured above.

So how do you do that?  Well, as the title of this blog implies, we are two “sort of” tech guys, and one thing we are not is Linux experts.  So, we took an approach that is relatively easy and that works, even if it may not be the “most correct” way to do it.  Here’s the procedure we used:

First, remove any existing installs of ir-keytable and/or lirc – from Linux command line do:

sudo apt purge ir-keytable lirc

Also, if you have added any other software in an attempt to get the remote to work, you probably should remove that as well.

Next, we’re going to temporarily edit /etc/apt/sources.list – we will use nano, but feel free to use vi or vim if that’s your thing:

sudo nano /etc/apt/sources.list

Add this line at the bottom of the /etc/apt/sources.list file:

deb http://ca.archive.ubuntu.com/ubuntu/ xenial universe

Use Ctrl-X to exit nano; be sure to save the file (unless you made a mistake, then just exit without saving and start over).

Then, from the Linux command line:

sudo apt update
sudo apt install lirc/xenial

You should see it install lirc and a few dependencies.  Somewhere in the process you should see “Setting up lirc (0.9.0-0ubuntu6) …” and also you should get the configuration screen, from which you can pick the type of infrared remote you use (such as “Windows Media Center Transceivers/Remotes (all)”, which is down near the bottom of the list).

lirc configuration screenClick on the image to enlarge

After that is finished, do this so Ubuntu won’t try to upgrade lirc to the newer bad version:

sudo apt-mark hold lirc

Now that lirc is installed, you need to go back and remove the line you just added to /etc/apt/sources.list:

sudo nano /etc/apt/sources.list

Scroll down to the bottom of the file and put the cursor at the start of this line and press Ctrl-K to delete it:

deb http://ca.archive.ubuntu.com/ubuntu/ xenial universe

As before use Ctrl-X to exit nano, and be sure to save the file.

Now from the command line you should immediately do this so that your system doesn’t inadvertently try to get any other packages from the xenial universe repository:

sudo apt update

And that’s it!  What we have done here is to temporarily enable the Ubuntu 16.04 (xenial) universe repository, where a copy of lirc 0.9.0 is available, and then we installed it using the apt command.

We do realize that there may be alternative way to do this, such as downloading the lirc package from the xenial repository (the amd64 version is here) and then installing it using dpkg, but we’d be a little concerned that doing it that way either might not bring in the necessary dependencies, or might not show the configuration menu.  But, feel free to try doing it that way if you’re much more conversant with Linux than we are.

We hope this helps others who have struggled to get their infrared remote working with Kodi in Ubuntu 18.04!

If you liked this article, you may also want to read our followup article: Extending the remote control capabilities of LIRC.