08/29/2015 at 18:21 #104998
I’m experiencing an odd issue with psx/emulationstation. Whenever I start emulation station directly from the command line (through SSH on my pc) everything works fine:
However, when I start it through a homemade script the games from the psx emulator (and likely also all other emulators) won’t load. The screen will just go black for a few seconds and return to the emulator menu. I’ve made a very simple example in which it fails. A script called emulation.sh with the following content:
I then execute this script:
$ sh emulation.sh
Pi Model: 2B
Built from: binary
Retropie version used: I suppose it’s version 3.0 since I’ve downloaded and ran the script just 2 days ago.
USB devices connected: 2TB external harddisk, 2 usb playstation controllers
controller used: playstation controller
Error messages received: None
I have absolutely no clue what could possibly go wrong at this point. Any advice on what to look for?
08/31/2015 at 01:38 #105063
- This topic was modified 1 year, 7 months ago by thehoff.
your script is missing a slash (/bin/sh instead of bin/sh). Nothing logged in /tmp/runcommand.log ?
In case it’s related to the shell, does it make any difference if you use /bin/bash instead (rather than /bin/sh which is dash)08/31/2015 at 01:39 #105064
or launch it with bash scriptname – no point adding #!/bin/sh etc if going to launch via shell manually. just chmod u+x and launch without.08/31/2015 at 10:25 #105073
I don’t think the problem is related to the missing ‘/’. Emulationstation does start, so the script is executed properly. Furthermore,
/usr/bin/emulationstationwas part of a more complex script which did include the missing ‘/’ at the beginning of the script. I’ve also tried running it as both user ‘pi’ and as root.
Launching the script with bash instead of sh (and changing /bin/sh to bin/bash) did not make any difference. Emulationstation would launch properly, but the emulator would not.08/31/2015 at 14:38 #105097
as i said, you were launching the script manually via “sh script” so the first line is ignored. No point adding it at all if launching like that, but if you wanted to make it executable it needing fixing.
don’t run it as root, ES / our launcher script is not designed to be run as root (only the setup script).
you didn’t answer if there was anything saved in /tmp/runcommand.log
when you launch emulation station normally, it is actually launched from a script (in /usr/bin/emulationstation), so not sure what your problem might be. You are running on the system directly and not over ssh right ? Try launching from the pi itself – it’s not designed to be launched over ssh.09/01/2015 at 17:01 #105156
I’ve tried out a few more ways to start emulationstation. All commands are ran as user ‘pi’. I hope this gives you some more clarity:
start emulationstation locally from the commandline: Works fine. An empty runcommand.log is created at /tmp/. This is the only way I’ve seen a logfile being created.
Start emulationstation through SSH from my PC: Works fine.
Start emulationstation through SSH from a script using either bash or sh: Seems to work fine now, not sure if this was the case before.
Use Crontab to start emulationstation at boot: Black screen for few seconds, then returns to home menu.
Use Crontab to start a script to start emulationstation: Black screen for few seconds, then returns to home menu.
Use Crontab to start a script that sleeps for 60 seconds and then starts emulationstation: Black screen for few seconds, then returns to home menu.
Use add-on “Advanced Launcher” within Kodi to start emulationstation: Black screen for few seconds, then returns to home menu. Please note that this is the way I intent to start emulationstation. But any work-around would also be appreciated.09/01/2015 at 17:23 #105163
likely due to it not being attached to a TTY when launching via the other methods.
you could try adding
to it perhaps.
You can add extra logging to runcommand.sh by putting set -x at the top of the script (and perhaps adjust ES launching of it it to redirect all output to a file).
I can’t advise further without you producing some logs.09/01/2015 at 17:27 #105169
and make sure you are launching es from the binary directly and not our launch script to rule anything in that out.09/01/2015 at 19:06 #105191
It does indeed seem to have something to do with not being attached to a TTY. I added the following line to crontab:
@reboot bash /home/pi/emulation.sh > /home/pi/output.log 2>&1
When I try to enter a game in psx in emulationstation I get the following output in output.log:
TERM environment variable not set. Press a key (or joypad button 0) to configure launch options for emulator/port (lr-pcsx-rearmed). Errors will be logged to /tmp/runcommand.log /opt/retropie/supplementary/runcommand/runcommand.sh: line 667: /dev/tty: No such device or address /opt/retropie/supplementary/runcommand/runcommand.sh: line 696: /dev/tty: No such device or address Traceback (most recent call last): File "/opt/retropie/supplementary/runcommand/joy2key.py", line 43, in <module> tty_fd = open("/dev/tty", "w") IOError: [Errno 6] No such device or address: '/dev/tty'
Now, I do not know how to attach this process to a tty. Could you supply me with the correct commands? In crontab I tried:
@reboot bash /home/pi/emulation.sh < /dev/tty > /dev/tty
@reboot bash /home/pi/emulation.sh > /dev/tty
@reboot bash /home/pi/emulation.sh > /dev/tty0
09/01/2015 at 19:27 #105194
- This reply was modified 1 year, 7 months ago by thehoff.
I don’t think it will work without a controlling terminal as /dev/tty wont exist. I don’t really have time to dig further – runcommand requires that a controlling terminal exists. It’s not going to work from cron – if kodi is launched from terminal then it should be possible to get it to work – but I wouldn’t bother with the cron launching. if you are launching kodi that way, that will not work either
we launch emulation station from /etc/profile.d/09/01/2015 at 22:33 #105212
It took a while, but I’ve found an acceptable solution. The program script allows me to circumvent the non-existing tty problem. crontab now contains the following line:
@reboot script -c "bash /home/pi/startup_script.sh > /home/pi/media_output.log 2>&1"
startup_script.sh is a script that frequently polls whether my TV is on or not and checks a file for what program it should start when this is the case (currently limited to Kodi and Retropie).
Thanks for your help!
Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/