User Tools

Site Tools


Raspberry Pi Micro Media-Hub


  • Raspberry Pi 3
  • Powered USB hub
  • USB hard disk 1 Tb
  • USB audio adapter
  • Joystick controller
  • LCD display 16×2 charaters

Current consumption

See FAQS PowerReqs.

  • Raspberry Pi 3 Model B
    • 1GB RAM
    • Typical bare-board active current consumption: 400mA
    • Maximum total USB peripheral current draw: 1.2A
    • Recommended PSU current capacity: 2.5A
  • Raspberry Pi 3 Model A+
    • 512MB LPDDR2 SDRAM
    • Typical bare-board active current consumption: 350mA
    • Maximum total USB peripheral current draw: Limited by PSU, board, and connector ratings only.
  • Toshiba Canvio Basics 1Tb
    • USB bus power (max. 900mA)


We started with a Raspbian 2017-11-29 lite, based on Debian Stretch. To have a minimal Kodi installation and support for the joystick, just install the following packages:

  • kodi
  • kodi-bin
  • kodi-peripheral-joystick

Kodi will not start automatically at boot, just execute kodi-standalone from the command line.

NOTICE: Raspbian based on Debian Stretch 9.11 uses two repositories:

The first repository provides Kodi 17.1 as per Debian Stretch. The second repository provided Kodi version 17.6 on December 2017, but it was upgraded to Kodi version 18 on february 2019. So beware of what packages you are installing, respect the right dependencies and be carefull with upgrades.

Our current installation uses these versions:

kodi 2:17.6-2~stretch
kodi-bin 2:17.6-2~stretch
kodi-eventclients-common 2:18.1-1~stretch
kodi-eventclients-kodi-send 2:18.1-1~stretch
kodi-peripheral-joystick 1.3.4-1~stretch
libkodiplatform17:armhf 17.4.0~stretch

To activate a joypad you have to go through SettingsSystem settingsInputConfigure attacched controllers.

Starting Kodi at Boot

There are several recipes on the internet to start Kodi on boot; we searched one with the following features:

  • Does not require xserver.xorg, as we have installed Raspbian Stretch Lite.
  • Run Kodi as unprivileged user.
  • Run as a service, do not use autologin and autostart tricks.
  • Should be compliant with the underlying init system, which is systemd in Raspbian Stretch.
  • Can perform reboot and poweroff from Kodi menu.

So we want to execute kodi-standalone as kodi user. Create that user first, and assign him to the required groups:

adduser --disabled-password --gecos "User to run Kodi Media Center" kodi
adduser kodi audio
adduser kodi video
adduser kodi plugdev
adduser kodi input

Then we created a systemd unit file /etc/systemd/system/kodi.service to start Kodi as a service. Please do not use an old fashioned sysvinit start/stop script (e.g. /etc/init.d/kodi), because the new systemd can use it only in compatibility mode.

Description = Kodi Media Center

# if you don't need the MySQL DB backend, this should be sufficient
After = systemd-user-sessions.service

# if you need the MySQL DB backend, use this block instead of the previous
# After = systemd-user-sessions.service mysql.service
# Wants = mysql.service

User = kodi
Group = kodi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = always
RestartSec = 15

WantedBy =

To actually enable and start the service, run:

systemctl daemon-reload
systemctl enable kodi.service
systemctl start kodi.service

Now we have to solve a problem: the unprivileged Kodi user cannot perform reboot and poweroff actions: as you can se the exit menu of Kodi shows only the Exit item. We need a piece of software: policykit-1. This package contains the framework which handles the authorizations, according to the guidelines.

apt-get install policykit-1

We created the file /etc/polkit-1/localauthority/50-local.d/50-kodi.pkla, which allows the Kodi user to execute some privileged actions:

[Actions for kodi user]

Problem Decoding Webm (VP8 Encoded) Videos

We got a severe problem trying to play some .webm video files: the audio starts but it freeze shortly, the video does not start at all. After that, all the Kodi interface was frozen and we need to reboot (ssh access still working). Into kodi.log we get the following error:

CMMALVideo::Open Failed to commit format for decoder
    input port ) (status=3 EINVAL)

To confirm that the video codec is VP8, we installed the mediainfo package an run the tool against the video; which actually uses the VP8 codec. The official Kodi Wiki says that VP8 is supported on the Raspberry Pi architecture, so we are searching for the problem somewhere else.

This post says that VP8 hardware (GPU) decoding is supported only if firmware start_x.elf is loaded: Note that GPU accelerated software codecs (and camera) are only available from start_x.elf. Add start_x=1 to config.txt (or use raspi-config and enable camera). This means that we have to add the following line in /boot/config.txt (The required file is already in the /boot directory):


See also the page Boot options in config.txt. We have also gpu_mem=128 in the same config file.

Starting Kodi only if USB hard disk is present

We keep all our media files (video, images, etc.) into an USB hard disk, connected through a powered USB hub. It can be possible that the Raspberry Pi will be started without the disk attached. In this case we want no Kodi service to be started. See this paragrph on how to configure systemd unit for that purpose.

Web References

USB 3.0 VIA Labs Hub Problems

The first attempt was an Amazon Basics USB 3.0 4 ports hub. Unfortunately it is based on the VIA Labs chips, which seems to have a bug, so it is uncompatibile with the Raspberry Pi.

The device is listed on the USB bus:

Bus 001 Device 005: ID 2109:2811 VIA Labs, Inc. Hub

but when you connect even a simple mouse, you get plenty of errors, and the device does not work:

usb 1-1.4.1: new low-speed USB device number 6 using dwc_otg
usb 1-1.4.1: device descriptor read/64, error -71
usb 1-1.4.1: device descriptor read/64, error -71
usb 1-1.4.1: new low-speed USB device number 7 using dwc_otg
usb 1-1.4.1: device descriptor read/64, error -71
usb 1-1.4.1: device descriptor read/64, error -71
usb 1-1.4.1: new low-speed USB device number 8 using dwc_otg
usb 1-1.4.1: device not accepting address 8, error -71
usb 1-1.4.1: new low-speed USB device number 9 using dwc_otg
usb 1-1.4.1: device not accepting address 9, error -71
usb 1-1.4-port1: unable to enumerate USB device

I tried several workarounds: leaving the hub unpowered, attaching an USB 3.0 external hard disk, adding the option dwc_otg.speed=1 into /boot/cmdline.txt. None of that gave a minimal benefit. I returned the hub back to Amazon.

Here are some web references:

doc/appunti/hardware/raspberrypi_micromediahub.txt · Last modified: 2020/09/28 18:45 by niccolo