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

    kernel panic after shutdown

    Scheduled Pinned Locked Moved Help and Support
    kernel panicshutdown
    7 Posts 3 Posters 1.7k 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.
    • R
      roiko
      last edited by

      Pi Model: Zero 1.3
      Power Supply used: official Raspberry Pi Power Supply
      RetroPie Version: 4.5.1
      Built From: Pre made SD Image on RetroPie website - retropie-4.5.1-rpi1_zero.img
      USB Devices connected: Arduino leonardo used as gamepad

      When I shutdown through the menu I get e kernel panic after Reached target Shutdown.
      The same thing happens when I hit sudo shutdown on terminal and hangs there.
      It doesn't happen if I hit reboot.
      The message says
      Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
      Here is a picture of the screen.
      alt text
      I cannot provide logs because I don't have network access on my raspi.

      I tried another micro sd card with same results.
      I was trying to power it with a powerbank before my first install and I had many power losses until I found out the cable was damaged. Could these power losses have damaged my pi?
      Everything else is working fine (I think). What could this kernel panic mean?

      1 Reply Last reply Reply Quote 0
      • R
        roiko
        last edited by

        I found that this line
        dtoverlay=gpio-poweroff:gpiopin=“22”,active_low="y"
        in config.txt is responsible for that kernel panic. I read that other users have the same issue as well. Is this fixable? what is causing it?

        mituM cyperghostC 2 Replies Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @roiko
          last edited by

          @roiko That's more of a question for the Raspberry Pi forums - it looks like a configuration for the GPIOs on the Pi to pull down the 22 Pin on board poweroff.

          1 Reply Last reply Reply Quote 0
          • cyperghostC
            cyperghost @roiko
            last edited by cyperghost

            @roiko For what do you need this line? There are other solutions possible. Can you show me the guide that adviced you to add this? The usage of dtooverlays is a bit "unmodern" since there is system.d :)

            mituM 1 Reply Last reply Reply Quote 0
            • mituM
              mitu Global Moderator @cyperghost
              last edited by

              @cyperghost said in kernel panic after shutdown:

              The usage of dtooverlays is a bit "unmodern" since there is system.d :)

              Not really, it's meant to modify the GPIO's behaviour on shutdown, not the other way around. I guess it's meant for a safe poweroff circuit that can detect - via the GPIO - that the OS is stopped.

              1 Reply Last reply Reply Quote 0
              • cyperghostC
                cyperghost
                last edited by cyperghost

                @mitu I would rather put a file to system.d -- To be more exact to /lib/systemd/system-shutdown/

                from there you've full control over the GPIO.
                To every script placed in the above directory a system-parameter is parsed. If the system parameter is poweroffthen proceed with script and do something with the GPIO (set it low for example).

                I woule be your opinion if it's needed that the GPIO is set to high directly on power-on, but this parameter just tells to set GPIO low if the Pie shutdowns.

                A bare form of the script would be....

                #!/bin/bash
                [[ "$1" == "poweroff" ]] || exit
                poweroff_pin=22
                echo $poweroff_pin > /sys/class/gpio/export	
                echo out > /sys/class/gpio/gpio$poweroff_pin/direction	
                echo 0 > /sys/class/gpio/gpio$poweroff_pin/value
                

                You can also use python or wPi .... this would give you more and advanced features of course. I'm not sure if in @roiko's setup it is possible to easily export a pin just with bash.

                1 Reply Last reply Reply Quote 0
                • R
                  roiko
                  last edited by

                  This is indeed part of a safe shutdown circuit.
                  This pin needs to be HIGH while the raspberry pi is on and not change its state before shutdown process completes, because it drives the mosfet that provides power to the pi.
                  Thank you, I will try your script although I don't understand it.

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