Where is the correct place for the Zero 2W to put in the gpio-poweroff dtoverlay load command?

I’m trying to get my Pi Zero 2W to raise a GPIO pin when powering down.
Nothing appears to be happening - the unit stays externally powered, suggesting my hardware does not detect the raised pin but in this case I would expect after 3s to see a kernal panic raised on the Pi.

I’m assuming that the correct file is /boot/config.txt (a symlink to /boot/firmware/config.txt) and have put the command (“dtoverlay=gpio-poweroff,gpiopin=4”) there.

One other possible cause of issues - my application on the Pi uses diozero java library (https://www.diozero.com/) to handle I2C messages.

Any help appreciated?

What command do you use to power down the device? reboot or halt will not assert the pin.

Just to be sure, did you connect the right pin? GPIO 4 is physical pin 7 (https://pinout.xyz/)

And did you activate i2c within dietpi-config?

AI also suggested :sweat_smile:
If the Java library exports GPIO 4 then gpio-poweroff can not take control over this pin. The overlay only works if the pin is unused.

I’ve tried “sudo shutdown now” and “poweroff”.

i2c is activated.

i have unmasked systemd-logind.

I don’t access the gpio pins via diozero, just i2c.

the pin assignment is correct - hardware engineer chose and built it.

it’s odd.

I have also installed device-tree-compiler to use dtc to check the device tree which does contain gpio-poweroff.

another weird thing - “dtoverlay -l” gives unknown command error in bash as if not dtoverlay not installed.