Hi all
I've set up a RPi 2 as an emulation box and want it to boot directly to snes9x (Super Nintendo emulator). More specifically, it's the pisnes project which runs better on the RPi.
It was working well when set up with autologin and running the emulator from .bash_login, but this was a fairly slow startup (17s). I got it down to 10s by removing autologin and moving the emulator startup script into a systemd service:
$this->bbcode_second_pass_code('', '
[Unit]
Description=Starts SNES Emulator
DefaultDependencies=false # Very important! Without this line, the s$
# would wait until networking.service
# has finished initialization. This could $
# more seconds because of DHCP, IP attribu$
[Service]
Type=simple
ExecStart=/root/snes.sh
WorkingDirectory=/root/
[Install]
WantedBy=local-fs.target
')
This works insofar as the service runs and the emulator starts. The problem is that the emulator segfaults when run this way. Here's the output I receive:
$this->bbcode_second_pass_code('', '
[root@alarmpi ~]# systemctl status snes
* snes.service - Starts SNES Emulator
Loaded: loaded (/etc/systemd/system/snes.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2016-12-10 01:11:08 UTC; 44s ago
Main PID: 268 (snes.sh)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/snes.service
`-268 /bin/sh /root/snes.sh
Dec 10 01:11:08 alarmpi systemd[1]: Started Starts SNES Emulator.
Dec 10 01:11:17 alarmpi snes.sh[268]: No ROM file header found.
Dec 10 01:11:17 alarmpi snes.sh[268]: /root/snes.sh: line 3: 332 Segmentation fault (core dumped) /pisnes/snes9x2p $NEWROM
')
The "No ROM file header found." is a normal output from the emulator and is not related to the error. The segfault, however, is clearly abnormal.
If I disable the service, log in as root and manually run the snes.sh script then it works fine. So I'm really at a loss as to how to establish why the segfault occurs when the emulator is launched from a service.
Thanks in advance for any help!