Gpio-shutdown on Raspberry Pi Core device

I want to enable a “hardware” power-off / halt option for a custom RPi-based image (gadget mostly copied from the official pi-gadget). I have read blog posts as well as the gpio-shutdown overlay documentation, and added this to my config.txt (not yet pushed to the repo):

# config.txt
dtoverlay=gpio-shutdown

I connected a push-button to GPIO 3 + GND (pins 5+6 on the 40-pin header, see https://pinout.xyz). On a Pi 3B running my UC18 based image with the core18-gadget and the dtoverlay line, the button press does nothing. I also tried to short the two pins with a lead, just to rule out a broken button.

Has someone already implemented this, and I’m simply missing something?

like … actually nothing … i.e. not anything in dmesg ?
the documetation indicates that you need some userspace integration (systemd-logind), there is also a system option for ubuntu core:

but that indeed requires that the button press is physically recognized … if it is not recognized at all, that sounds like a bug with the overlay or the firmware …

(does it power up when you press the button ? (i guess thats a firmware only feature and would point more towards the devicetree overlay as the issue))

Thank you for providing some pointers! I had read the overlay docs about user space integration, but wanted to check first if that part is already working on Core :sweat_smile:

Here’s what I tested:

  • Ensured that config.txt contains dtoverlay=gpio-shutdown and that this overlay file exists as /boot/uboot/overlays/gpio-shutdown.dtbo
  • dmesg --follow running while pressing a pushbutton attached to pins 5+6 (GPIO 3 + GND): didn’t show anything
  • I had overlooked the system option, so I set system.power-key-action=poweroff and rebooted for good measure: Again, nothing in dmesg while I pressed the button.
  • Pressed the button while the Pi was powered off, with the overlay in config.txtdidn’t boot

So I guess it’s likely an issue with the device tree overlay itself, as you mentioned. I’ll run another check with another button and another Pi model.