LibreELEC

From MattWiki
noteThis Page was written with LibreELEC 12.0.x in mind, and may not work correctly with other versions or distributions.


LibreELEC Logo

LibreELEC (short for Libre Embedded Linux Entertainment Center) is a non-profit fork of OpenELEC as an open source software appliance, a Linux-based Just enough operating system for the Kodi media player. This fork of OpenELEC announced in March 2016 as a split from the OpenELEC team after "creative differences", taking most of its active developers at the time to join the new LibreELEC project.[1][2][3][4] This is a conservative fork of the OpenELEC project with a stronger focus on pre-release testing and post-release change management.[4]

Building LibreELEC

Building The LibreELEC image.

Installing

Media Drive Management

Kodi is unique in that it allows both local media sources and networked media sources. LibreELEC allows for the management of local hard drives attached (usually via USB) to the embedded system. Below are a few commands on managing local hard drives attached to your LibreELEC system.

Allow Mounted Drives to Sleep

Note Note: The LibreELEC plugin virtual.system-tools must be installed for this section to work.
Put Mounted Drives to sleep automatically via boot script

Start by get your external HDD name:

cat /proc/mounts |grep sd[abcd]

Next create/edit an autostart script

vim /storage/.config/autostart.sh

Set acoustic and power management functions for a single drive (sda):

#!/bin/bash
( /storage/.kodi/addons/virtual.system-tools/bin/hd-idle -a sda -i 900 -l /storage/.kodi/temp/hd-idle.log )&

Or, you can set acoustic and power management functions for multiple drives at once:

#!/bin/bash
( /storage/.kodi/addons/virtual.system-tools/bin/hd-idle -i 900 -a sda -a sdb -l /storage/.kodi/temp/hd-idle.log )&

where parameters are:

  • a - is the drive location
  • i - is the amount of time in seconds to wait to spin down the drive
    • 15 minutes = 15*60 = 900

For more information on hd-idle, see the hd-idle github page.

Confirming the drive will sleep

After rebooting the system, you should see that the new script is running by running the following:

ps -eaf |grep hd-idle
Put Mounted Drives to sleep (Now)

If you wish to put a drive to sleep immediately; run the following command.

hdparm -Y /dev/sda

From the man file:

-Y     Force  an  IDE  drive  to  immediately  enter  the  lowest power
       consumption sleep mode, causing it to shut down  completely.   A
       hard  or soft reset is required before the drive can be accessed
       again (the Linux IDE driver will automatically handle issuing  a
       reset  if/when  needed).   The  current power mode status can be
       checked using the -C option.

Format a new Data Drive

LibreELEC may work with other formats, but is designed to be used with ext4. Formatting the drive will delete all data on the drive.

umount /dev/sda1
mkfs.ext4 /dev/sda –L Data1

Once the formatting is complete, reboot the system. After the system as been rebooted, it will be mounted as /var/media/Data1.

Change Mounted Drive Name

LibreELEC uses the drive label for the name of the mounted drive (assuming the drive has a label). To change the drive label try:

For NTFS formatted drives:

umount /dev/sdb1
ntfslabel /dev/sdb1 "new_name"

For ext2/ext3/ext4 formatted drives:

e2label /dev/sdb1 new-label-name-here

Commands

To update the library

kodi-send --action="UpdateLibrary(video)"

To delete items that are no longer on the drive

kodi-send --action="CleanLibrary(video)"

Export Library items

kodi-send --action="exportlibrary(video,true,true,true,true)"

To View the Kodi.tv logs

tail -f /storage/.kodi/temp/kodi.log

View CPU Temperature

bcmstat.sh

Rebuild the video database

for DIR in TV_Shows Movies
do
   find . -type f -name *.nfo -delete
   find . -type f -name *.txt -delete
   find . -type f -name *.exe -delete
   find . -type f -name *.jpg -delete
   find . -type f -name *.png -delete
   find . -type f -name theme.mp3 -delete
   find . -type d -name .actors -delete
   find . -empty -type f -delete
   find . -empty -type d -delete
   cd ../
done

Custom EDID

EDID (Extended Display Identification Data) is a metadata format for display devices to describe their capabilities to a video source (e.g. Kodi). The data format is defined by a standard published by the Video Electronics Standards Association (VESA).[5]

To change the order of turning on your devices (normally your HTPC has to be powered on last) or to use your LibreELEC device without the TV turned on, you need to dump/save the EDID information from your TV (or AVR).[6]

getedid create

RTC (Real Time Clock)

These instructions are for the DS3231 RTC modules[7]

  1. Remount the system partition as read/write: mount -o remount,rw /flash
  2. Edit /flash/config.txt and add (somewhere near the end): dtoverlay=i2c-rtc,ds3231
  3. Remount the system partition as read only: mount -o remount,ro /flash
  4. Reboot the system for the changes to take affect


References

  1. Chewitt (24 March 2016). "Let's rock this gig!". libreelec.tv. Retrieved 1 May 2016. 
  2. Chewitt (20 March 2016). "Hello World!". libreelec.tv. Retrieved 12 May 2016. 
  3. "About LibreELEC.tv". libreelec.tv. 2016. Retrieved 12 May 2016. 
  4. 4.0 4.1 "LibreELEC.tv". GitHub. Retrieved 12 May 2016. 
  5. "Extended Display Identification Data". 2023-03-29. 
  6. "EDID". LibreELEC WIKI. 
  7. "forum.libreelec.tv". DS3231 Real Time Clock installation guide for RPi / /LE8. frankvw. 2018-12-17. Retrieved 2022-11-10.