[SOLVED] Launching RetroArch from System.Exec

Hi,

First of all, thank you for the great work to make this wonderfull software.

I didn’t found another subforum to ask for this. Sorry if it is not the accurate place. I know that it is not a CE problem itself but I can`t find how to solve it.

I installed RetroArch and make a simple script to launch it:

systemctl stop kodi

/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &

systemctl start kodi

If I run it from CLI works well but if I try to run from any Kodi skin using System.Exec command doesn’t work

It stops Kodi and doesn’t run the RetroArch command.

I’m afraid that when kodi stops the script stops also.

Anybody knows how can I solve this?

Thanks in advance.

You need to use systemd-run to launch some script:
systemd-run /path/some_script.sh

Then you can stop kodi inside that script.
The problem is that when kodi is stopped also script is stopped. And retroarch is not excuted.

Thank you.

I’ll try it.

Sorry, but with systemd-run the retroarch app doesn’t start

First, systemctl stop kodi runs well and then systemctl start kodi, but the retroarch line doesn’t work.

Any other idea to play with?

Thanks again.

@shanti had some scripts for doing exactly this, maybe he can help.

@Txemoto as you already found out, any script that is attempted to start after killing kodi will not run, so there are 2 things you could try.

First is as @vpeter said… create a script file that will run and check if retroarch is still running

something like this

/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &
systemctl stop kodi
while pgrep retroarch > /dev/null; do sleep 1; done
systemctl start kodi

(notice how kodi is stopped after running retroarch )

then call it like this:

systemd-run /path/some_script.sh

another more complex option if you want to go that route is check an add-on called Bolt Ons! its very outdated but you can check how they manage to launch retroarch in there

please note that I have not tried this methods as I have a service incorporated in my build that does this.

If you executed retroarch with & at the end it is run in background. I assume it takes some time and kodi started too early.
That’s why try without &.

Or use script like

systemctl stop kodi
/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &
while pgrep retroarch > /dev/null; do sleep 1; done
systemctl start kodi

@vpeter in my very short experience with trying to run stuff from Kodi, this will not work, as Kodi is stopped first so the script will die before it gets a chance to run Retroarch. Unless I am missing something very obvious.

@Txemoto another option you could try is this one :slight_smile:

@shanti: That’s why systemd-run must be used.

1 Like

Ahh I see, it was a while since I last tried, I can’t remember if I used systemd-run so that might be it! TIL! :smiley:

First of all, many thanks to all of you.

Finally, the trick to make it work were some changes:

  1. As @vpeter said, systemd-run is the most important change
  2. As @shanti recommended, I launched the retroach with “&” before stop kodi, and wait until ends in that loop. Just as said here:

/storage/.kodi/retroarch/retroarch -v “$@” > /var/log/retroarch.log 2>&1 &
systemctl stop kodi
while pgrep retroarch > /dev/null; do sleep 1; done
systemctl start kodi

Works perfect!!!

Thanks again.

By the way, @shanti I saw the link to instal retroarch as Kodi addon, but I don’t know if it’s posible to clone a git repository with CoreELEC. It is posible?

It has to be done on a computer running linux, if you don’t have one maybe I can try making it for you :slight_smile:

I made the add-on but its based on my build (sx05re) which is also more up to date than Lakka, it also includes Emulationstation and can be installed on top of CoreELEC

@shanti, would it be possible for you to build it for S912 too?

And I know that this isn’t a CoreElec question but do you know if it is difficult to integrate the add-on with IAGL?

I updated the release to include a S912 version, haven’t tested it properly but it does run.

About the IAGL, I am not familiar with it, so I can’t say if its difficult or not, sorry.

That was fast, thanks!

I’ll continue to investigate how to get IAGL to work.

If it let’s you select the emulator binaries to run and the folders to save roms it should work.

But I don’t see the point, it seems it has its own binaries?

If I have understand it correctly its purpose is to download/store roms and then start retroarch by passing additional arguments while starting it.


Many thanks @shanti

I’ll try it

Noob here.
I’m pretty good at following directions, but it seems as if it hasn’t been completely clear about what to do.
I’ve messed with this a bunch, but I’m at the point of asking for help.
Of course, I can get this all to work from Android, but within Corelec, which runs much better for me, I can’t get it to work.
Right now, Corelec is fine.
Retroarch launches fine.
(I have to unplug and replug the keyboard usb [Rii i8+] to get it to register / work)
I can get back to Kodi, fine.
But, I can’t get IAGL to launch Retroarch.
I either get a black screen or spinning wheel in kodi, then nothing.


If someone wouldn’t mind putting together a tutorial about how to get retroarch to launch via kodi (Corelec) from IAGL (Internet Archive Game Launcher), I’d greatly appreciate it.

Thanks!