💾 Archived View for uscoffings.net › tech › raspberry-pi-kodi.gmi captured on 2023-03-20 at 17:50:47. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-06-03)

-=-=-=-=-=-=-

Installing Kodi on RaspberryPi

[date: 2015-10-09]

These are my notes from installing Kodi (formerly XMBC) on several Raspberry Pi's (original and 2) to create media-centers.

Parts List

Note that quality of the USB power supply really matters, especially for the original RPi. I had to unsolder the fuse from the original RPi due to excessive voltage drop, otherwise even high-quality power adapters could not power it reliably. In my experience, USB power adapters for Samsung tablets work well. No-name Chinese adapters never work reliably on the original RPi. With crappy power adapters, I have experienced all sorts of strange behaviors. The RPi might hang, or reboot, or the video might go black, or networking might fail while the rest of the system continues to function. If it's unstable, I would guess that your power supply cannot hold a stable voltage. The RPi can fail piecemeal under low-voltage situations.

Installer

The ideal installer for Raspbian has changed over time. Currently the best seems to be `raspbian-au-netinst`. Download the latest installer from the GitHub page: https://github.com/debian-pi/raspbian-ua-netinst/releases

dd it to an SD (for the original RPi) or a microSD (for the RPi 2) card. 2GB card or larger should work, although I'm using SanDisk 8GB cards. I could have gotten 16GB no-name cards for the same price, but in a professional setting I have seen terrible reliability issues with no-name cards. Go quality over quantity.

Insert the card. Plug in an ethernet cable. Power on, and it will auto-install.

Post-install Configuration

After the install completes and it reboots, log in as `root` with the password `raspbian`.

Set your timezone:

# dpkg-reconfigure tzdata

If you install Kodi later it will create the user `kodi`, but most RPi tutorials expect the user `pi`. Just go with the norm. Add the user and add it to various groups so that it can access the hardware:

useradd pi
usermod -a -G audio pi
usermod -a -G video pi
usermod -a -G input pi
usermod -a -G dialout pi
usermod -a -G plugdev pi
usermod -a -G tty pi

Install some extra packages that I would consider fundamental:

apt-get install sudo raspi-config nfs-common firmware-realtek wpasupplicant

If you bought an H264 license to enable the hardware decoder (which I consider mandatory for the original RPi), install it now to `/boot/config.txt`. If you buy the codec from the raspberrypi foundation, you'll get an email explaining what to paste into this file. For the Raspberry Pi 2, it's optional (the processor is plenty powerful for most video).

Networking

Here is the original `/etc/network/interfaces` for wired:

    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet dhcp

Modify it to enable the wireless adapter, and not expect the wired connection to be present:

    auto lo
    iface lo inet loopback
    
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    auto wlan0
    iface wlan0 inet dhcp
       wpa-ssid myssid
       wpa-psk mypassword

Add NFS mounts to `/etc/fstab`. Of course, also `mkdir` these mount points. For me, they are:

    server:/pool/Movies /pool/Movies nfs defaults 0 0
    server:/pool/Music /pool/Music nfs defaults 0 0
    server:/pool/Library /pool/Library nfs defaults 0 0

I also enable sshd (easy with `raspi-config`).

Generic (non-Kodi) customization

For generic use, with a desktop environment that can play movies:

    apt-get install omxplayer xfce4 iceweasel lightdm

To make movies clickable, right-click on a movie, select "Open With Other Application...", and use the custom command `xterm -e omxplayer -b`.

Final Kodi customiztion

To dedicate the RPi as a media-center, start by installing Kodi:

    apt-get install kodi

Create new 'input' group

    addgroup --system input

Add some udev rules:

    vi /etc/udev/rules.d/99-input.rules

...with these lines:

    SUBSYSTEM==input, GROUP=input, MODE=0660
    KERNEL==tty[0-9]*, GROUP=tty, MODE=0660

And more:

    vi /etc/udev/rules.d/10-permissions.rules

...with these lines:

    # input
    KERNEL=="mouse*|mice|event*",   MODE="0660", GROUP="input"
    KERNEL=="ts[0-9]*|uinput",     MODE="0660", GROUP="input"
    KERNEL==js[0-9]*,             MODE=0660, GROUP=input
    # tty
    KERNEL==tty[0-9]*,            MODE=0666
    # vchiq
    SUBSYSTEM==vchiq,  GROUP=video, MODE=0660

Finally, edit `/etc/defaults/kodi`, to make it start automatically and run as our user `pi`:

    ENABLED=1
    USER=pi

Launching

Note that X11 is not installed. Therefore, `kodi` won't work, but `kodi-standalone` should. Be sure to set `ENABLED=1` in `/etc/defaults/kodi`, and reboot.

Server

To complete the picture, the RPi's are serving media from both the internet and from my FreeBSD-based server running ZFS with mirrored vdevs.