Arch Linux ARM on RPI4: not able to launch any game with external launcher setup, while launching directly from RetroArch works fine
Hello, first of all, thanks for your project. Anyway, seemingly, the addon doesn't work in my setup and I don't undestand why. I got a pretty basic setup, only installed Arch Linux ARM on RPI4 and installed Kodi after that. Nothing fancy. I followed the external setup guide and I am able to run games directly from RetroArch (using the ROMs downloaded by IAGL). But when I try to run the same ROMs from Kodi, it doesn't work.
I attach two logfiles generated while trying to run the same game, one for the Amiga core, the other for the SNES. While trying the Amiga version, IAGL simply does nothing when pressing the "Launch" button. The SNES one throws the error "The game isn't compatible with any available emulators". Both work if run by RetroArch directly. From the log I can see that it's detecting the cores directory correctly and I can't find any error. I tried reinstalling the addon and running the Setup Wizard over and over with no luck.
Any help is appreciated. Thanks.
Sorry for the delay in addressing. It looks like the setup is attempting to launch with Retroplayer (Kodi) instead of external Retroarch, and since there is no compatible game client, it doesn't work. If you ran the IAGL wizard for external launching, it should run you through the necessary steps to make this work (if it didn't work for some reason I'd be interested to know).
What are you addon settings? I would suggest:
External Launchers>My System Type>Linux
Close Kodi On Launch>Enabled (probably, this depends on RAM, and if you think you can have Kodi and RA open without any memory issues)
Retroarch App Location> probably /usr/bin/retroarch but this depends on your OS, and I've never used this setup
Retroarch System Folder>I think it's something like /home/retroarch/system/
Then you can either run the wizard, or setup lists individually following these instructions
@undrivendev My setup is rather similar to yous, just on RPi 3 not 4. I started playing around the last days with Retroarch and I am still experimenting. Some caveats.. First I assume you've installed kodi-rbp4 package on your Pi? Then the scripts apppause.sh and aplaunch.sh in /var/lib/kodi/.kodi/addons/plugin.program.iagl/resources/bin/ do not work because of the different kodi binary name (here it is kodi-rbp instead of Kodi).
Instead of tinkering with the scripts there I created my own start script in /var/local/binand referenced it in the addon as retroarch binary name. There you could e.g. terminate kodi, start retroarch, and restart kodi again if retroarch terminates.
But be aware, the systemd service file of kodi-rbp restarts kodi automatically in case of a crash (or kill) - so you have to adapt this, too.
Letting kodi run when starting retroarch does not work for me, the retroarch process gets killed and even verbose output does not give me an indication about the problem :(
So, all in all not really satisfying at the moment..
Hmm, this sounds complicated... Do you have your script I can look at?
I'm wondering if I just need to edit the applaunch.sh file to include kodi-rbp as an optional PID. Is that what your script did? I'll note that the applaunch.sh file first tries to close Kodi with jsonrpc, which should make Kodi gracefully shut itself down (this requires you have web control on in settings)
Sorry, unfortunately I haven't had enough time to go on with the triage and find a solution, I have abandoned the idea to use the RPI4 for playing. Thank you very much @pejobo and @zach-morris for the help, really appreciate it. Feel free to close the issue if you want.
I've been struggling with identical symptoms. Today I've got it to work.
My setup: I'm running kodi 19.1 on a RPi-4B (kodi-gbm). I'm starting it from systemd using kodi-standalone.
The following changes where required to make it work:
- chmod +x on .kodi/addons/plugin.program.iagl/resources/bin/applaunch.sh
- In System->Services, Control: Require authentication = false
- In System->Settings, Input, Pheriperals, CEC Adaptor (the one connected to the TV), Devices to power off during shutdown = none
- After setting the launch command for your particular list, manually edit it to re-direct the output to a file by appending " >> ~/iagl.log"
Without step 1, the script does not run at all. Without step 2, neither jsonrpc nor kodi-send succeed. The kill does succeed but for some reason retroarch does not start afterwards on my system. Without step 3, stopping kodi will turn off the TV, again retroarch doesn't seem to like this. Without step 4, the applaunch.sh script stops after its first line of output.
The captured log file afterwards displays:
Linux Standalone Detected
Attempting to exit Kodi via JSONRPC
JSONRPC Exit Success
JSON RPC / kodi-send Exit Success
Kodi Exited, Launching Emulator with command: /usr/bin/retroarch -L /usr/lib64/libretro/puae_libretro.so /home/hancock/.kodi/userdata/addon_data/plugin.program.iagl/game_cache/TestDrive2_v1.0_0588.hdf --verbose
Waiting for emulator to exit...
Restarting Linux Kodi with: kodi
JSONRPC response to restart IAGL was {"id":1,"jsonrpc":"2.0","result":"OK"}
Please note that kodi is not restarted with kodi-standalone, which was reported as detected by the applaunch.sh script.. However this way it starts as well.
Thanks for this info. Starting from systemd i can see it possibly being different. I didn't think about CEC, I'm wondering if that could temporarily be disabled via the addon (similar to how it disables audio and controller input in some instances) - I'll look into that. Interesting that the json-rpc commands wont work. I assume it's enabled in Kodi settings?
Under Settings/Services->Control I have "Allow remote control via HTTP" and "Allow remote control from applications on this system" enabled. When in addition I also enable "Require authentication", both jsonrpc and kodi-send stop working for me.
(I would rather enable authentication, see https://kodi.tv/article/kodi-remote-access-security-recommendations/)
I think the former is the only required. The json-rpc commands are locally sent, so no remote connection is required in this case. That being said, I can add some settings to include a user/pass for json-rpc if it's enabled for other reasons.
When using mesa 21.2.0 and the vulkan driver on the rpi, retroarch also produces output on stderr. (The error is "destroy dumb object 1: Invalid argument".) On my setup this will terminate retroarch as soon as this output is produced.
The only way I found around this is to modify applaunch.sh to run the emulator using:
"$@" 2>&1 &
(on line 476).
It took me some time to figure this our again after todays automatic update, so I thought let's add this info as well.
Thanks, I've got my hands on an RPi and I'll install arch linux and see if I can fix this. Perhaps it makes sense to identify arch linux as it's own system type in the addon settings and have specific launch scripts for it. I'll play around with it.
I guess it is more about how you start Kodi, not so much about which distro you use. I'm on Gentoo. But I did get my systemd init script from https://github.com/graysky2/kodi-standalone-service, so that is from Arch indeed.
With Arch Linux you can probably boot into a full-blown Linux desktop as well and start Kodi interactively. Not sure whether these issues would still be there.
When you've got your Pi connected to your TV, the desktop does not make much sense. You want to boot directly into Kodi and control the Pi using CEC with your TV remote, or with your game controller.
I'm trying to solve this, but having a heck of a time. Using a VM with arch linux, I've installed Retroarch, then installed Kodi and then set it up to start as a service using this.
I can start and stop the kodi service and launch Retroarch, this seems like the way to go for updating the launch script.
However, the 'kodi' user configs for Retroarch are different than the 'other users' config and I'm at a loss for how to set it up. Both users don't have permission to see the other users stuff by default. I can of course change that, but not sure how most people are getting around all this setup minutuae.
How do users usually set this up in arch? It's confusing as hell. Are you installing Kodi and Retroarch in the same userspace or using one user somehow differently? Or are you somehow installing retroarch for the kodi (nologin) user?
I'm not using Arch Linux, so I really can't answer your question.
It seems to me the assumption behind IAGL was always that Kodi starts Retroarch directly. That means it runs under the Kodi user and Kodi can read the Retroarch config in ~/.config/retroarch?
Yes, the config file and core directory should be readable. Without it, the the addon can't interrogate what cores are installed, what they're named, etc. Thats a big issue with Android as well since their permissions won't allow it.
It can still work without that ability. Without it, you can only manually generate the command to launch retroarch but that takes away some of the functionality.