Vegz78 / McAirpos

MakeCode Arcade games in RetroPie, Recalbox 7/8 and Batocera, running natively as ELF executables on Raspberry Pi OS/Linux ARM with 1-2 gamepads
https://Vegz78.github.io/McAirpos
MIT License
80 stars 10 forks source link

Permissions error(game_file.elf must be executable) #2

Closed robertjdominguez closed 3 years ago

robertjdominguez commented 3 years ago

🕹️ Great addition to RetroPie!

I encounter an error when trying to launch a game from either the terminal or emulation station. The output below was logged when trying to run it from the terminal and I believe matches the errors thrown when launching from emulation station. Any thoughts? Possibly related to your previously closed issue?

sh: 1: /home/pi/RetroPie/roms/makecode/ballards_birds.elf: Permission denied
warn: ioctl KDSETMODE failed: Inappropriate ioctl for devicehead: cannot open '/tmp/pxt-pid' for reading: No such file or directory
head: cannot open '/proc//comm' for reading: No such file or directory
pgrep: no matching criteria specified   Try `pgrep --help' for more information.pgrep: no matching criteria specified   
Try `pgrep --help' for more information.
Usage: killall [ -Z CONTEXT ] [ -u USER ] [ -y TIME ] [ -o TIME ] [ -eIgiqrvw ]
               [ -s SIGNAL | -SIGNAL ] NAME...
       killall -l, --list
       killall -V, --version
  -e,--exact          require exact match for very long names
  -I,--ignore-case    case insensitive process name match
  -g,--process-group  kill process group instead of process
  -y,--younger-than   kill processes younger than TIME
  -o,--older-than     kill processes older than TIME
  -i,--interactive    ask for confirmation before killing
  -l,--list           list all known signal names
  -q,--quiet          don't print complaints
  -r,--regexp         interpret NAME as an extended regular expression
  -s,--signal SIGNAL  send this signal instead of SIGTERM
  -u,--user USER      kill only process(es) running as USER
  -v,--verbose        report if the signal was successfully sent
  -V,--version        display version information
  -w,--wait           wait for processes to die
  -n,--ns PID         match processes that belong to the same namespaces       
                      as PID
  -Z,--context REGEXP kill only process(es) having context
                      (must precede other arguments)

input-create: no process found
warn: ioctl VT_UNLOCKSWITCH failed: Inappropriate ioctl for device
warn: ioctl KDSETMODE failed: Inappropriate ioctl for device      
warn: ioctl KBSKBMODE failed: Inappropriate ioctl for device 
Vegz78 commented 3 years ago

Hi Robert, sorry it doesn’t work for you and thanks for your feedback. I haven’t seen this one before, but a friend on another system and I just recently on a fresh Rasbian Lite installation encountered some permission issues, which I tried to fix yesterday(and worked on the fresh image and mye regular installations)... Did you update the repo to the last commit?

Could you please tell me which OS image and version, and hardware you are running on, so maybe I could try and reproduce it? A copy of your game file uploaded here, could also help.

It’s also important that your user(normally pi), has write permissions to the /sd folder, the /tmp folder and the the folder where the game files are stored(normally ~/RetroPie/roms/makecode), as both the McAirpos launcher and the game writes to /sd, and the game writes a data folder inside the same folder and with same name as the game file and some files to /tmp.

From what I can gather from the error log without further investigation: -Line 1: There is a permission issue with game file or folder -Line 2 and last 3: ioctl fails for setting different terminal modes(haven’t seen this before, you are not running terminal OR RetroPie from a X windows session?) -Line 2: head fails for /tmp/pxt-pid file, game probably never started to create this file, or other permission or other issues with file or /tmp folder -Line 3: head fails for /proc//comm: cannot find process file, since (game)process never started -Line 4: pgrep fails because it cannot find any (game) process -Line 4 from the end: input-create fails, probably because everything needed had failed or exited before uimapper tries to start and create a virtual input, but maybe also because it cannot find the inputs or doesn’t have permissions to write(fixed yesterday). Not related to the other errors.

The main problems seems to be different permission issues and the game file not launching at all, and launCharc not finding any game process to work with/keep alive.

But hard to be sure when I cannot reproduce on similar system as you and with the same game file.

Br, Vegard

robertjdominguez commented 3 years ago

Very helpful, thanks! OS version is 4.7.1-rpi2_3 running on a RPi 3. Tomorrow I'll double-check the permissions on the directories you mentioned; I'm certain /sd is accessible thanks to your instructions in the README.

Some of the errors could have been unique to the terminal session I was running; it was an SSH from a windows box. The errors went past too quickly when launching from emulation station and I didn't see any options for logging to later parse through.

I've tried several of the games on here (our school's site) via your .elf formatting instructions (in particular Ballard's Birds and Wizard vs. Witches. All reproduce with the above output.

Definitely clear permissions are the issue...just not sure where I've made the mistake.

Vegz78 commented 3 years ago

Just tested Ballard's Birds and Wizard vs. Witches on my system, and they both work fine from RetroPie, with controller support.

So I guess the errors you are seeing are either a bug in my code that somehow is not handling different system environments from my own, installation error(either in the instructions themselves or the following of) or some differences between your system and the ones I have tested on, which need to be identified and described as prerequisites, dependencies, conflicts etc.

I hope you manage to solve this by checking permissions, and that I hear back from you and we manage to get it to work for you together. It's very educative, but a new and strange experience for me, that this just works for me, but seemingly not so much outside my own house, haha... ;-)

Vegz78 commented 3 years ago

I tried to run again via SSH and via a terminal emulator inside a running X windows session, and with the game file directly in my ~/Downloads folder(where it is not automatically given execution permissions, like when copied to my ~RetroPie/roms/makecode folder). I basically also got ALL the error messages you described above, even though it works from both my Linux Console/CLI and RetroPie(started from the Linux Console, not when started from within the desktup/gui/X environment). MakeCode Arcade ELF game files only works from the Linux Console, not from gui/desktop/X.

Could you please:

  1. Ensure that the game file you are trying to start with launCharc has executable permissions (chmod +x game_file.elf)
  2. Ensure that you are running either launCharc or RetroPie from the Linux console (ALT+CTRL+F2 OR F3 and log in to new Linux console VT session, or log out of the desktop/gui/X session)

If it still doesn't work after this, you could try to debug further by running launCharc with the game file as argument from within SSH(like you did earlier) or a terminal emulator(XTerm etc.) from within the gui/desktop/X environment. You will here get no graphic, but all output from launCharc and the game_file.elf are output as text.

In the meantime, I'll update my installation instructions to emphasize executable permissions for the game files and game folder.

robertjdominguez commented 3 years ago

Definitely! I should be in my office this afternoon (UTC -6 over here) and will give it a shot.

robertjdominguez commented 3 years ago

🥳 Success! All that needed to be done was changing the executable permissions on the file. Thanks!

I'm unable to to utilize my arcade joystick and buttons - which function in emulationstation - and am wondering what advice you have to remap the keys in your config files?

Here's the inputs mapped from emulationstation during the initial set up via ~/.emulationstation/es_input.cfg:

<inputList>
  <inputAction type="onfinish">
    <command>/opt/retropie/supplementary/emulationstation/scripts/inputconfiguration.sh</command>
  </inputAction>
  <inputConfig type="joystick" deviceName="DragonRise Inc.   Generic   USB  Joystick  " deviceGUID="03000000790000000600000010010000">
    <input name="up" type="axis" id="0" value="1"/>
    <input name="left" type="axis" id="1" value="-1"/>
    <input name="right" type="axis" id="1" value="1"/>
    <input name="leftanalogleft" type="axis" id="2" value="1"/>
    <input name="down" type="axis" id="0" value="-1"/>
    <input name="start" type="button" id="2" value="1"/>
    <input name="b" type="button" id="1" value="1"/>
    <input name="a" type="button" id="0" value="1"/>
  </inputConfig>
</inputList>

Could you provide any insight into how to remap in arcade1.py or arcade2.py? Many thanks for your help!

Vegz78 commented 3 years ago

Glad to hear!

I’ll close this issue here regarding permissions now, and open a new issue regarding joystick mapping to try to answer/help with your last question about this.