[mythtv-users] Gallery not working

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Apr 30 02:46:48 UTC 2018

On Mon, 30 Apr 2018 02:02:34 +0100, you wrote:

>On Sun, 29 Apr 2018 09:49:35 +0100
>Mike Bibbings <mike.bibbings at gmail.com> wrote:
>> On 28/04/18 20:00, Marco Nelissen wrote:
>> > And indeed it apparently was lying, since even though mythtv-setup 
>> > told me it was stopping and starting the backend, the running 
>> > mythbackend was still the same instance that had been running since
>> > I rebooted last week.
>> > Restarting the backend for real fixed the issue. Thanks!
>> > So is this an issue with mythtv-setup, mythbackend, or Ubuntu
>> > itself?
>> >
>> >  
>> The mythtv-setup issue of not stopping mythtv-backend has been
>> reported see  trac ticket https://code.mythtv.org/trac/ticket/13160
>> (has patch)
>That ticket suggests Mythbuntu doesn't detect the running backend and so
>doesn't attempt to stop it.
>I don't run Mythbuntu but my experience was the same as Marco's. It
>was detected, a dialog offered to stop it and no "failed to stop
>backend" dialog appeared even though the backend chuntered on.
>IIRC on 16.04 running the Upstart "service stop mythbackend" command
>doesn't kill the backend, yet it still reports success. I can't
>reproduce it on 18.04.
>It's worth checking your backend start/stop commands use the systemd
>commands mentioned. Even if you are using Mythbuntu, the wiki comment
>may be out-of-date.

The Upstart commands are not valid on Ubuntu when using systemd.  They
only work if you have switched back to using Upstart, which I have
never tried.  The Wiki commands are wrong for a systemd based system.
And to complicate things still more, on Ubuntu /usr/bin/mythtv-setup
is a script that is supposed to shut down and restart mythbackend
around running mythtv-setup.real.  The script still uses the Upstart
commands and does not work either.  So I just manually run the
systemctl commands now.  At the very least, the /usr/bin/mythtv-setup
script needs to be altered to detect whether systemd is being used and
if so use systemctl.  And on install, maybe the mythtv-backend package
needs to be adding a file to /etc/sudoers.d to allow the script (and
maybe mythfrontend also) to either use systemctl, or to use another
"helper" script that can do the correct commands with sudo.

When I wanted to rotate log files I was creating in /var/log/mythtv
for my EPG gathering script, I found that log rotation needed to use
sudo, so the way I did that was to create a helper script that was
authorised to do those commands:

root at mypvr:/etc# cat /home/stephen/bin/logrotate.sh


if [ "$1" == "rotate" ]; then

    # Rotate the log file.
    logrotate --force --state $LOGSTATUS $LOGCONFIG


if [ "$1" == "chown" ]; then

    # Chown the log file.
    chown syslog:adm $LOGFILE

and then added that helper script to sudoers:

root at mypvr:/etc# cat /etc/sudoers.d/stephen
stephen ALL=NOPASSWD:/home/stephen/bin/logrotate.sh

The logrotate.sh script is only writeable by root:

root at mypvr:/home/stephen/bin# ll /home/stephen/bin/logrotate.sh
-rwxr-xr-- 1 root root 348 Mar 21  2014

as is its logrotate.conf file:

root at mypvr:/home/stephen/bin# ll /home/stephen/.logrotate/
total 16
drwxrwxr-x  2 stephen stephen 4096 Apr 29 15:10 ./
drwxr-xr-x 55 stephen stephen 4096 Apr 30 04:50 ../
-rw-r--r--  1 root    root     417 May  8  2013 logrotate.conf
-rw-r--r--  1 stephen stephen   78 Apr 29 15:10 status

So a helper script done in similar manner may be what is needed to
start and stop mythbackend.  But I do not know if packages are able to
set up /etc/sudoers.d files.

More information about the mythtv-users mailing list