I'm having difficulties refreshing a screen after kodi-standalone exits. I have a stretch-lite RPI2 installation and starting kodi from command line (with LXDE xserver gui present)

mrkipi@raspberrypi:~ $kodi-standalone

When started from command line like above (and exited from kodi) my display refreshes normally and I can see the screen as before the kodi start.

On the other hand I have prepared a simple service (which would not run on boot) to start the kodi-standalone

Description = Kodi Media Center
After = systemd-user-sessions.service network-online.target sound.target
Wants = systemd-user-sessions.service network-online.target sound.target

User = mrkipi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi-standalone
ExecStopPost = /bin/sleep 10
ExecStopPost = /usr/bin/xrefresh
Restart = never

WantedBy = multi-user.target

Starting kodi-standalone via this simple service on the other hand does NOT refresh the sceen after kodi exit - but I'd like to do so, therefore I wanted to call

ExecStopPost = /usr/bin/xrefresh

to refresh the lxsession. While this WORKS from the command line

mrkipi@raspberrypi:~ $xrefresh

the service execution gives

kodi.service - Kodi Media Center
   Loaded: loaded (/etc/systemd/system/kodi.service; disabled; vendor preset: en
   Active: failed (Result: exit-code) since Sun 2019-11-17 23:27:40 CET; 31s ago
  Process: 1792 ExecStopPost=/usr/bin/xrefresh (code=exited, status=1/FAILURE)
  Process: 1786 ExecStopPost=/bin/sleep 10 (code=exited, status=0/SUCCESS)
  Process: 1681 ExecStart=/usr/bin/kodi-standalone (code=killed, signal=TERM)
 Main PID: 1681 (code=killed, signal=TERM)

On the other hand ExecStopPost=/bin/sleep 10 works without a problem within the servicestoppost.

How can I refresh the screen within the ExecStopPost OR by executing some other script, which I could also call?

Is this only a problem of TTY not beeing available in the time of ExecStopPost, because the command line xrefresh is working without problems?

  • Maybe xrefresh gives additional info why it fails? Can you please edit your question (the button below it) and replace the service output with the complete output of systemctl status kodi.service. Isn't there already a kodi.service from the installation of kodi?
    – Ingo
    Nov 18 '19 at 9:26
  • Try using xrefresh -display :0 (presuming you are only running one instance of Xorg).
    – goldilocks
    Nov 18 '19 at 20:09
  • Hi Ingo.Thanks for your reply first.Yes there is a kodi.service already provided, but up to my knowledge for the libreelec, openelec distributions, but i'm using stretch lite with kodi standalone, where there was none. Nov 20 '19 at 20:54

The proposed solution from goldilocks (thanks) works like a charm with single xorg instance:

xrefresh -display :0

Looking at it again it is also clear to say which display to refresh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.