I am new to Raspberry Pi and am trying to use the headless shutdown module provided by Adafruit.

I downloaded the script of Adafruit-GPIO-Halt to my Raspberry Pi, installed it to the /usr/local/bin/gpio-halt file and even made a file on the system/system folder, following the steps on https://www.recantha.co.uk/blog/?p=13999.

However, the file in the systemd/system folder is getting saved with a .service.save extension and system prevents me from using the line sudo chmod 644 /lib/systemd/system/gpio-halt.service by saying, 'Permission denied.'

I would like to set-up the code to run on start-up. I am using Raspbian Version 9(stretch). Please help.

  • 1
    If you want help post a link to the module, and describe in detail what YOU did, not a link to an old tutorial for an obsolete OS. – Milliways Feb 18 at 3:18
  • Hi @Atharv Goel, Welcome and nice to me you. Ah let me see, the headless Rpi shut down trick has many variations, yours is not that newbie friendly because you need to install the newbie scary Git thing, and compile a hard to understand C program. I would suggest you to try a more newbie friendly, no Git, no compile, just a short python script. / ton continue, ... – tlfong01 Feb 18 at 5:04
  • 1
    Are you just trying to shutdown with a button? I thought you were referring to a power module NOT code. – Milliways Feb 18 at 5:08
  • The secret Rpi shut down trick needs to short/connect two Rpi GPIO pins, using a manual switch, or just a paper clip. There is also a David Copperfield like magic variation using a tilt switch, then you don't even need a paper clip, just TURN KEYBOARD UPSIDE DOWN and Rpi will switch off by itself. The trick is here: (1) Simple Shutdown Raspberry Pi Button by Using GPIO: instructables.com/id/… instructables.com/id/…. – tlfong01 Feb 18 at 5:14
  • 1
    Hello, for newer versions of Raspbian (like Stretch) the script/post you're linking to is no longer required as the same functionality is provided by the gpio-shutdown device tree overlay: raspberrypi.stackexchange.com/a/77918/93934 – Roger Jones Feb 18 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.