RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    CHMOD: Operation not permitted

    Scheduled Pinned Locked Moved Help and Support
    powerbuttonchmodpermissions
    11 Posts 3 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      GrixSilva
      last edited by

      Hi!

      I would like to add a power button to my raspberry pi 3b+, I have installed retropie 4.5.1 and I'm following this tutorial:
      https://www.makeuseof.com/tag/add-power-button-raspberry-pi/
      But when I type this line on the terminal:
      chmod a+x shutdown-press-simple.py

      I get the messege:
      chmod: changing permissions of 'shutdown-press-simple.py': Operation not permitted

      Does anyone have a fix for this?

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @GrixSilva
        last edited by mitu

        @GrixSilva said in CHMOD: Operation not permitted:

        Does anyone have a fix for this?

        Since you used sudo to start the editor, the file was created with owner=root. TL;DR - use sudo to run the command

        sudo chmod ....
        

        EDIT: btw, the tutorial has a small error - in the /etc/rc.local file you should add the full path to the script.

        cyperghostC G 2 Replies Last reply Reply Quote 1
        • cyperghostC
          cyperghost @mitu
          last edited by cyperghost

          @mitu But to be true the www instruction is awfull ;)

          1. would change rc.local to /opt/configs/all/autstart.sh
          2. Use annother GPIO, to make powerdown and restart work ;)
          3. @mitu is always right ;)

          @GrixSilva You can read this instructions to have more fun with just one button. With this setup you can also switch ON the Pie ;)
          https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi

          G 1 Reply Last reply Reply Quote 0
          • G
            GrixSilva @mitu
            last edited by

            @mitu
            Thanks for the help, the chmod command has been accepted, but this way of adding the power button didn't work, maybe I add the wrong rc.local path.
            So I decided to follow the advice of @cyperghost and follow this guide:
            https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi
            It seems to be a more explicit guide.

            1 Reply Last reply Reply Quote 0
            • G
              GrixSilva @cyperghost
              last edited by

              @cyperghost
              I followed all the instructions, I just changed:

              GPIO.setmode(GPIO.BCM)
              GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
              GPIO.wait_for_edge(3, GPIO.FALLING)

              to:

              GPIO.setmode(GPIO.BCM)
              GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
              GPIO.wait_for_edge(21, GPIO.FALLING)

              because I was already using gpio3 pin for the fan.

              This time the switch works, but only turns off the raspbery py, it doesn't turn it on.

              Do you know what it could be?

              mituM cyperghostC 2 Replies Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @GrixSilva
                last edited by

                @GrixSilva said in CHMOD: Operation not permitted:

                Do you know what it could be?

                Make sure you're using the same 2 GPIO pins (5 and 6) for your button as described in the video.

                G 2 Replies Last reply Reply Quote 0
                • cyperghostC
                  cyperghost @GrixSilva
                  last edited by

                  @GrixSilva As I wrote in my last posting, the guide you've found is awful - full of command mistakes.

                  1 Reply Last reply Reply Quote 0
                  • G
                    GrixSilva @mitu
                    last edited by

                    @mitu
                    In the video they use pin 5 and 6 (GPIO 3 and GROUND) to install the button, but in my setup I have a fan install on pins 4 and 6 (5V and GROUND), Thats why I changed this code from the instructions:

                    GPIO.setmode(GPIO.BCM)
                    GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
                    GPIO.wait_for_edge(3, GPIO.FALLING)

                    to:

                    GPIO.setmode(GPIO.BCM)
                    GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
                    GPIO.wait_for_edge(21, GPIO.FALLING)

                    To connect my button to pins 39 and 40 (GND and GPIO 21), the problem is my PI only turn off, it doesn' turn on.

                    I must say I don't understand much about the GPIO pins , maybe the connections aren't compatible with the system, I dont know. xD

                    If you have any sugestions, I would like to know!
                    Thak you anyways! :)

                    1 Reply Last reply Reply Quote 0
                    • G
                      GrixSilva @mitu
                      last edited by

                      @mitu
                      I SOLVED THE PROBLEM!!!

                      My problem was my confusion! XD
                      With my fan installed, I was using pin pin 4 and 6, I forgotte I don't need to use the same GND pin, so I connected my button to pin 5 and pin 39 (GND) now it works!

                      Althouth, I noticed If I disconnect the power supply and then connect it again, my pi will turn ON automatically, ignoring the button. The button only works if the PI is always being powered.
                      Is there a workaround?

                      If I don't disconnect the power supply, my fan doesn't stop. Or maybe there is a way to turn OFF my Fan once I turn OFF my PI.

                      cyperghostC 1 Reply Last reply Reply Quote 0
                      • cyperghostC
                        cyperghost @GrixSilva
                        last edited by

                        @GrixSilva said in CHMOD: Operation not permitted:

                        Is there a workaround?

                        No not with a simple button.

                        You can use the Powerblock device or a dedicated case from Retroflag to make this work.

                        G 1 Reply Last reply Reply Quote 0
                        • G
                          GrixSilva @cyperghost
                          last edited by

                          @cyperghost
                          Thank for the advice, I'll see what I can do! :)

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.