Raspberry Pi Tools 12.0.0.0 removed GPIO support

  • Hello, i have an Element14 Pi Desktop case with a powerbutton on it.
    I recently updated to LibreElec 12.0.1 and now my shutdownscript does not work anymore.
    After some search i found that GPIO is not supported anymore and i need to switch to gpiozero.

    After a couple of hours fiddling around, trying to alter the script and even use chatGPT for coding help i gave up...


    Anyone wants to help me in creating a working script?

    My shutdown.py script used to look like this:

    with the help of chatGPT i got this output to convert it to gpiozero:

    But that gives errors in the debug log like:


    Anyone has some ideas? I hope i'm not the only one using a hardware case for Raspberry Pi with a power button :)

    • New
    • Best Answer

    The script itself is working, but you must add a workaround for lgpio. Please try that version:

  • Hi HarryH , thanks for sharing the workaround for the lgpio and the modified code.
    I just tried it and it works fine!

    LuRu i came across your post earlier but since i'm a novice Libreelec user i wanted to see if i could make it work without custom modifications to the official components.

  • @LuRu i came across your post earlier but since i'm a novice Libreelec user i wanted to see if i could make it work without custom modifications to the official components.

    The script you are editing is probably also an "official component", but I understand. :)
    I just don't understand the attitude of the authors on this issue. Why does every user (who uses RPi Tools) once they upgrade to 12 have to run into the same problem and solve it?
    Why did they recklessly break a thing that could continue to work without problems without the user having to change anything?

  • I do not believe that it was the intention of the developers/maintainers ... of LibreELEC was to break something. And the root cause is an edge case in the concept of how lgpio works and not a problem of LibreELEC.

    I know it's hard to accept, but if you look in detail, you'll realise that all modern operating systems try to protect themselves against malicious changes. This will also be the reason why most paths are in a read-only file system. lgpio should be able to handle this, but it doesn't automatically. Therefore the needed hint with the working directory.

    A customised addon version like the one you provide for users of older scripts as a starting aid is well-intentioned and also helpful for the initial approach. However, it also needs a maintainer for further updates of the included Python modules to ensure compatibility to new kernel versions, RPi hardware versions and so on. Some approaches such as rpi-lgpio are also only a compromise and do not behave identically to the widely used RPi.RPIO in 100% of the use cases. Especially in terms of performance (regarding this gpiozero seems the worst one, because it's a additional layer). So sometimes it is better to deal with the new variants like lgpio or gpiod (libgpiod) directly. Otherwise it's just a long languish.

    But that's just my own opinion...