Reboot on AC Recovery and if Intentionally shutdown

  • Looking for a way to:

    • have LibreElec turn back on if power was lost and then recovered. Like AC recovery settings in BIOS of some machines
    • Hide shutdown option OR
    • Make it so that the device and OS power on if intentionally turned off


    Device: Raspberry Pi 5

    OS: LibreELEC/Kodi latest version

    The situation is: break room TV for employees that should always be on in the background. Trying to reduce calls to the helpdesk to power the device back on.

    Thank you in advance.

  • RPi5 will automatically boot when power is applied (cannot be changed to do otherwise) so the remaining challenges (in rough order of priority) will be:

    a) Ensuring uses don't shut-down the device. This is easily done with a skin hack to Home.xml, although LE makes that a little more complicated vs. a conventional distro as the default skin files are inside the read-only SYSTEM file. You need to clone the Estuary skin files to /storage/.kodi/add-ons/skin.custom and rename the skin add-on.xml (to avoid name-clash with the embedded one) before editing Home.xml to hide the button.

    b) Ensuring the configuration remains consistent. This can be done with an /storage/autostart.sh script which runs early in the boot process to remove the existing /storage/.kodi and replace with a known-good copy: e.g. setup the device, stop Kodi, then clone files from /storage/.kodi to /storage/.kodi-good and then restore /storage/.kodi-good to /storage/.kodi in the script.

    c) Ensuring the device always boots to a working LE install. This is mostly about avoiding SD card corruption from uninstended power off events (more about power-cord pulls than unwanted GUI shutdowns). Booting from USB or an NVME drive (needs an NVME HAT) are generally considered to be more reliable than SD.

    I'd probably do A only unless I really saw issues that needed B or C.

  • Thank you, chewitt , I will attempt A. Like you said, that should be good enough. I will also plug the Pi into an extension cord that has a switch so that if the Pi turns off, they can just flip the power switch and it will boot up again.

  • chewitt , I am using an Ubuntu terminal on my Windows machine to access the SD card files. It took me a while to figure out how to mount it so that Ubuntu could see it. Now I have it mounted in /mnt/d and running the 'file' command shows it is a squashfs filesystem etc etc. But I cannot see anything else. When I do 'ls' it says operation not supported. Do I just copy the whole contents of that directory into another one and then unsquash it? I'm confused. If you can't tell, I am a *nix and LibreELEC noob.

  • LE boots from two files: KERNEL (the kernel) and SYSTEM (userspace) .. the latter is expanded on boot to create a virtual (read-only) fileystem. If you look at the SD card directly you'll only see the two files (and some other RPi boot stuff). You can unsquash or mount the SYSTEM file, but it will be easiest to just boot the RPi5 normally and do things from inside LE, e.g. from a booted device you can do "cp -R /usr/share/kodi/addons/skin.estuary /storage/.kodi/addons/skin.custom" to clone skin files, then edit on /storage. Once you have cloned/renamed/selected the custom skin you can use kodi-send --action="ReloadSkin()" to live-test changes.

  • chewitt , thank you so much for your amazing help. I have SSH-ed into the pi and copied the skin into the directory you provided. I then renamed addon.xml to add-on.xml. Then I went into the xml folder where I found Home.xml and opened the file using nano. I am looking through it now, but I don't see where the power button is, and when I do find it, how do I make it hidden or unclickable?

    P.S. I will be making an in-depth how-to on this for beginners like me once I am finished.

    Again, thank you so much for your help. I know it is annoying because I ask very basic questions.

  • LE boots from two files: KERNEL (the kernel) and SYSTEM (userspace) .. the latter is expanded on boot to create a virtual (read-only) fileystem. If you look at the SD card directly you'll only see the two files (and some other RPi boot stuff). You can unsquash or mount the SYSTEM file, but it will be easiest to just boot the RPi5 normally and do things from inside LE, e.g. from a booted device you can do "cp -R /usr/share/kodi/addons/skin.estuary /storage/.kodi/addons/skin.custom" to clone skin files, then edit on /storage. Once you have cloned/renamed/selected the custom skin you can use kodi-send --action="ReloadSkin()" to live-test changes.

    chewitt , I have commented out the power button icon and saved the file. But I don't understand how to select the custom skin. I ran that command in the skin folder but it did not do anything because I'm obviously not doing it right.

  • From fuzzy memory .. You edit the addon.xml and change the skin id from skin.estuary to skin.custom and then either restart Kodi or reboot. You can then browse local add-ons to enable skin.custom (as the add-on should/will be disabled) and then you should be able to select it as the active skin in Kodi settings.