Please do not post a support request without first reading and following the advice in

METADATA not saving - Favorites will never remain tagged

  • Hello all. I'm completely at my wits end in trying to find a reason or solution to this, but as the title suggests I simply can NEVER get my favorites to remain tagged after a shutdown.

    I am using a Nespi with a soft shutdown script and the graceful finish for ES script. and the REAL aggravating part to this problem is that it did work perfectly from the beginning. I must have remade the retropie image more than a dozen times to start fresh to figure whats triggering it, but I can't pinpoint it but I believe it may be something with gameslist.xml.

    one thing I notice which is a tell tale sign that I know the metadata will no longer save is when I look at the shutdown code running by: the readout is shorter and faster and I know that's the end of my favorites. when it is working good I notice the shutdown sequence will even show the SSH prompt, retropie info and logo like one would see when telnetting in, in between the list of functions its executing. The only way I can get games to save in favorites is by shutting the system down via the ES menu :/

    I'm really losing sleep on this - I was wondering if anybody might be able to help me. Thanks in advance

  • I had discovered this problem too, and we resolved it by editing the shutdown script. We did this on a Mausberry switch, I'm not sure how well it would work for you, but it's worth a shot.. Have a look here:

  • @hansolo77 Awesome I'd love to give it a shot! Sorry but do you have the final script you can post?

    I was whisking through the thread and the 250+ replies and started getting lost after revisions got up to v1.7 lol. Just a little overwhelming. I'm not a total n00b with RPi but I am a bit new to the game and somewhat savvy especially with a pastebin :)

  • @Semper-5 Stop here please!
    The thread posted by @hansolo77 is/was the codebase for ensuring-es-gracefully-finish-and-save-metadata-in-every-system-shutdown

    Afair there was never a version 1.7 I think 1.6x was a development branch1.59 was the last working script version I remember ;) Then the script posted above was created and the great advantage of this is, that you never have to alter the shutdown script itself.

    A button press calls a script that somehow shutdowns your pi. Now the service script in the posting takes action and checks the following

    1. Is ES currently running, if yes go on, if no exit
    2. Is an emulator currently running? If yes, break it down and wait
    3. close ES and wait some seconds to make sure metadata is written
    4. Give control back to systemd


  • @cyperghost thank you for the reply and the point in the right direction.

    but as I said, I already incorporated meleu's script. it had been working for a short while but eventually stopped functioning properly. I still don't know why or what triggers it. But I do know there are others like me facing this exact same problem with the

    meleu had mentioned he'd be looking into it. I was just wondering if anybody else had some insight to this matter.

  • @semper-5 Ah yes.... didn't read that you already used the shutdown service.....

    Annother question? Did you update Emulationstation or the later? Because the service script was updated a few weeks ago to better work with newer versions of the call.

    I'm not sure... I will make a suggestion on the ES-thread itself ;)
    Hope we can find a solution ;)

  • @cyperghost yeah I just updated all cores even optional packages and didn't make any difference. the only way I can make my favorites stick is shutting down, restarting system or ES within the menu.

    it's a pain but if I really want to add a few favs I'll add and then just restart ES and then shutdown. at least they there for good on next boot :/

    and thank you very much I really appreciate your help :)

  • @semper-5 Does it work if you call the script manually

    sudo /etc/

  • @cyperghost I receive the following:

    sed: can't read /dev/shm/ No such file or directory
    /etc/ line 20: wait: pid 794 is not a child of this shell

    I can also confirm that directory is completely empty and said file doesn't exist anywhere on my system :/

  • Sorry I'm a systemd-noob!
    The wait command in the shell does not work because the process called by terminal. With the manual command you open a process that is isolated to the current running instance. Therefore wait does not work...

    The sed error can be ignored!
    You do not run any emulator.... so there is no file created!

    Please try following

    login via SSH and user pi

    then run command
    touch /tmp/es-shutdown
    This will create an empty file es-shutdown in folder tmp and this "says" ES to go in shutdown mode. This worked in the older scripts - I have no clue if it will work as service ... read line 1 in my posting again ;)

    then powerdown with button (after you have set some favourites....)

    This works only once per startup but if this works we can resolve that
    If it does not work we have to wait for meleus suggestion in the other thread

  • @cyperghost lol no worry, I'm more of a n00b of all trades with RPi, but hey I'm learning ;)

    Unfortunately it didn't save a fav I added after I followed your instructions.

  • Hmm, anybody? Updates? :/

  • @semper-5 Well does the service work if you perform a sudo poweroff via SSH?

    EDIT: Well somebody deserved you a downvote for pushing two threads up again

  • @cyperghost lol yeah forgive my lack of forum etiquette - I almost felt ignored for a moment there.

    and the sudo poweroff did not save the metadata :(

  • @semper-5 Then there is 100% something wrong with your/the service installation.
    Sorry can't help you anymore in this. As workaround you may use the old route....

    A script that watches the state of your buttons and if the state changes then it terminates ES.

  • @cyperghost ok i'll try removing and readding everything -_-#

    do you have a pastebin of the old script, and does it work(ish)? heh

    EDIT: I disabled the service, deleted the script, service files. redid everything from step 1, following instructions immaculately, and biiiiig NOPE to getting it working. the only way I get the metadata to save is by restarting or quitting ES from within the menu :(

    I know I can't be the ONLY person having this problem and I have this exact same problem on 3 Nespi's I've set up with the same scripts, wiring and configs

  • Yes... I've a script here in this thread

    You may need to modify it a bit. It provides a shutdown if you press the power button and if you press restart any emulator will be terminated. If you are in ES and press restart, then ES will restart.

  • @cyperghost I recently hit a snag with DOSBox that was easily corrected with a binary update. This made me think back to what you mentioned about updating the

    May I ask how I would do that (in case I, unwittingly, haven't done so)

  • @semper-5 Uff... Per system update by RetroPie setup
    You can renew Basic Packages like ES and runcommand (afaik)
    But I think there is nothing wrong with this ... if you still facing problems with this. You can use the "old" method by directly calling the shutdown scripts via power button action. Tell me more about your (hardware) power setup.

  • @cyperghost oh I meant to follow up a weird little anomaly I found. and I only see it when Im in the setup or command line, I'll get the odd "exitemulator" pop up at random. Ive made 2 systems using the same scripts and wirings outlined in James' documents and they both do this. I have followed them to a tee so I don't know why they're doing this or if this is even related to the issue with metadata not saving. Even more strangely, that command SHOULD kick me out of any running emulator but I've never been kicked out of a game. I only see this pop up in command line screens.


Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.