Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe Shutdown not working if emulationstation is not running #29

Open
arelas opened this issue Sep 11, 2018 · 13 comments
Open

Safe Shutdown not working if emulationstation is not running #29

arelas opened this issue Sep 11, 2018 · 13 comments

Comments

@arelas
Copy link

arelas commented Sep 11, 2018

Safe shutdown works fine when inside emulation station, but if you are at the terminal, it says:

rc.local[469] emulationstation: no process found

then the script just hangs. I'll attempt to bypass this to see if it doesn't detect emulationstation, it just moves on.

@crcerror
Copy link

caused by &&
If killall fails everything else fails

@arelas arelas changed the title Safe Shutdown not working is emulationstation is not running Safe Shutdown not working if emulationstation is not running Sep 12, 2018
@felleg
Copy link

felleg commented Sep 17, 2018

Workaround before the official fix:
sudo nano /opt/RetroFlag/SafeShutdown.py
Change line 19 to:
os.system("sudo shutdown -h now")
Change line 23 to:
os.system("sudo reboot")

Note: These changes will be overwritten if you re-run istall.sh and the SafeShutdown.py file is not already present in the retroflag-picase folder (the one from where you run the install code).

@crcerror
Copy link

@felleg Not a good idea, this will break safe shutdown.

Better use this:
https://github.com/crcerror/retroflag-picase

@felleg
Copy link

felleg commented Sep 17, 2018

@crcerror Oh, I assumed that doing sudo killall emulationstation was not "safe" to begin with. Do you suggest that the metadata information is safe when stopping ES with killall? In that case, then I agree, the script you linked is the better method.

@Tolaris
Copy link

Tolaris commented Nov 26, 2018

There is a much simpler fix: #36

Short version: in the os.system() calls in SafeShutdown.py, replace "&&" with ";"

@keilmillerjr
Copy link

sudo shutdown -h The halt should shutdown all running processes. I don’t understand why emulation station needs to be killed? I am using raspbian lite and removed the emulation station bit with no negative effects regardless if I have terminal, attractmode, or mame running. But I am no pro.

@Tolaris
Copy link

Tolaris commented Nov 26, 2018

@keilmillerjr That should work fine! My suggestion was "simpler" because it only changed a few characters from upstream, as compared to @crcerror 's fix which involved whole new scripts.

I suspect that either Retroflag doesn't know how shutdown works (kill and reap all processes), or they just wanted to be sure that emulationstation shut down before any timeouts. I doubt it matters and I'll be playing with this too.

Note that "shutdown -h" without an argument defaults to "shutdown -h +1", which waits 1 minute to fully halt. Why not use "now"?

@Stephenm64
Copy link

Stephenm64 commented Nov 26, 2018 via email

@Tolaris
Copy link

Tolaris commented Nov 26, 2018

Yikes, thanks for that warning, Stephen! I'll try "sleep 1; sync;" instead.

@keilmillerjr
Copy link

@keilmillerjr That should work fine! My suggestion was "simpler" because it only changed a few characters from upstream, as compared to @crcerror 's fix which involved whole new scripts.

I suspect that either Retroflag doesn't know how shutdown works (kill and reap all processes), or they just wanted to be sure that emulationstation shut down before any timeouts. I doubt it matters and I'll be playing with this too.

Note that "shutdown -h" without an argument defaults to "shutdown -h +1", which waits 1 minute to fully halt. Why not use "now"?

I use the now parameter. I left it out in my original comment because I felt it wasn’t pertinent to the conversation.

@crcerror
Copy link

crcerror commented Nov 27, 2018

@keilmillerjr @Tolaris The invoking of scripts is needed to make the reset button behaviour work. You can terminate the current running emulator by pressing the reset button. This is a better behaviour than just to reboot the system imho. Moreover this is a proof of concept how python can handle shell outputs - I was a bit overwhelmed of the positive user feedback.

There is nothing against using shell scripts it does not steal hardware resources. It's just a one shot call by python interrupt.

@Tolaris
Copy link

Tolaris commented Nov 27, 2018

@crcerror OK, that's a pretty fun script.

I had planned to implement something like your approach in pure python, mainly due to all the input validation challenges bash introduces. But you've already got some fun features (like restarting emulationstation in the "no emulator running" case), and working code wins. Thanks for writing this!

@crcerror
Copy link

@Tolaris You're welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants