Emulationstation Shutdown Script
-
@GaM3r2Xtreme The script makes me believe that ES creates these files at some poin of its lifetime:
/tmp/es-restart
,/tmp/es-sysrestart
and/tmp/es-shutdown
.Translating the script to english:
Ifes-restart
exists, it restarts ES only. If doesn't exists...
...Ifes-sysrestart
exists, it restart the system. If doesn't exists...
...Ifes-shutdown
exists, it turn off the system, If doesn't exists...
finish the script.So, I think that your emulationstation is failing in creating those files at
/tmp
. Check if those files exist while ES is running. -
The second script is the one I was meaning. The shutdown and restart commands from the quit menu are processed by that script. If you want to test it remove the sudo reboot from the above script then select restart from the menu. Nothing should happen.
Cheers
Paul
-
Hey @meleu and @PaulCheffus,
So I was able to figure out when
/tmp/es-restart
,/tmp/es-sysrestart
, and/tmp/es-shutdown
are created.Right after bootup, these files are nonexistent. I ran an SSH connection and started up emulationstation, after which checking the
/tmp/
directory and concluding that the files still have not been created. Instead, the moment I choose a quit option from the Quit menu, a corresponding temp file is created.Each selection creates the following:
"Restart Emulationstation" creates/tmp/es-restart
"Restart System" creates/tmp/es-sysrestart
"Shutdown System" creates/tmp/es-shutdown
"Quit Emulationstation" creates nothingI'm curious to see if those if statements are correctly written within the above scripts, as it appears that the
/usr/bin/emulationstation.sh
will call/opt/retropie/supplementary/emulationstation/emulationstation.sh
near the end right after thetput civis
line. If they are incorrect, then the default will always be to break out of the while loop and end everything, ignoring anything selected in the Quit menu.Although, the second script may not be executing at all. I've noticed that all the temp files stay around after every restart of emulationstation.
rm -f /tmp/es-restart /tmp/es-sysrestart /tmp/es-shutdown
is called right before the emulationstation binary is called, which should delete anything that exists in the/tmp/
folder before emulationstation starts. Maybe there is some sort of write protection going on that prevents this command from executing. This is all so confusing...May I ask, does anyone else have this shutdown/restart issue as well? Do these Quit commands work ok for others? If so, are you using one of the pre-made RetroPie images or was retropie build via the github page?
-
@GaM3r2Xtreme
May I ask if you are using one of the pre-made RetroPie images or build it via the github page?Try to describe your environment in details.
-
I should have added this to the end of my last post.
I'm currently using the DietPi v136 OS, which is a bare-bone Raspbian distribution. I'm using this in order to limit background processes and maximize processing towards emulating. Plus, I can fit all that I need on a 2GB card.
Right after flashing the OS onto a card, I followed the manual installation from the wiki in order to install Retropie from the github repository. I've gone through the setup and installed all the core packages, along with a limited amount from the main packages. Everything works great, and games run fine. It's just the shutdown causing issues I'd like to understand.
There might be some write protections going on within the OS. If that's the case, I'll contact the forum group over there and see if they might have some insight.
But first, I'll see about modifying the scripts and throw a few echos around to see what might be happening. I will also try one of the pre-made images and also building from github onto a Raspbian image.
-
@GaM3r2Xtreme my first shoot would be in
/etc/sudoers
.Like detailed here: https://github.com/retropie/retropie-setup/wiki/RetroPie-Ubuntu-16.04-LTS-x86-Flavor#section-31-emulationstation-hangs-if-shutdownrestart-was-selected
-
Oh, I just found something @meleu. Apparently when I type just emulationstation within the terminal and hit enter,
/usr/bin/emulationstation
is NOT called, but something else is.Now if I force the terminal to execute
/usr/bin/emulationstaiton
and then select one of the Quit options, it works. I successfully rebooted the system.Let me check and see what is in the
/etc/sudoers
. I should note that DietPi normally runs under the root user (there is no pi user setup by default). -
Type
which emulationstation
. Note you won't benefit from any better performance running dietpi. Just more likely to have compatibility issues.Please check the link in my signature when asking for help as it saves time if we have all the information about your setup.
-
Adding the extra line of code within
/etc/sudoers
didn't seem to do the trick, but thanks for the suggestion to check it out.I did use
which emulationstation
which returned/usr/bin/emulationstation
. The funny thing is that/opt/retropie/supplementary/emulationstation/emulationstation
is executed directly instead via theemulationstation
command, but not the/user/bin/emulationstation
. This is all based on what I see in the resource monitorhtop
.Would it be possible to change what file is executed with the
emulationstation
command? If so, I would think this would be the solution I'm after.On a side note, I'll make sure to post system information if I have any other issues and open another thread.
-
Yes, if you find out why that is being launched directly - the which command shows which is being launched if you just type in emulationstation unless there is a system alias in place - type
alias
.also check:
/usr/bin/emulationstation
should just be a script which launches/opt/retropie/supplementary/emulationstation/emulationstation.sh
which in turn launches/opt/retropie/supplementary/emulationstation/emulationstation
If there is an alias - it must be added by dietpi and you should report the issue there - dietpi is not officially supported by retropie.
-
I just saw the thread you have over at the dietpi forums. I see from their code, they are launching is incorrectly at startup. They also do set an alias
You will need to ask them to change this. I can't really help if they are not using our launch scripts.
-
I think you found the issue @BuZz. And yeah, I started a thread with dietpi awhile back and revived it to point out what was found here. I suggested a solution to their auto start script, but never noticed the system alias you found. Both might need a little tweaking, but that's up to those guys if they want to do this.
As far as I'm concerned, a solution was found for the issue I was having. Thanks again for all the help everyone.
-
@PaulCheffus
I am curious about your custom EmulationStation.sh script to shutdown using your ATXRasPi PCB. I have some old power/reset switches that came out of some old PCs and I currently have 1 switch to turn on & off my Pi (gracefully) and I have a 2nd switch I want to use to restart ES (and maybe a 3rd one to exit the currently running emulator). Could you post your script because I'm not sure exactly how I was going to do the ES restart code. -
@backstander
HiThe script doesn't use extra buttons as it is for shutting down from the emulationstation menu. It requires a bc337 transistor and a 1k resistor with the emitter and collector of the transistor connected across the existing switch. The 1k resistor goes between one of the GPIO pins and the base of the transistor.
When I have the laptop out next I'll post the scripts.
ES_Reboot.sh
ES_Shutdown.sh
Cheers
Paul
-
Has anyone figured out how to get the shutdown system option working from windows version of ES?
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.