Onoff Shim not restart

Hi ,

I just bought 2 cards OnOff Shim. When i plug it on my RPI (With Retropie) after run the one-line-installer :

  1. add micro-usb on shim, RPI direct start (but I have not pressed the button card yet…)
  2. After boot, I press button card and the RPI shutdown but the red light of the RPI
    is always on…
  3. I press the button for restart the RPI, but just the led of the OnOff Shim card turns on and the RPI does not start

I test 2 OnOffShim card, and i have exactly the same problem. I dont understand why the RPI card is already power on (the red led is constantly active).

Cheers for your help,


To confirm- are you powering your Pi through the OnOff SHIM? IE: Your power supply should be connected to the microUSB socket on OnOff SHIM and not the Pi.

If this is the case, what else do you have connected to your Pi?

My Pi is powering by OnOffShim. And nothing else is connected to the Pi.

I think the problem comes from the PI that always stays powered.

Here is a photo of the PI after shutdown, he is still powered :

No USB peripherals or anything plugged in?

Nothing plugged to Pi.

I reinstalled new retropie, and install only run the one-line-installer by curl (install without error).

I confirm that the same problems are occurring on my 2 onoffShim cards :

  • Auto-Start without push button, just after plug onoffShim
  • Shutdown retropie work but red led of Pi stays powered
  • Can’t restart with button, i must reconnect usb to onoffShim to restart.

It’s possible the software is either not installed correctly, or there’s something different in the new RetroPie that’s conflicting with it.

Do you have the file /lib/systemd/system-shutdown/gpio-poweroff

And what happens if you run:

sudo /lib/systemd/system-shutdown/gpio-poweroff poweroff

Yes I have this file.

Result :

Reading config file /etc/cleanshutd.conf
Using power off pin 4
Using LED pin 17

Running that should have instantly triggered a power off.

Do you have 1-wire enabled on BCM 4 or anything else that might be running/interfering with that pin?

Nothing else, just the OnOff SHIM. :(

I can’t think of anything else to try at this point - you should drop us an email to support@pimoroni.com referencing this thread, and stating your order number if you ordered directly from us. They’ll sort you out with a replacement!

Hello everybody!

Is there anything new to this topic? I’m having the exactly same problem…

Thank you!

What have you tried so far @Simon01? Could you post a photo of your setup?

On recent-ish versions of Raspbian it should be possible to get on/off functionality by adding these two lines to /boot/config.txt:


Thank you for your answer!

I’m sorry, I don’t have a photo at the moment. But it looks the same as above.

I use a raspberry pi 1 with the onoff shim (I bought two of them, but they both are not working). The USB cable is connected to the onoff shim. After pressing the button the pi boots up. If I press the button for one second while running, the pi shuts down. But the power LED on the pi is still red and the pi will not boot again if I press the button.

Then I added the lines you proposed to my config.txt file. Now it works, almost. The strange thing is if I try dtoverlay -l in the console, I get No overlays loaded. But after pressing the button the pi shuts down and the lights on the pi go out. It is without power then. But it is enough to press the button shortly, not one second as before, and the pi shuts down.

I don’t know why it is like that, but it is okay for me. On the weekend I will test it with my new pi 3.

Thanks again!

This is because the dtoverlay reads the power off button directly, and converts it into a KEY_POWER event, using a virtual keyboard. Raspbian responds to this immediately with no delay.

It looks like in your case the script that should run at shutdown to assert the power off pin was not running at all. I wonder if the location for this script has changed in newer versions of Raspbian, or if it’s just not working properly.

The dtoverlay method is generally better since it relies on software shipped with Raspbian- it’s a shame the shutdown key can’t have a delay though. That said there’s nothing stopping you from using gpio-poweroff to handle the actual powering off, and then our script to handle reading the shutdown button.

Ok, I did some more investigations. I installed the software for the onoff shim by downloading it from https://github.com/pimoroni/clean-shutdown as a zip file. I extracted the zip file on my Windows computer and transferred it to Raspbian via WinSCP. The problem is that - after extracting and copying - the file /daemon/lib/systemd/system-shutdown/gpio-poweroff lost its executable bit. Everything works perfectly if I set it manually. A fix would be to add to the setup.sh file in the repository

sudo cp ./daemon/lib/systemd/system-shutdown/gpio-poweroff /lib/systemd/system-shutdown/gpio-poweroff
sudo chmod +x /lib/systemd/system-shutdown/gpio-poweroff

The second line is currently missing!

So I’m happy with the shim, everything works now as expected

1 Like

It seems I have the same or a very similar problem.

I run a Pi4 with the AZDelivery GPIO triple expansion, a Hifiberry DAC (amp) and a couple of GPIO wires to LEDs and buttons. None of the SHIM’s pins are blocked by other hardware. The Pi is powered through the SHIM.

Following the advice on this thread I’ve come to the point where the external button connected to the SHIM (as well as the SHIM’s onboard button) can initiate a shutdown which results in peripherals powered off, 10 flashes of the green LED on the Pi and then the steady red LED.


will trigger three flashes of the Button’s LED and output

But nothing else … no shutdown.

I’m not bothered by the latter as the button can actually trigger the shutdown.


I can’t get the Pi to power up via the button. I have to reconnect power to restart the Pi.

I don’t suspect the hardware is at fault. Voltage is fine too, I can output audio via the Hifiberry amp. It must be software. I’m using the latest Raspberry Pi OS light (no GUI) headlessly.

Any ideas?

The Red LED should go out, the fact that it doesn’t means the on off shim isn’t removing the power to the Pi. If it had done that, pressing the button would power it back up and it would then boot up.

wow that was a quick response!

Thanks for clearing that up (expected behaviour of the Pi’s red LED).

when I add

to /boot/config.txt, at the push (not hold) of the button ssh will disconnect and the Pi’s LEDs go out. However, the button’s LED (and another USB peripheral) remain lit. Another push doesn’t wake up the Pi.

I’m at a loss. Clearly it’s a configuration or compatibility (Pi4/raspios) issue.

The dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1 will have the Pi do a proper shutdown. And the dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1 will kill power to the Pi, and pull GPIO 4 low. If the on off shim doesn’t remove power to the Pi, it will just stay in its current off state. Your issue is that the on off shim isn’t actually turning off?
Did you solder the shim to the Pi or solder a header to the shim?

the shim is soldered to a header, which is itself placed on the middle row of the gpio extension board. the hifiberry sits on another row (confirmed working) and the third row is populated with led, button and oled wires.

the whole assembly is powered through the shim.

when the pi is on and I push or hold the button (or sudo halt):

with the two aforementioned lines added to /boot/config.txt the pi appears off but the button’s LED remains on and a usb-connected device still is powered. the pi’s LEDs are off but pushing the button lights up the shim’s red LED.

without the two lines in /boot/config.txt the pi will shut down with the shim’s button dark and the usb device off. the pi’s red led remains on and pushing the button will light up the shim’s red led.