GPi case safe shutdown problem



  • Hello,

    I've noticed some problems with the safe shutdown used in the GPi case. When I power off the Recalbox using the console switch, looks like some options are not saved correctly and fails. For example, If I deactivate the Wifi and then I shutdown the console, then on startup the Wifi option is "Off", but the wifi connection is enabled and connected. This doesn't happen if I shutdown the console using the "Shutdown" option in Recalbox and then I power off the switch.

    I've seen that the shutdown command in the python script is "shutdown -r now", so I want to know if there is any way to do a normal recalbox shutdown from command line to allow it to save all the options before power off all.

    Thanks!!


  • Global moderator Translator
    Translation Master
    Tester
    Global moderator

    @Danixu86 I don't have a GPi case to test, but I haven't seen a similar report from any other user.

    • What's your version of Recalbox (say the version, don't say "the last one")?
    • Did you build your Recalbox yourself, or download a ready-made image from the internet, or did you buy everything ready?
    • Can you try with a clean install of the latest official version?

    Maybe this will help:



  • Hello,

    Thank you for your response.

    My Recalbox version is 7.1.1. Was installed using the oficial image and is almost clean (I just added some bios and roms, but no much more). Is the latest and was reinstalled a few days ago, but I'll try to create a new one with just the Recalbox clean installation.

    Best regards.



  • Hello,

    I've installed a clean Recalbox 7.1.1 image and after the first boot installation I've entered into Network Settings and I've configured the Wifi connection. Later I've just powered off the GPi case using the switch, and after recalbox boots I've enter into network settings. The wifi is "On" but not connected, and if I disable and reenable the Wifi it connects as usual. If I power off the GPi case using the switch the problem is always there until I enter into the Quit menu and use the "Shutdown System" option. Powering off the console using the Quit menu solve the problem and then the Wifi is activated automatically on next boots. Also the "Fast Shutdown" option seems to works and of course the reboot option.

    The same happens if I disconnect the Wifi. I have to power off the console using the menu option at least the first time to save the Wifi status. Of course, I don't know if something else is not saved using the switch, so I'm using always the quit menu.

    Best regards.


  • Global moderator Translator
    Translation Master
    Tester
    Global moderator

    @Danixu86 As I said, I don't have a GPI case, but I did some research, and I have the impression that you're confusing the POWER switch (which is at the top of the conole) with the Safe Shutdown Switch (which stays with the batteries), isn't that it?

    https://recalbox.gitbook.io/documentation/v/francais/usage-basique/preparation-et-installation/boitier-retroflag-gpi

    image 1

    image 2



  • Hello!, thanks for your response.

    Not really. The safe shutdown button of the back just enable or disable the safe shutdown feature when you switch off the top power button. If it is disabled, the top button just power off the RPi like a normal switch (which can lead to filesystem corruption), but when is enabled (like I have it), it calls an script that must be installed trough a signal to a GPIO pin, and this script executes a "Safe Shutdown" just running the command "shutdown -r now" if I'm not wrong. On Recalbox this script is already installed so I don't have to install it, and I'm sure that is almost working because recalbox is shutted down before the console is powered off.
    The problem is that there is something in the method that recalbox is closed that doesn't allow it to save some things, like for example the wifi configuration. Maybe related with linux shutdown method that closes some programs without wait (an example is Chrome, if you have chrome in a linux system opened and you poweroff the computer, linux doesn't wait to Crome to close and just kill it). That's why I was asking if there is any way to close the ES saving its configuration, or at least force it to save it, to modify the "Safe Shutdown" script and run it before the shutdown command.

    Thanks!!



  • Hello,

    Is strange, because I've took a look into the safe shutdown script and is improved compared to the original script, and this script seems to quit ES first:

                    # Tell EmulationStation to quit demo/mode and/or to exit gracefully
                    try:
                            import os
                            try:
                                    os.makedirs("/tmp/externalnotifications")
                            except: pass
                            with open("/tmp/externalnotifications/emulationstation.quitnow", "w") as sf:
                                    sf.write("exit")
                                    sfush()
                                    sf.close()
                    except IOError:
                            pass  # Can't wait or retry
    
                    # Quit emulationstation gracefully
                    parent.terminate()
                    print("Emulationstation terminated")
    

    So now I'm not sure why is failing and why if I power off the ES manually works, and with the SS script some weird things happen...

    Best regards.



  • Sorry for triple post... I'm not able to edit the above messages.

    Looks like I've found the problem, and is related to the way the Safe Shutdown script powers off the RPi.

    On the SS script located in /recalbox/system/hardware/case/installers/gpi/assets/recalbox_SafeShutdown_gpi.py there is a line that reboots the RPi when ES is killed:

    os.system("reboot -f")
    

    With this the shutdown is much faster because doesn't wait until the SO is ready (is like pressing the reset button, so I don't know if is dangerous), but looks like some things are not saved correctly. Changing this line to the original shutdown command is a bit slower (but much less than retropie 😅 ), but all seems to works fine.

    os.system("shutdown -h now")
    

    I've tried several times to power off using the Switch to see if fails again, and now seems to be working fine.

    I don't know if I have to report this problem on the Gitlab repository...

    Best regards.


  • Global moderator Translator
    Translation Master
    Tester
    Global moderator

    @Danixu86

    I'm not able to edit the above messages.

    Yes, there were a lot of problems with users changing what they said and confusing other people, so the edition is limited, but since you're not doing SPAM, don't worry.

    I've found the problem

    I'm glad you solved it!

    I don't know if I have to report this problem on the Gitlab repository...

    I believe it is very interesting if you can do that, here is the link:
    https://gitlab.com/recalbox/recalbox/-/issues



Want to support us ?

228
Online

82.6k
Users

22.8k
Topics

164.4k
Posts