Mint 19 + Kodi 18 + Intel NUC i3

I'm finally upgrading my OS and it's time for a follow up on my popular post on setting up Kodi on Ubuntu 14.04.  It was invaluable to me in re-figuring out bits and pieces and some things have changed.

Rather than write out what's changed explicitly, I'll write this as a fresh guide and make notes when something is different than it was 4 years ago.

I'm using Linux Mint 19 now, which is based off Ubuntu 18.04.  These instructions will likely work fine for Ubuntu 18.04.  I'm using Kodi 18 (Leia) on an Intel NUC i3 D34010WYK.  As I write this Kodi 18 is on Release Candidate 3 (I was really hoping they'd have the final build out by now, but now is when I have time off).  Not a problem though, switching the PPA is easy (see below).

Update NUC’s UEFI

I grabbed the latest firmware from Intel (version 50) and flashed it onto the NUC.  Glad to see Intel used a sane process.  Just grab the .BIO file and put it on a USB flash drive.  Upon boot, hit F7 and navigate to the BIOS Flash Update Tool.

Install Linux Mint 19.1

I then installed Mint 19.1.  I won't cover that in this post.  Plenty of better places to find that information.  I'm using the 64-bit distribution.

Install Kodi 18

The Kodi Wiki install guide is pretty clear:

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:team-xbmc/ppa
$ sudo apt update
$ sudo apt install kodi
Note: ppa:team-xbmc/ppa is for the final release versions.  If you want a beta/release-candidate build (as I did for this installation) just switch ppa:team-xbmc/ppa to ppa:team-xbmc/unstable.

When the final version is released, you can switch to the stable build:

$ sudo add-apt-repository -r ppa:team-xbmc/unstable
$ sudo add-apt-repository ppa:team-xbmc/ppa
$ sudo apt update
$ sudo apt upgrade

ALSA, PulseAudio, TrueHD, DTS-HD MA

From what I can tell not much has changed in this aspect of the guide.  You can use PulseAudio directly with Kodi now, but you won't get TrueHD or DTS-HD MA passthrough support.  And your streams are all processed on-system instead of being sent to your receiver for processing.  So we'll continue to drop down to ALSA instead.

We use a custom XSession to accomplish this.  Which means we log in directly to Kodi instead of logging in to a desktop and running Kodi as an application.

Create our custom session launcher:

$ nano ~/kodi_custom_session_launcher

Paste in:

#!/bin/bash
# Kill PulseAudio so KODI will use ALSA for proper passthrough support
echo autospawn = no > ~/.config/pulse/client.conf
killall pulseaudio
# Start KODI
kodi-standalone
# Restore Pulse Audio
rm ~/.config/pulse/client.conf
pulseaudio --start

Make the launcher executable:

$ chmod +x ~/kodi_custom_session_launcher

Now create the custom XSession entry:

$ sudo nano /usr/share/xsessions/Kodi_ALSA.desktop

And paste in:

[Desktop Entry]
Name=Kodi with ALSA
Comment=This session will start KODI Media Center
Exec=/home/kyle/kodi_custom_session_launcher
TryExec=/home/kyle/kodi_custom_session_launcher
Type=Application
Note: Change "kyle" to your username

Now if you log out you should be able to select "Kodi with ALSA" as a session option from your login manager.  In Mint, this is accomplished by clicking the circle to the right of the user name.

Kodi Configuration

Note: Previously I had to workaround a bug with 24p audio/video synchronization.  That's no longer necessary.

I setup some stuff in Kodi's advanced settings file to disable the splash screen, hide the ext4 file system's "lost+found" directories, and increase the network streaming buffer.

Create the file:

$ nano ~/.kodi/userdata/advancedsettings.xml

And paste in:

<?xml version="1.0" encoding="UTF-8"?>
<advancedsettings>
  <splash>false</splash>
  <video>
    <excludefromlisting>
      <regexp>lost\+found</regexp>
    </excludefromlisting>
    <excludefromscan>
      <regexp>lost\+found</regexp>
    </excludefromscan>
    <excludetvshowsfromscan>
      <regexp>lost\+found</regexp>
    </excludetvshowsfromscan>
  </video>
  <network>
    <cachemembuffersize>15728640</cachemembuffersize>
  </network>
</advancedsettings>

NUC's Remote Control IR Receiver

To use the NUC's built-in IR receiver we need to install the ir-keytable utility:

$ sudo apt install ir-keytable

Then we define the keytable we need for the Onkyo RC-764M remote using the Xbox keycode 33003.  Create the file:

$ sudo mkdir /etc/rc_keymaps
$ sudo nano /etc/rc_keymaps/onkyo_rc-764m_nec_33003

And paste in:

# table onkyo_rc-764m_nec_33003, type: NEC
# Using Onkyo Remote Code 33003
# Code mappings match same buttons when using Original Xbox Dongle Remote Code
# ScanCode LIRC_KEY # Remote button text
# LIRC_KEY is modified to get correct action in XBMC using LIRC-in-kernel fake-keyboard actions

0x2d2d3a KEY_I #Display
0x2d2d59 KEY_LEFT #Left
0x2d2d5a KEY_RIGHT #Right
0x2d2d47 KEY_UP #Up
0x2d2d48 KEY_DOWN #Down
0x2d2d4a KEY_C #Guide/Top Menu -- Context Menu
0x2d2d4b KEY_ESC #Prev CH/Menu
0x2d2d45 KEY_BACK #Return
0x2d2d56 KEY_O #Setup -- Codec Info
0x2d2d58 KEY_ENTER #Enter
# UNUSED 0x2d2d4f #Audio
0x2d2d35 KEY_COMMA #Skip Left
0x2d2d34 KEY_PERIOD #Skip Right
0x2d2d32 KEY_R #Rewind
0x2d2d33 KEY_F #Fastforward
0x2d2d31 KEY_P #Play
0x2d2d38 KEY_SPACE #Pause
0x2d2d39 KEY_X #Stop
0x2d2d3b KEY_1 #1
0x2d2d3c KEY_2 #2
0x2d2d3d KEY_3 #3
0x2d2d3e KEY_4 #4
0x2d2d3f KEY_5 #5
0x2d2d40 KEY_6 #6
0x2d2d41 KEY_7 #7
0x2d2d42 KEY_8 #8
0x2d2d43 KEY_9 #9
0x2d2d44 KEY_0 #0
# UNUSED 0x2d2d4e #+10
# UNUSED 0x2d2d46 #CLR
# UNUSED 0x2d2d7c #Search
# UNUSED 0x2d2d7d #Repeat
# UNUSED 0x2d2d7f #Random
# UNUSED 0x2d2d7e #Play Mode

Now configure a systemd service to load the keytable at boot.  Create the service file:

$ sudo nano /etc/systemd/system/ir_receiver.service

And paste in:

[Unit]
Description=Configure the IR Receiver for the desired keytable

[Service]
Type=oneshot
ExecStart=/usr/bin/ir-keytable -c -p NEC -w /etc/rc_keymaps/onkyo_rc-764m_nec_33003

[Install]
WantedBy=multi-user.target

ExecStart needs the absolute path to the ir-keytable executable.  Here's what the command options do:  "-c" clears the existing keytable.  "-p NEC" puts the receiver in NEC mode. "-w /etc/rc_keymaps/onkyo_rc-764m_nec_33003" loads our custom keytable.

And enable the new service:

$ sudo systemctl enable ir_receiver.service
Change Note:
Previously I had a custom script that would unload and reload the nuvoton-cir kernel module.  That doesn't appear to be needed anymore.  Maybe it never was.

That script also used to run via rc.local.  That is no longer preferred and we use the systemd service instead

Screen Tearing

I have not seen any screen tearing yet, so I don't think this workaround is needed anymore.

Success

Now Kodi is up and running and everything is grand.

Bonus: Logitech Media Server

I also run Logitech Media Server for the fleet of Squeezebox Radios in the house.  Last time I set up a repository which kept installing updates and clobbering my configuration.  This time I just installed directly from a DEB file.

The information for LMS is a mess.  Lots of out-of-date information and lack of clarity on recommended approaches.  The main place to start is the Wiki page for Debian Packages (Mint is a derivative of Ubuntu which is a derivative of Debian).

One of the links on that page will take you to a package repository where you can download the latest DEB package (currently 7.9.2).  I grabbed the Debian amd64 package and installed it with:

$ sudo apt install ./logitechmediaserver_7.9.2~1545144292_amd64.deb

Road Trip 2018: Craters of the Moon National Monument

After our science-y adventures we finally reached Craters of the Moon National Monument.  I can vaguely remember going here as a kid at some point.  And I think we recreated that trip almost in its entirety.

I can remember hiking up Inferno Cone and the deceptiveness of the climb.  When you think you're just about at the top you find out the trail just levels out for a moment and the angle hides the rest of the cone.  Heather and I went to the top....

While Jess and Corinne waited at the bottom:

We saw the snow at the bottom of Snow Cone:

And look, pictorial evidence that I was on this trip!

That evening we had dinner at another Culver's, this one in Twin Falls:

And we pushed on to Elko, NV and found a hotel with a pool for the girls to do some swimming.  The next day it was all the way home and the Great Road Trip of 2018 was finally over.

 

Road Trip 2018: EBR-I & Arco Science Park

As one drives west across Idaho from Idaho Falls on highway 20 there is a whole lot of nothing until, bam, EBR-I and Idaho National Laboratory.  EBR-I is open to the public and we decided, what the heck, we likely will never be by here again.  EBR-I is Experimental Breeding Reactor One and was able to power its own facilities as a nuclear power plant.

Here is the floor where fuel rods were stored:

We didn't spend much time there (Corinne and Heather were not exactly interested) so it was on to Arco for lunch at Pickle's Place.

Across the street from Pickle's Place is the Arco Science Park.  Might as well let the girls burn off some energy.  They have a torpedo and a submarine conning tower.

The conning tower from the USS Hawkbill, SSN-666:

Then we were ready for our main destination of the day, Craters of the Moon National Monument.

Road Trip 2018: Grand Teton National Park

After our Dinosaur Dig adventure we began our return trip west.  We drove out past the end of civilization into the wilderness until we came to The Hatchet which is pretty much entirely by itself along Highway 287.  We watched the sunset behind the mountains wreathed in smoke from the fires raging across the country and went to bed.

The next morning it was up and out to try to get into Grand Teton National Park while there was still parking available.  We made it, but not by much.  We stopped in a shop to pick up some snacks for our hike up to and around Moose Pond.  Sadly, we didn't see any moose.  But it was still quite pretty and calm.

This sign was suspiciously similar to the signs in Jurassic Park....including the arrow which looks like you could peel it off and point it in any direction.

Once we finished our hike we drove to Jackson Hole and rode the gondolas up the mountain.

Hey, when Heather insists I take a picture of her making a silly face, it's going to end up on the internet...

After Grand Teton we headed into Idaho.  I had originally hoped to get all the way to Arco, but it became clear that was not going to happen.  So we found somewhere to stay in Idaho Falls, ate some Culver's for dinner, and called it a night.

Road Trip 2018: Family Picture Recreations

Here are a couple of the recreated pictures:

We didn't have picture from Old Paria Cemetary with us when we tried to recreate it.  So we don't have the right people or in the right places:

I don't have the new pictures of Evan and I wearing homemade pants or of Mollie and Megan's 2nd Birthday.  They must have been taken with someone else's camera or phone.