• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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 12 Sept 2019, 18:36

    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?

    M 1 Reply Last reply 12 Sept 2019, 18:45 Reply Quote 0
    • M
      mitu Global Moderator @GrixSilva
      last edited by mitu 9 Dec 2019, 19:46 12 Sept 2019, 18:45

      @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.

      C G 2 Replies Last reply 12 Sept 2019, 18:49 Reply Quote 1
      • C
        cyperghost @mitu
        last edited by cyperghost 9 Dec 2019, 19:49 12 Sept 2019, 18:49

        @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 13 Sept 2019, 00:00 Reply Quote 0
        • G
          GrixSilva @mitu
          last edited by 12 Sept 2019, 23:53

          @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 13 Sept 2019, 00:00

            @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?

            M C 2 Replies Last reply 13 Sept 2019, 02:27 Reply Quote 0
            • M
              mitu Global Moderator @GrixSilva
              last edited by 13 Sept 2019, 02:27

              @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 13 Sept 2019, 09:14 Reply Quote 0
              • C
                cyperghost @GrixSilva
                last edited by 13 Sept 2019, 03:34

                @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 13 Sept 2019, 09:14

                  @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 13 Sept 2019, 10:01

                    @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.

                    C 1 Reply Last reply 13 Sept 2019, 13:39 Reply Quote 0
                    • C
                      cyperghost @GrixSilva
                      last edited by 13 Sept 2019, 13:39

                      @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 14 Sept 2019, 11:25 Reply Quote 0
                      • G
                        GrixSilva @cyperghost
                        last edited by 14 Sept 2019, 11:25

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

                        1 Reply Last reply Reply Quote 0
                        11 out of 11
                        • First post
                          11/11
                          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.

                          This community forum collects and processes your personal information.
                          consent.not_received