RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    emulationstation systemd service

    Scheduled Pinned Locked Moved Ideas and Development
    emulationstatiosystemddevelopmentubuntux86
    3 Posts 2 Posters 2.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      j_r0dd
      last edited by j_r0dd

      I have been trying to get a systemd service unit going for emulationstation to really have more of an appliance behavior. Using this with lubuntu 16.04. Currently I have a systemd timer set up to check every 15 seconds if ES is running and if not it will restart it. That way it respawns if a user accidentally quits or if the application crashes. I have created a systemd service file which boots into X and loads ES without a window manager, which is exactly what I want. The problem is once it loads ES does not recognize any input from a keyboard or ps3 controller. I was hoping someone more knowledgeable about ES or systemd could hopefully help. The logs have not given much to go on at all. Any advice is welcome!

      Not working

      [Unit]                                                                                                                                                                                          
      Description = Starts an instance of EmulationStation
      After = remote-fs.target
      
      [Service]
      User = retropie
      Group = retropie
      Type = simple
      PAMName = login
      ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/gnome-terminal --full-screen -e emulationstation -- :0 -nolisten tcp vt7 -nocursor
      Restart = always
      RestartSec= 2
      
      [Install]
      WantedBy = multi-user.target
      

      Working
      I've slimmed this down as much as I can without a single systemd service. My current implementation achieves most of my goal, but it floods journalctl with no way to turn off unless I change systemd's LogLevel across the board. This also requires a wm to start X and is a little more hackish and is as follows:

      /etc/systemd/system/rp_check.timer

      [Unit]                                                                                                                                                                                          
      Description = Check emulationstation
      
      [Timer]
      OnCalendar = *:*:0/15
      Persistent = true
      
      [Install]
      WantedBy = timers.target
      

      /etc/systemd/system/rp_check.service

      [Unit]                                                                                                                                                                                          
      Description = Check Emulationstation
      
      [Service]
      Type = oneshot
      User = retropie
      Group = retropie
      StandardOut = null
      Environment = "DISPLAY=:0"
      ExecStart = /bin/bash -c 'if [[ $(pidof emulationstation) -ne 0 ]]; then \
                                echo "emulationstation is running"; exit 0; else \
                                echo "starting emulationstation"; gnome-terminal \
                                --full-screen -e emulationstation; exit 0; fi'
      
      1 Reply Last reply Reply Quote 0
      • H
        Hevvie
        last edited by

        I had the same issue, what you need to do is put "<bool name="BackgroundJoystickInput" value="true" />" into your es_settings.cfg file as it thinks ES is running in the background.

        J 1 Reply Last reply Reply Quote 0
        • J
          j_r0dd @Hevvie
          last edited by

          @Hevvie said in emulationstation systemd service:

          I had the same issue, what you need to do is put "<bool name="BackgroundJoystickInput" value="true" />" into your es_settings.cfg file as it thinks ES is running in the background.

          I will try this out when I get a chance. Great find!!!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          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.