[mythtv-users] no backend loop requires reboot

Bill Meek keemllib at gmail.com
Tue Jul 6 04:54:27 UTC 2021

On 7/5/21 11:14 PM, Stephen Worthington wrote:
> On Mon, 5 Jul 2021 19:27:53 -0600, you wrote:
>> If I ever start mythfrontend when I don't have mythbackend running, I am 
>> forced to reboot the machine.  Mythfrontend starts a loop where it will 
>> fail to find the backend, shut down and restart itself and fail to find 
>> the backend again.  The only way I have found to get out of this loop is 
>> to reboot.  Is there a better way?
>> Lloyd
> You can just kill mythfrontend.  Is this on Ubuntu?  Ubuntu has a
> script that automatically restarts mythfontend if it dies.  So the
> "mythfrontend" (/usr/bin/mythfrontend) program is actually a script
> file that runs the program "mythfrontend.real"
> (/usr/bin/mythfrontend.real).  There are times when you want to kill
> mythfrontend.real (because it has locked up while playing a bad video
> file, for example).  Then the mythfrontend script will restart
> mythfrontend.real.  At other times, such as your case, you probably
> want to kill the mythfrontend script first, so that mythfrontend.real
> will not be restarted, and then kill mythfrontend.real.
> I run MythTV on Xubuntu, and when the Xubuntu desktop (XFCE4) starts,
> I have it set up to automatically open two terminal sessions before it
> starts the mythfrontend script.  That means if I ever need to kill
> mythfrontend or mythfrontend.real, I can just do Alt-Tab to switch to
> one of the terminal sessions and do the necessary commands to kill
> things.  Alternatively, you can start a new terminal session by doing
> Ctrl-Esc to bring up the XFCE4 menu and go to Applications > Terminal
> Emulator.  Or you can start a console session outside X using
> Ctrl-Alt-F1.  Or you can use ssh from another computer to log in to a
> terminal session on the MythTV box.  On recent versions of XFCE4 there
> is a bug - the first time after startup that you do Ctrl-Esc, nothing
> happens, and you have to do it a second time.
> If you are using Ubuntu with a Gnome desktop, then you can do
> Ctrl-Alt-T to start a new terminal window.
> Once you have a terminal session, you can do this command to find the
> mythfrontend programs:
> ps -e | grep mythf
> This is what I get:
> root at mypvr:/usr/bin# ps -e | grep mythf
>    3673 ?        00:00:00 mythfrontend
>    3703 ?        12:13:00 mythfrontend.re
> The "mythfrontend.re" instead of "mythfrontend.real" is because ps has
> default size limits for the columns in its output, and has truncated
> the name.
> Then you can use the number in the first column of the ps output (the
> PID = Program ID) to kill it.  First try asking mythfrontend.real to
> stop itself by sending it a normal stop request:
> kill <PID>
> or
> kill -SIGTERM <PID>
> or
> kill -15 <PID>
> All three versions of the command do the same thing - they send a
> SIGTERM request signal to the program.  The program has to handle a
> SIGTERM request and if it does, it will shut itself down in an orderly
> manner.  However, all MythTV programs can suffer from a bug where they
> attempt to shut down after receiving an external request to do so such
> as SIGTERM, but they fail to shut down completely and leave one thread
> still running.  So if that happens, you need to repeat the kill
> command and the program will shut down that final thread.
> If mythfrontend is locked up, it will not be able to receive signals
> and will not shut down when requested.  If that happens, you need to
> do:
> kill -9 <PID>
> or
> kill -SIGKILL <PID>
> This command, unlike most kill commands, does not send a signal to a
> program.  Instead it sends a request to the operating system to have
> it kill the program.  The system will stop the program instantly - it
> will not have any chance to write anything to disk or shut down in any
> orderly fashion, so it is always best to try an ordinary kill command
> first and only use kill -9 if the program fails to shut down.
> Since mythfrontend and mythfrontend.real are normally run from the
> same user as you log in as and is used to run the desktop, there is
> normally no need to use sudo in front of any of those kill commands.
> But if they fail, you can try again using sudo.
> If you do not want the mythfrontend script to automatically restart
> mythfrontend.real when it stops, you need to kill the script first,
> using its PID, before killing mythfrontend.real.
> Having had to do all this many, many times, I got fed up and decided
> to write a script to automate the process, which I call "killm".  If I
> run "killm" it will kill mythfrontend.real using two "kill -15"
> commands, and automatically do a "kill -9" if that does not work.  If
> I do "killm x" (any text in place of x works), it will kill the
> mythfrontend script first.  If you want to install killm from my web
> server, run these commands:
> sudo su
> cd /usr/local/bin
> wget http://www.jsw.gen.nz/mythtv/killm
> chown root:root killm
> chmod u=rwx,og=rx killm
> exit

A commit was done 3 days ago in packaging. If the exit code is 130, it
will prevent the OPs issue:


The above is for master. I don't see it backported to v31.0 yet.


More information about the mythtv-users mailing list