[mythtv-users] today's mythtv update for v31 failed

James Abernathy jfabernathy at gmail.com
Thu Feb 3 17:05:14 UTC 2022


On Thu, Feb 3, 2022 at 11:56 AM Mike Perkins <mikep at randomtraveller.org.uk>
wrote:

> On 03/02/2022 16:47, James Abernathy wrote:
> > I think this failure is mine alone but it seems to fail because of an
> > override.conf file I have in the mythtv-backend.service.  It worked until
> > this update this morning.
> >
> > I don't see this reason for the error:
> > jim at kubuntu-closet:/etc/systemd/system/mythtv-backend.service.d$ sudo
> > systemctl cat mythtv-backend.service
> > # /lib/systemd/system/mythtv-backend.service
> > [Unit]
> > Description=MythTV Backend
> > Documentation=https://www.mythtv.org/wiki/Mythbackend
> > After=mysql.service network.target
> >
> > [Service]
> > User=mythtv
> > EnvironmentFile=-/etc/mythtv/additional.args
> > ExecStart=/usr/bin/mythbackend --quiet --syslog local7 $ADDITIONAL_ARGS
> > StartLimitBurst=10
> > StartLimitInterval=10m
> > Restart=on-failure
> > RestartSec=1
> >
> > [Install]
> > WantedBy=multi-user.target
> >
> > # /etc/systemd/system/mythtv-backend.service.d/override.conf
> > [Service]
> > ExecStartPre=/usr/local/bin/hdhomerun_check.py
> >
> > I think the error with the upgrade is during the post processing. when it
> > tried to restart mythtv-backend.service. Here's the output from the
> restart
> > failure.
> >
> > jim at kubuntu-closet:/etc/systemd/system/mythtv-backend.service.d$ sudo
> > systemctl status mythtv-backend
> > × mythtv-backend.service - MythTV Backend
> >       Loaded: loaded (/lib/systemd/system/mythtv-backend.service;
> enabled;
> > vendor preset: enabled)
> >      Drop-In: /etc/systemd/system/mythtv-backend.service.d
> >               └─override.conf
> >       Active: failed (Result: exit-code) since Thu 2022-02-03 11:39:01
> EST;
> > 14s ago
> >         Docs: https://www.mythtv.org/wiki/Mythbackend
> >      Process: 3711 ExecStartPre=/usr/local/bin/hdhomerun_check.py
> > (code=exited, status=1/FAILURE)
> >          CPU: 86ms
> >
> > Feb 03 11:39:01 kubuntu-closet systemd[1]: mythtv-backend.service:
> > Scheduled restart job, restart counter is at 10.
> > Feb 03 11:39:01 kubuntu-closet systemd[1]: Stopped MythTV Backend.
> > Feb 03 11:39:01 kubuntu-closet systemd[1]: mythtv-backend.service: Start
> > request repeated too quickly.
> > Feb 03 11:39:01 kubuntu-closet systemd[1]: mythtv-backend.service: Failed
> > with result 'exit-code'.
> > Feb 03 11:39:01 kubuntu-closet systemd[1]: Failed to start MythTV
> Backend.
> >
> > I'll temporarily remove the override for now.
> >
> > Any ideas?
> >
> It's the hdhomerun python code that is failing. Has the version changed?
>
> --
>
> Mike Perkins
>

I have not changed the code. I got it from someone on MythTV Forum and it
seemed simpler than wait-for-pingable method of delaying mythtv-backend
startup.
Here's the code and it works normally at the command line.

 cat /usr/local/bin/hdhomerun_check.py
#!/usr/bin/python3

''' See if the HD Homerun box is accessable and running '''

import subprocess
import sys
import logging
from time import sleep
from datetime import datetime

ATTEMPTS = 21
DELAY = 2


def get_elapsed_time(start):
    ''' Calculate the time spent waiting for the HDHR to come up '''

    delta = datetime.utcnow() - start
    rounded_delta = '{:.3f}'.format(delta.seconds +
                                    (delta.microseconds / 1000000))
    return rounded_delta


def main():
    ''' Try to discover the HDHR '''

    attempt = 0  # Shut up pylint.
    command = 'hdhomerun_config discover'
    logger = logging.getLogger(command)

    logging.basicConfig(filename='/var/log/mythtv/hdhr_discovery.log',
                        filemode='a',
                        format='%(asctime)s %(levelname)s\t%(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S',
                        level=logging.INFO)

    logger.info('Starting HD Homerun discovery')

    start = datetime.utcnow()

    for attempt in range(1, ATTEMPTS):
        try:
            sproc = subprocess.Popen(command, stdout=subprocess.PIPE,
                                     shell=True)
            sproc.communicate()

        except KeyboardInterrupt:
            sys.exit(2)

        if sproc.returncode != 0:
            logger.warning('%s failed, return code = %d.', command,
                           sproc.returncode)
            sleep(DELAY)
        else:
            logger.info('Found HD Homerun. Seconds=%s, attempts=%d.',
                        get_elapsed_time(start), attempt)
            sys.exit(0)

    logger.error('Couldn\'t find HD Homerun. Seconds=%s, attempts=%d.',
                 get_elapsed_time(start), attempt)


if __name__ == '__main__':
    main()

# vim: set expandtab tabstop=4 shiftwidth=4 smartindent colorcolumn=80:

Jim A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20220203/a3afdd64/attachment.htm>


More information about the mythtv-users mailing list