Intel NUC, Ubuntu 14.04 and Kodi

Just bought an Intel NUC 5i5RYK, a small and stylish 10 by 10 cm computer, to hold my photos, movies and music. I selected Kodi as the media center, running on top of Ubuntu 14.04 LTS. Getting everything in order took some time, but now it runs great.

Start by updating the BIOS. This can save a lot of troubles – highly recommended!

After this, Ubuntu installed without any problems from a USB stick. All the hardware was detected, except the infrared receiver. There are lots of conflicting instructions on the web, most of them meant for older versions of the NUC, and setup seems to easier on the newer Broadwell-based NUCs. First step is to ensure the IR receiver is enabled in the BIOS. It was enabled by default in my case, so no problem there and nothing to change. But then forget about LIRC. LIRC caused a lot of troubles and things turned out to be easier when using the ir-keytable program. My remote is an Apple A1156, and there are great instructions for how to make it work with ir-keytable here.

To make ir-keytable run on startup, I added this line to my crontab:

@reboot /usr/bin/ir-keytable -p nec -w /home/anders/Apple_A1156_NEC_Protocol

This will start ir-keytable on each reboot, tells the program to use the NEC protocol, and supplies a text file with information on the scan codes returned when pressing the buttons on the remote. The text file looks like this:

# table Apple_A1156_NEC_Protocol, type: NEC
0x77e1407e KEY_ESC
0x77e1207e KEY_ENTER
0x77e1e07e KEY_RIGHT
0x77e1107e KEY_LEFT
0x77e1d07e KEY_UP
0x77e1b07e KEY_DOWN

After this, the remote worked without problems in KODI. I could never make it work reliably with LIRC, though. It woulds always stop responding after a few buttons were pressed.

KODI however did not run very well. It froze randomly for no apparent reason. After installing some other software, I found that all programs using OpenGL had the same problem. The machine randomly went completely unresponsive and the only thing to do was to cycle the power. Much Googling finally revealed a fix for this.

The essence is to disable SNA graphics acceleration in the Xorg config file. Recent versions of Ubuntu don’t have this file by default, so one needs to be generated, using the command “sudo X -configure”. Copy the generated file into the directory /etc/X11/ as xorg.conf
Inside this file, make sure the following is present:
Section “Device”
Identifier “Card0”
Driver “Intel”
Option “AccelMethod” “uxa”

The critical thing being the “AccelMethod” “uxa” which disables “SNA” acceleration.

After this, no more crashes. The UXA acceleration is supposed to be slower, but I could not really notice this. But it also turns out that KODI does not play well with hardware 3D acceleration (VAAPI/VDPAU)). Movies are replaced by black frames and there was not sound. To fix this, it was necessary to select “software rendering” in KODI graphics setup. Then the movies played fine.

Having gotten this far, I noticed that the wifi connection was very slow, and that it often dropped out. The log files had this line repeated over and over again: “wlan0: deauthenticating from f4:f2:6d:9d:2c:4d by local choice (Reason: 3=DEAUTH_LEAVING)” at a very regular interval of exactly one minute three seconds. Again, it took hours of googling to find the solution – a bug in Intel’s iwlwifi driver. It is cured by adding “options iwlwifi 11n_disable=1” to /etc/modprobe.d/iwlwifi.conf. The max speed then becomes 54 Mb/s, very disappointing, but low speed is better than a driver that disconnects every minute…None of the other suggested solutions (disabling power management, disabling link aggregation, etc etc had any effect whatsoever, so it seems the critical thing on the NUC is to disable 11n).

So, in summary, the Intel NUC is a very nice little computer that works great as a media center. But the bugs in Intel’s graphics and network drivers cause a lot of troubles. There are workarounds, but it was not easy to find them. Now it runs great! Perhaps the next release of Ubuntu LTS will take care of these problems…it is due in April.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *