While Raspberry Pi with xbian is already a versatile media center, I’m not 100% satisfied with everything. And, with the advent of H.265/HEVC as German DVB-T2 standard, the technical requirements have outrun the current offerings of the Raspberry Foundation. So I decided to migrate my Kodi media center to brand-new Libre Computer’s Le Potato board with LibreELEC, and here are the steps to do so, starting from the xbian media center described in an earlier blog post.
If you want to skip the introductory bla bla, go directly to the necessary steps.
Remark: This is a somewhat outdated post – this one is more up to date!
The Raspberry has served me as a Kodi media center based on Xbian now for nearly one year, in the beginning on a small SD TV set, in the meantime on a 24″ FullHD LCD TV. However, in the end I was not fully satisfied – the following issues kept annoying me:
- Sluggish performance: while the UI was responsive enough, starting videos from the add-ons (mainly: funk mediathek by membrane – great work, thanks!) was slow, and also navigating within a running video (fast forward/reverse) did not feel smooth.
- USB/network issues: It simply is not stable/reliable – having an USB device (like a USB sound card or a USB memory stick for recordings) plugged in and then running IPTV streams over the network caused all kinds of problems due to the combined USB/LAN implementation. This ranged from stuttering audio over corrupted USB TV recordings to crashes. As a result, all TV recordings went to the SD card, which will wear it out over time.
The “mean” thing about the USB issues is that they usually do not show up immediatly, so when you test it, all looks fine, and only the real world szenarios finally confront you with the problem.
- Missing H.265 support: With the advent of DVB-T2 in Germany HEVC/H.265 became the new standard. I plan to attach a USB DVB-T2 dongle at some point, so I’d need this codec hardware supported.
I *love* the Raspberry, its general idea, the commitment of the foundation, the education, the huge community, it being produced in EU – I’m a fan since the first Raspberry generation (waiting 12 weeks for its arrival back then…). Still, since Raspberry Pi 4 will probably not be around the corner before 2019, I allowed my heart to wander a bit and looked around for reasonably priced SBCs with H.265 support – of which there are surprisingly many! Even when you narrow it down to the Raspberry Pi form factor to fit into the TARDIS. An article in German Make magazine pointed me at the brand-new Libre computer “Le Potato” which not only offered H.265, but even 4K, HDR and VP9, based on the amlogic S905X chip; all for a very reasonable price. And it had a ready Kodi implementation based on LibreELEC available.
It is now here, set up and running, and I’ll document below how I implemented the necessary steps as outlined in my earlier blog post on the difficulties with German IPTV. While xbian offers a native Raspbian distribution as base, LibreELEC is rather frugal and some steps need more creativity.
Just one word at this time (February 2018) on the Le Potato: I’d say it is fit only for Kodi at the moment. The available online resources are scarce and incomplete. There is even no implementation to use the GPIO (although it is at the horizon), and all OS images available have status “testing”, including the LibreELEC I use. Looking at the fate of other SBCs, it may well stay as it is – so do not think of the Libre computers as Raspberry Pi replacements at the moment for any other purposes, unless you’re willing to dig really deep.
- Install LibreELEC
- Install tvheadend
- Install webserver
- Install Docker
- Get Docker container
- Set up webserver
- Configure tvheadend
Remark: I did not implement LIRC as before – the reason is, that my new TV set supports HDMI CEC, which really works well with Kodi (out of the box, both with Raspberry Pi and Le Potato) and I’m happy to be rid of another remote. However, since the Le Potato has an IR receiver onboard, it should not be too dificult to get LIRC working.
There are basically three community builds I’m aware of, one by kszaq, focussing on Kodi Krypton, and one by adamg, sporting Kodi Leia. The third, also Leia, is by Raybuntu, but it is “inofficial” and not yet supported. The one by adamg is the one referred to on the Libre Computer product page for Le Potato. Since I first was not aware of this diversity, adamg’s image is the one I used. It works well enough, despite it’s Alpha status. Thanks to the community efforts! For details, refer to the LibreELEC Forum.
Installation itself follows standard procedure, writing the OS image to the SD card.
Totally straightforward: Just go to the addons and pick tvheadend from the Services section. 4.2 and 4.3 are vailabe, I went for 4.3 – works. Also you’ll need the tvheadend HTS client as PVR addon.
Not so straightforward: Other as with xbian, you can’t just run apt-get install to add packages to the system. The way around this is Docker, a container-based virtualization technology. Docker allows to run applications in a more or less closed containerized environment, which will contain all necessary resources and dependencies, but not much more. You may create your own container, but there is a huge community of ready made docker containers, among them a well designed apache/php container. So the steps are:
There is a LibreELEC addon in the Services section to install Docker – done. In my case, a reboot was necessary to get docker up’n’runnin’.
Install Apache/PHP Container
There are ready made community builds of Apache with PHP, namely anbove mentioned apache/php container. To install it, run:
docker run -d -p 8000:80 -v /storage/www:/var/www/html --restart unless-stopped --name WWWserver php:7.1-apache
The commandline options mean:
Detached = runs in the background.
- -p 8000:80
Map the host’s port 8000 to the container’s port 80 – thus, I can use port 8000 as in my previous incarnation of Kodi, but need not change the default port of Apache in the container.
- -v /storage/www:/var/www/html
Map the host’s directory /storage/www into the container’s directory /var/www/html. This makes it easy to put data into the webserver. You may give more than one -v option to map multiple directories. Only prerequisite: The container’s directory needs to be empty within the container.
- –restart unless-stopped
The container will restart automatically (e.g. after a reboot), unless the reason for stopping was an explicit stop command.
Your name for the container (if not given, you can still address the container by its unique numerical ID – run docker container ls to see your containers).
The community package – docker already knows where to look for it with its default configuration.
After issuing the command, docker will download and set up everything as needed without more ado – really easy and nice!
Unable to find image 'php:7.1-apache' locally
7.1-apache: Pulling from library/php
75ec46627298: Downloading 24.87 MB/50.89 MB
4d3578d1788a: Download complete
0f43bdf79458: Downloading 31.94 MB/61.43 MB
cb888e4227be: Download complete
5fad4c128add: Download complete
94a390a3931b: Download complete
2451e50f76ec: Download complete
6d7897fa16df: Download complete
77b800154272: Download complete
1abbdb2b33cd: Download complete
92aa82ad21fb: Download complete
55395dd1a4ff: Downloading 2.178 MB/13.52 MB
Set up Web Server
Again easy: Put the PHP files from my 30 minute problem solution into /storage/www – done. Well, not completely: The redirect is a little bit more complicated. With
docker container exec -it WWWserver /bin/bash
you’ll get an interactive shell within the container, and there you can edit the apache config, but somehow I could not bring the redirect to work. I did not want to spare too much time on it, so I decided to skip it and use the method without redirect.
Method #1: Follow the steps from my recent post. Method #2: Copy the config from old Kodi/tvheadend to the new one. Here are the steps:
- Make a copy of the tvheadend config on xbian:
Create copy of tvheadend configuration on xbian12cd ~/.htstar cvzf tvheadend-config.tar.gz tvheadend/
- Copy this file to the LibreELEC to /storage.
- On the LibreELEC box, backup the default tvheadend configuration from the addon installation (don’t ask why it is “44” – I installed 4.3):
Backup stock configuration of tvheadend12cd ~/.kodi/userdata/addon_datamv service.tvheadend44 service.tvheadend44.backup
- Then restore the old configuration:
Restore xbian configuration of tvheadend123tar xzvf /storage/tvheadend-config.tar.gzmv tvheadend service.tvheadend44chown --recursive root:root service.tvheadend44
If you have used the redirect method on xbian, you’ll now either need to change the networks to non-redirect method, or you need to figure out the redirect in apache – this should not be too complicated. As said: I did not really try hard…
OK, done. The box is now at the same state as the old xbian setup.
Le Potato runs really smooth! OS starts rather quick, UI is fast and responsive, and H.265 just works. Navigating within a video is real fun: Even at speed 16x fast forward the picture is smooth enough for precise navigation.
Stability however is not perfect: The major use cases, i.e. watching videos and watching TV, work stable. Currently I face a reproducible problem when copying large amounts of data, e.g. a DVD image, to any attached storage. After a few hundred MB the whole machine crashes, caused by a crash of the network stack. I’m confident that over time this will be resolved, since the Armbian team has already solved the same problem for their mainline kernel. However, until this is fixed, one important use case is not working: recording TV. This also writes a large file to the storage, resulting in failure at some point.
Update September 2018: Bug fixed!
The large file write problem is finally solved! Details can be found here in the forum of the CoreELEC fork. I can confirm that this also works for the older builds from LibreELEC by kzaq/adamg which I use, since it is an u-boot issue.
Update January 2019: Nearing stable environment
I am rather happy both with Libre Computer’s Le Potato, and with LibreELEC. Still, it is not a mature system, and the community consists only of a very few hobbyists. I do not expect Le Potato to become anything in terms of a Raspberry Pi replacement – for me it is just a cheap and versatile media center machine. If you’re out for something similar, Le Potato may be a consideration. If you are not fixed on the Raspberry form factor, there are more options, and I’d recommend to have a close look on them. Libre Computer itself will soon have a rival system, the Firefly/Renegade, based on Rockchip. I was not willing to wait for it, but when you read this post, it may be out there. And of course I’m really curious what Raspberry Pi v4 will offer when it is finally released!
One thing I’m sure I’ll miss at some point is xbian’s option to just apt-get anything. Always using docker will get annoying at some point. Especially as you’ve to take care to update the docker containers from time to time, adding another (virtual) system to think of.