Odroid XU4: Fix kodi/xbmc freezes (fixed in newer versions)

At the beginning of this year I bought my new odroid XU4 with a preinstalled ubuntu 15.04 and was eager to set it up as multimedia station for my TV. Using the shipped kodi/xbmc which has hardware acceleration I’m able to watch the videos of choice on my TV which is connected by HDMI. Unfortunately I experienced massive freezing problems with kodi.

Problem

When kodi is started, the screen (TV) freezes (can’t even access another tty) as soon as one of the following happens :

  • change to a tty commandline interface
  • trying to change to another program using alt+tab
  • closing kodi using the exit button

I wasn’t sure what caused the problem, so a quick google search revealed that the most common answer is to turn off CEC inside kodi using System/Settings/System/Input devices/Peripherals/CEC Adapter/Enabled: NO (source: odroid forum ). Unfortunately this didn’t solve the problem.

Workaround 1

The easiest workaround that I found was to use kodi only for watching movies, avoid any action listed above. To close kodi I killed it remotely using ssh with killall -9 kodi.bin. As this implies using another machine as soon as you want to do anything outside of kodi it obviously sucks.

Workaround 2

I found this partial solution here which gives me a way to exit kodi using the normal exit button.

Below I’ll show the modified instructions as the initial set of instructions included some small typos: (if not working check the thread for updates).

Create the killxbmc file at /usr/local/bin/killxbmc containing:

#!/bin/bash

while pgrep kodi.bin; do
  pkill kodi.bin
  sleep .5
done
sudo chvt 2
sleep 1
sudo chvt 7
# for ubuntu you use chvt 7 here, for many other linux distributions e.g. arch you might need chvt 1 (depends which tty the GUI runs on)

Make it executable:

sudo chmod +x /usr/local/bin/killxbmc

Create a python wrapper for killxbmc at ~/.kodi/killkodi.py containing:

import os
os.system('/usr/local/bin/killxbmc')

Edit the kodi skin to call the killxbmc instead of a normal quit.
The location seems to be OS dependent as gripped who created the instructions for arch used /usr/share/kodi/addons/skin.confluence/720p/DialogButtonMenu.xml whereas I on Ubuntu 15.04 needed to use /usr/local/share/kodi/addons/skin.confluence/720p/DialogButtonMenu.xml.
Create a backup of the file before making modifications!
Change the line 84 (the action of the exit button) from

<onclick>Quit()<onclick>

to

<onclick>Runscript(/home/YOURUSERNAME/.kodi/killkodi.py)</onclick>

replacing YOURUSERNAME with your username.

If you are using a custom skin you would have to find DialogButtonMenu.xml for that skin under ~/.kodi/addons (on arch). If you are using the default skin and you update Kodi you will need to edit DialogButtonMenu.xml again.

Next you need to modify /etc/sudoers to allow passwordless sudo for chvt, changing sudoers it is highly recommended to use visudo as it prevents you from corrupting the file.

Since I don’t like dealing with vi I used the nano input mod of visudo:

sudo su
EDITOR=nano visudo

Using visudo I added the following line to the end of the file (this assumes default configuration):

odroid odroid= NOPASSWD: /bin/chvt

As a result the executed command of the exit option in kodi was substituted by the provided script which essentially kills kodi the hard way kill -9 and then switches to tty2 and back to the GUI tty7.

This way kodi can be shutdown successfully using the Exit button.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: