Install Kodi on Debian, Ubuntu, Arch Linux & OpenSUSE Leap

Kodi, formerly XBMC (Xbox Media Center), is a free and open-source media player software licensed under GPLv2. It can run on Linux, OS X, FreeBSD, Windows, Android, and Apple TV OS. It has a 10-foot user interface which means it can easily read from a distance of 10 feet and controlled by a regular television remote control.

You can watch live television, TV shows, movies or set up a home theater PC with Kodi. In this tutorial, we will be discussing how to install Kodi on Debian, Ubuntu, Arch Linux, and OpenSUSE.

install kodi debian ubuntu arch linux opensuse

Install Kodi on Debian

Kodi is included in Debian repository. Run the following command to install it.

sudo apt-get install kodi

To start kodi

kodi

Install Kodi on Ubuntu-based Linux distros via PPA

For Ubuntu, Linux Mint, Elementary OS, etc, there’s an official Kodi PPA available.

sudo add-apt-repository ppa:team-xbmc/ppa

sudo apt-get update

sudo apt-get install kodi

To start Kodi, type:

kodi

in terminal.

Install Kodi on Arch Linux

Kodi is in the Arch Linux community repository, so we can easily install kodi using pacman

sudo pacman -S kodi

Install Kodi on OpenSUSE Leap 42.1

Kodi in available in the packman repository, so first enable packman on OpenSUSE Leap 42.1 with this command:

sudo zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_42.1/ packman

Then install kodi with zypper

sudo zypper install kodi

Where to Download Movie and TV Shows

  1. Use a torrenting client like Deluge.
  2. Learn how to download from Usenet.

Advantages of Usenet

  1. It gives you better privacy because others can’t see what you are downloading.
  2. Superfast download speed.
  3. Files on Usenet are usually kept much longer than torrent files. For example, Newsdemon stores files for 4430 days (more than 12 years), so you can download old content at a very fast speed.

Install Kodi on Ubuntu ARM/Raspberry Pi OS

Note that the above PPA doesn’t work on Ubuntu ARM edition for Raspberry Pi or the official Raspberrry Pi OS. To install Kodi on Ubuntu ARM/Raspberrry Pi OS, simply run

sudo apt install kodi

If your Raspberry Pi doesn’t have a desktop environment, then at least you need to install an X window system and basic video driver in order to run Kodi.

sudo apt install xinit xterm xserver-xorg-video-fbdev libvdpau-va-gl1

Xinit allows you to run a GUI program in X window system, without having to start a window manager or a full desktop environment. To start Kodi, we can run

xinit kodi

To automatically start Kodi at boot time, we need to create a systemd service unit with a command-line text editor like Nano.

sudo nano /etc/systemd/system/kodi.service

Add the following lines to the file.

[Unit]
  Description=Kodi Media Center
  After=network-online.target
  Wants=network-online.target

[Service]
  Type=simple 
  Environment=HOME=/root
  ExecStart=/usr/bin/xinit kodi
  Restart=always
  RestartSec=2

[Install]
  WantedBy=multi-user.target

Save and close the file. Enable auto-start at boot time.

sudo systemctl enable kodi

Now you can reboot to see if this works.

sudo shutdown -r now

To display non-Latin characters, install the following packages.

sudo apt install fonts-noto-cjk fonts-noto-cjk-extra fonts-noto-hinted fonts-noto-unhinted ttf-unifont

Then go to Kodi Settings -> Interface -> Skin -> Fonts. Change fonts from skin default to arial based. Then Kodi will be able to dispaly non-Latin characters.

You might also want to automatically mount external HDD on your Raspberry Pi, so you can select folders on your HDD from the Kodi interface.

Stop CPU Intensive Applications on Raspberry Pi

Playing videos in Kodi on Raspberry Pi uses lots of CPU power. If you have other applications running on your Raspberry Pi, consider stopping them for a smooth TV-watching experience. For example, stop the Syncthing peer to peer sync tool, which also uses lots of CPU power.

sudo systemctl stop syncthing@username.service

Stop Resilio Sync.

sudo systemctl stop resilio-sync

The Transmission BitTorrent client can also use lots of CPU power.

sudo systemctl stop transmission-daemon

You can configure systemd to automatically stop them when kodi starts. Edit Kodi systemd service file.

sudo nano /etc/systemd/system/kodi.service

Add the following two lines in the [Unit] section.

After=network-online.target syncthing@username.service resilio-sync.service transmission-daemon.service
Conflicts=syncthing@username.service resilio-sync.service transmission-daemon.service

Like this:

[Unit]
  Description=Kodi Media Center
  After=network-online.target syncthing@linuxbabe.service resilio-sync.service transmission-daemon.service
  Conflicts=syncthing@linuxbabe.service resilio-sync.service transmission-daemon.service
  Wants=network-online.target

[Service]
  Type=simple
  Environment=HOME=/root
  ExecStart=/usr/bin/xinit /usr/bin/kodi
  Restart=always
  RestartSec=2

[Install]
  WantedBy=multi-user.target

Save and close the file. Then reload systemd.

sudo systemctl daemon-reload

Because we specified that Kodi conflicts with the other 3 services, when you star kodi.service, the other 3 services will be automatically stopped.

Increase GPU Memory on Raspberry Pi OS

The default GPU memory might not be sufficient for smooth video playback in Kodi. You can launch the raspi-config tool to increase GPU memory.

sudo raspi-config

Go to Performance Options -> GPU Memory and give it 256MB. I found that 256MB GPU memory is required to play some ultra HD/BlueRay movies on my Rasberry Pi. Reboot for the change to take effect.

raspberry pi OS GPU memory

After rebooting, your system has less RAM for regular programs to run, as indicated by the htop command. For example, my Raspberry Pi 1 has 512MB physical RAM, now the system recognize only 242MB physical RAM. Kodi uses very little RAM, so you don’t need to worry about system running out of RAM. My Raspberry Pi 1 uses about 120MB RAM when Kodi is playing videos.

raspberry pi increase GPU memory to improve video playback

When my GPU memory was set to the default value (64MB), Kodi couldn’t play videos at all. And there is error in the Kodi logs as follows:

ERROR: COMXCoreComponent::DecoderEventHandler OMX.broadcom.video_decode - OMX_ErrorUnsupportedSetting, unsupported setting
ERROR: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.video_decode) - OMX_UseBuffer failed with omx_err(0x80001018)
ERROR: COMXVideo::Open AllocOMXInputBuffers error (080001018)
ERROR: OMXPlayerVideo : Error open video output
NOTICE: OMXClock using video as reference
WARNING: OpenVideoStream - Unsupported stream 1. Stream disabled.

Now the GPU memory is set to 256MB, video playback is much better.

To change the GPU memory on Ubuntu ARM OS, edit the config.txt file.

sudo nano /boot/firmware/config.txt

Add the following line to set GPU memory to 256 MB.

gpu_mem=256

Save and close the file. Then reboot.

Overclocking for Better Performance

If you use Raspberry Pi 1, which has a default clock speed of 700MHz, I recommend overclocking it to at least 900MHz with the raspi-config tool for better performance. Overclocking to 800MHz is better than the default, but you still can’t make Kodi go back to the main screen while playing videos. You can run the following command to check the current CPU clock speed.

sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

Note that overclocking will increase CPU temperature, so don’t overclock too much.

And you might want to remove unnecessary software like below and use your Rasberry Pi only as a media center, so there will be fewer programs using CPU.

sudo apt purge avahi-daemon redis-server rng-tools shadowsocks-libev

Disable Swap on Raspberry Pi OS

Swap space can make your Raspberry Pi slower and it can wear out your SD card much faster than you think. For better performance, it’s a good idea to disable swap space. To disable swap file, run the following command.

sudo dphys-swapfile swapoff

The above command will fetch all content in the swap file back into the physical RAM, then disable the swap file. Now you can delete the swap file to reclaim disk space.

sudo dphys-swapfile uninstall

However, the swap file will be turned on again after reboot. To prevent this from happening, edit the swap configuration file.

sudo nano /etc/dphys-swapfile

Find the following line, which sets the swap file size to 100MB.

CONF_SWAPSIZE=100

Change the value to zero.

CONF_SWAPSIZE=0

Save and close the file. You can also disable the dphys-swapfile.service, so it won’t start at boot time.

sudo systemctl disable dphys-swapfile

Enable Hardware Acceleration on Ubuntu ARM

Kodi on Ubuntu ARM will use lots of CPU resouces. This is because, by default, hardware acceleration is disabled. You can confirm it by running the following two commands.

cat /proc/device-tree/soc/firmwarekms@7e600000/status

cat /proc/device-tree/v3dbus/v3d@7ec04000/status

It should return disabled in the output. To enable hardware acceleration, first install some packages.

sudo apt install libgles2-mesa libgles2-mesa-dev xorg-dev

Then edit the firmware configuration file.

sudo nano /boot/firmware/config.txt

Add the following lines at the end of this file.

#Enable 3D video driver. There're 3 dirvers you can choose from. Try another if the first one doesn't meet your expection. 
dtoverlay=vc4-fkms-v3d
#dtoverlay=vc4-kms-v3d
#dtoverlay=vc4-kms-v3d-pi4

#Allolocate 256MB memory to GPU.
gpu_mem=256
#Enable 4K 60FPS 
hdmi_enable_4kp60=1

Save and close the file. Then reboot your Raspberry Pi.

sudo shutdown -r now

And run the above two cat command gain. It should return okay in the output, which means hardware acceleration is enabled.

Troubleshooting

If there are screen-tearing while playing videos in Kodi, you can check the Kodi logs (~/.kodi/temp/kodi.log) to find out what’s wrong.

Adjusting Console Resolution on Raspberry Pi

If the console goes off the screen, then you need to make the resolution smaller. Edit the /boot/config.txt file on Raspberry Pi OS. (If you use Ubuntu ARM OS, edit the /boot/firmware/config.txt file.)

sudo nano /boot/config.txt

Comment out the following line to enable overscan.

disable_overscan=1

Then add the following lines to adjust the console resolution.

overscan_left=16
overscan_right=16
overscan_top=16
overscan_bottom=16

Save and close the file. Then reboot your Raspberry Pi. If there is too much border in the Kodi interface after reboot, you might need to change 16 to a smaller value.

How to Watch Live TV/IPTV on Raspberry Pi

First, install the simple IPTV/PVR client.

sudo apt install kodi-pvr-iptvsimple

Restart Kodi.

sudo systemctl restart kodi

Go back to the Kodi main interface and select Add-ons -> My Add-ons -> PVR clients -> PVR IPTV simple client. Then click the configure button. You will need to enter the m3u playlist path. Please search online to download m3u files.

Save the settings. Go back toAdd-ons -> My Add-ons -> PVR clients, open the context menu and enable the PVR IPTV simple client. Now go back to the Kodi main interface -> TV and you should be able to browse TV channels.

Monitor CPU Temperature on Raspberry Pi

Raspberry Pi is designed to run at 0~50 Celsius at low system load. It’s a good practice to keep the CPU temperature under 60 Celsius, so it will have longer life span. The hard temperature limit is 85 Celsius. You can go to Kodi Settings -> System Info to check the CPU temperature.

Obviously, the CPU temperature will be much lower in the winter. In my case, it’s about 36 Celsius when not playing videos and 45 Celsius when playing videos.

You can also check CPU temperature with the following command:

sudo vcgencmd measure_temp

On Ubuntu ARM OS, you need to install a package in order to use the above command.

sudo apt install libraspberrypi-bin

Connect Raspberry Pi to Old TVs

Generally, you connect Raspberry Pi to the TV via HDMI cable. However, old TVs might not have HDMI port. Then you can use an HDMI to RCA converter.

Wrapping Up

I hope this tutorial helped you install Kodi on Linux. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 22 Average: 4]

One Response to “Install Kodi on Debian, Ubuntu, Arch Linux & OpenSUSE Leap

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image.