autostart.sh don't work with new version 11

  • I updated Libreelec to latest vesion 11 but my autostart.sh don't work after this update. In the old version was working. For me not clear what's wrong.

    I have this autostart.sh to swith a gpio signal from the Rpi4:

    Bash
    #!/bin/bash
    #   Exports pin to userspace
    echo "17" > /sys/class/gpio/export
    
    # Sets pin 17 as an output
    echo "out" > /sys/class/gpio/gpio17/direction
    
    # Sets pin 17 to high
    echo "1" > /sys/class/gpio/gpio17/value

    this files I have in the /storage/.config folder

    Please can you help what's wrong ?

    Thanks

  • Hi,

    As first step, you should try these commands one by one in a SSH terminal. Maybe you will get some error message (what's not visible when run from autostart.sh)...

  • Bash
    #!/bin/bash
    (
    sleep 10
    echo "17" > /sys/class/gpio/export
    echo "out" > /sys/class/gpio/gpio17/direction
    echo "1" > /sys/class/gpio/gpio17/value
    )&

    ^ see if that works then? .. if it does there's a timing issue and you should switch to a system.d service and schedule the events properly in the userspace boot sequence (autostart.sh is a rather blunt tool).

  • so my autostart.sh looks like this:

    Bash
    #!/bin/bash
    (
    sleep 10
    #   Exports pin to userspace
    echo "17" > /sys/class/gpio/export
    # Sets pin 17 as an output
    echo "out" > /sys/class/gpio/gpio17/direction
    # Sets pin 17 to high
    echo "1" > /sys/class/gpio/gpio17/value
    )&

    But it doesn't work

  • ok, what is correct formating ? Same autostart.sh I used in my old libreelec v10 installation without any problem. Strange. So what to change ?

  • tried other instruction :

    Code
    LibreELEC:~/.config # sh ./autostart.sh
    : Permission deniede 3: can't create /sys/class/gpio/export
    : nonexistent directory can't create /sys/class/gpio/gpio17/direction
    : nonexistent directory can't create /sys/class/gpio/gpio17/value
    : not found.sh: line 8:
    LibreELEC:~/.config #
  • "Permission deniede 3: can't create /sys/class/gpio/export"

    Should be checked the owner and permission of that autostart.sh file.

    Try with SSH: ls -l ~/.config/autostart.sh

  • Owner and permissions are never an issue as 'the' user in the OS is root and we deliberately execute bash and call the script to avoid the need for users include a shebang or make the script executable. And.. the problem was already resolved.