[mythtv-users] Unable to start backend after update from v30 to v31

Mike Perkins mikep at randomtraveller.org.uk
Mon Dec 14 23:09:14 UTC 2020


On 14/12/2020 21:35, Peter Carlsson wrote:
> On Sun, Dec 13, 2020 at 11:15:33PM -0600, Bill Meek wrote:
>> On 12/13/20 9:01 PM, Stephen Worthington wrote:
>>> On Sun, 13 Dec 2020 11:05:02 +0100, you wrote:
>>>
>>>> Hello,
>>>>
>>>> I updated my MythTV from v30 to v31 and after a reboot I can no longer
>>>> start the backend.
>>>>
>>>> I have not needed to touch these settings for a very long time so I do
>>>> not exactly know were to start looking.
>>>>
>>>> I can see this but I do not have a /var/lib/mythtv/.mythtv folder.
>>>>
>>>>   dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559862 N  Using configuration directory = /var/lib/mythtv/.mythtv
>>>>
>>>> I also see this. But I can login from the command line so maybe the
>>>> password is not found in my config.xml file.
>>>>
>>>>   dec 13 00:27:04 htpc mythbackend[15850]: Access denied for user 'mythtv'@'localhost' (using password: YES)
>>>>
>>>> I recall there have been discussions about the config.xml file being
>>>> placed in different folders and not obvious which is being used at
>>>> startup.
>>>>
>>>> During the update I also answered 'No' on a question if MythTV should be
>>>> accessible by other computers, thinking I was going to fix that later.
>>>> But now I don't know where to configure this.
>>>>
>>>> I use Debian Buster with packages from www.deb-multimedia.org.
>>>>
>>>> Any help would be appreciated.
>>>>
>>>> The error message I get is:
>>>>
>>>> htpc:/etc# systemctl restart mythtv-backend
>>>> htpc:/etc# systemctl status mythtv-backend
>>>> ? mythtv-backend.service - MythTV Backend
>>>>      Loaded: loaded (/lib/systemd/system/mythtv-backend.service; enabled; vendor preset: enabled)
>>>>      Active: active (running) since Sun 2020-12-13 00:27:02 CET; 3s ago
>>>>        Docs: https://www.mythtv.org/wiki/Mythbackend
>>>>    Main PID: 15850 (mythbackend)
>>>>       Tasks: 6 (limit: 4915)
>>>>      Memory: 34.4M
>>>>      CGroup: /system.slice/mythtv-backend.service
>>>>              ??15850 /usr/bin/mythbackend
>>>>
>>>> dec 13 00:27:03 htpc mythbackend[15850]: 2020-12-13 00:27:03.068191 I  Start up testing connections. DB localhost, BE , attempt 0, status dbAwake, Delay: 2000
>>>> dec 13 00:27:04 htpc mythbackend[15850]: 2020-12-13 00:27:04.093830 E  [DBManager0] Unable to connect to database!
>>>> dec 13 00:27:04 htpc mythbackend[15850]: 2020-12-13 00:27:04.093856 E  Driver error was [1/1045]:
>>>> dec 13 00:27:04 htpc mythbackend[15850]: QMYSQL: Unable to connect
>>>> dec 13 00:27:04 htpc mythbackend[15850]: Database error was:
>>>> dec 13 00:27:04 htpc mythbackend[15850]: Access denied for user 'mythtv'@'localhost' (using password: YES)
>>>> dec 13 00:27:05 htpc mythbackend[15850]: 2020-12-13 00:27:05.094353 I  Start up failure. host localhost, status dbStartedFail
>>>> dec 13 00:27:05 htpc mythbackend[15850]: 2020-12-13 00:27:05.094384 I  UPNP Search 2 secs
>>>> dec 13 00:27:05 htpc mythbackend[15850]: 2020-12-13 00:27:05.600740 I  UPNP Search 1 secs
>>>> dec 13 00:27:05 htpc mythbackend[15850]: 2020-12-13 00:27:05.923035 I  UPNP Search 1 secs
>>>> htpc:/etc# journalctl -xe
>>>> --
>>>> -- Automatic restarting of the unit mythtv-backend.service has been scheduled, as the result for
>>>> -- the configured Restart= setting for the unit.
>>>> dec 13 00:27:39 htpc audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=mythtv-backend comm="systemd" exe="/usr/lib/systemd/systemd" hostn
>>>> dec 13 00:27:39 htpc audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=mythtv-backend comm="systemd" exe="/usr/lib/systemd/systemd" hostna
>>>> dec 13 00:27:39 htpc systemd[1]: Stopped MythTV Backend.
>>>> -- Subject: A stop job for unit mythtv-backend.service has finished
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> --
>>>> -- A stop job for unit mythtv-backend.service has finished.
>>>> --
>>>> -- The job identifier is 6552 and the job result is done.
>>>> dec 13 00:27:39 htpc systemd[1]: Started MythTV Backend.
>>>> -- Subject: A start job for unit mythtv-backend.service has finished successfully
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> --
>>>> -- A start job for unit mythtv-backend.service has finished successfully.
>>>> --
>>>> -- The job identifier is 6552.
>>>> dec 13 00:27:39 htpc audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=mythtv-backend comm="systemd" exe="/usr/lib/systemd/systemd" hostn
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.548257 C  mythbackend version:  [v31.0] www.mythtv.org
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.548293 C  Qt version: compile: 5.11.3, runtime: 5.11.3
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.548340 I  Debian GNU/Linux 10 (buster) (i386)
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.548347 N  Enabled verbose msgs:  general
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.548362 N  Setting Log Level to LOG_INFO
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.558913 I  Added logging to the console
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559484 I  Setup Avbruten (SIGINT) handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559503 I  Setup Avslutad handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559518 I  Setup Segmenteringsfel handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559533 I  Setup Avbruten (SIGABRT) handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559555 I  Setup Bussfel handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559572 I  Setup Flyttalsfel handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559588 I  Setup Otillåten instruktion handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559610 I  Setup Realtidssignal 0 handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559629 I  Setup Avringd handler
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559850 N  Using runtime prefix = /usr
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559862 N  Using configuration directory = /var/lib/mythtv/.mythtv
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.559923 I  Assumed character encoding: sv_SE.UTF-8
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.560150 E  DBHostName is not set in config.xml
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.560189 E  DBHostName is not set in config.xml
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.560222 I  Empty LocalHostName. This is typical.
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.560235 I  Using a profile name of: 'htpc' (Usually the same as this host's name.)
>>>> dec 13 00:27:39 htpc mythbackend[15892]: 2020-12-13 00:27:39.560338 I  Start up testing connections. DB localhost, BE , attempt 0, status dbAwake, Delay: 2000
>>>> dec 13 00:28:10 htpc mythbackend[15922]: 2020-12-13 00:28:10.075183 E  [DBManager0] Unable to connect to database!
>>>> dec 13 00:28:10 htpc mythbackend[15922]: 2020-12-13 00:28:10.075209 E  Driver error was [1/1045]:
>>>> dec 13 00:28:10 htpc mythbackend[15922]: QMYSQL: Unable to connect
>>>> dec 13 00:28:10 htpc mythbackend[15922]: Database error was:
>>>> dec 13 00:28:10 htpc mythbackend[15922]: Access denied for user 'mythtv'@'localhost' (using password: YES)
>>>> dec 13 00:28:11 htpc mythbackend[15922]: 2020-12-13 00:28:11.075705 I  Start up failure. host localhost, status dbStartedFail
>>>> dec 13 00:28:11 htpc mythbackend[15922]: 2020-12-13 00:28:11.075735 I  UPNP Search 2 secs
>>>> dec 13 00:28:11 htpc mythbackend[15922]: 2020-12-13 00:28:11.363891 I  UPNP Search 1 secs
>>>> dec 13 00:28:11 htpc mythbackend[15922]: 2020-12-13 00:28:11.635063 I  UPNP Search 1 secs
>>>> dec 13 00:28:12 htpc mythbackend[15922]: 2020-12-13 00:28:11.991412 I  UPNP Search 1 secs
>>>> dec 13 00:28:13 htpc mythbackend[15922]: 2020-12-13 00:28:13.115462 I  No UPnP backends found
>>>> dec 13 00:28:14 htpc mythbackend[15922]: No UPnP backends found
>>>> dec 13 00:28:14 htpc mythbackend[15922]: Would you like to configure the database connection now? [no]
>>>> dec 13 00:28:14 htpc mythbackend[15922]: [console is not interactive, using default 'no']
>>>> dec 13 00:28:14 htpc mythbackend[15922]: 2020-12-13 00:28:14.115914 C  Failed to init MythContext.
>>>> dec 13 00:28:14 htpc mythbackend[15922]: 2020-12-13 00:28:14.318164 I  Exiting
>>>> dec 13 00:28:14 htpc systemd[1]: mythtv-backend.service: Main process exited, code=exited, status=130/n/a
>>>> -- Subject: Unit process exited
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> -- 
>>>> -- An ExecStart= process belonging to unit mythtv-backend.service has exited.
>>>> -- 
>>>> -- The process' exit code is 'exited' and its exit status is 130.
>>>> dec 13 00:28:14 htpc systemd[1]: mythtv-backend.service: Failed with result 'exit-code'.
>>>> -- Subject: Unit failed
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> -- 
>>>> -- The unit mythtv-backend.service has entered the 'failed' state with result 'exit-code'.
>>>> dec 13 00:28:14 htpc audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=mythtv-backend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
>>>> dec 13 00:28:15 htpc systemd[1]: mythtv-backend.service: Scheduled restart job, restart counter is at 10.
>>>> -- Subject: Automatic restarting of a unit has been scheduled
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> -- 
>>>> -- Automatic restarting of the unit mythtv-backend.service has been scheduled, as the result for
>>>> -- the configured Restart= setting for the unit.
>>>> dec 13 00:28:15 htpc audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=mythtv-backend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
>>>> dec 13 00:28:15 htpc audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=mythtv-backend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
>>>> dec 13 00:28:15 htpc systemd[1]: Stopped MythTV Backend.
>>>> -- Subject: A stop job for unit mythtv-backend.service has finished
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> -- 
>>>> -- A stop job for unit mythtv-backend.service has finished.
>>>> -- 
>>>> -- The job identifier is 6967 and the job result is done.
>>>> dec 13 00:28:15 htpc systemd[1]: mythtv-backend.service: Start request repeated too quickly.
>>>> dec 13 00:28:15 htpc systemd[1]: mythtv-backend.service: Failed with result 'exit-code'.
>>>> -- Subject: Unit failed
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> -- 
>>>> -- The unit mythtv-backend.service has entered the 'failed' state with result 'exit-code'.
>>>> dec 13 00:28:15 htpc systemd[1]: Failed to start MythTV Backend.
>>>> -- Subject: A start job for unit mythtv-backend.service has failed
>>>> -- Defined-By: systemd
>>>> -- Support: https://www.debian.org/support
>>>> -- 
>>>> -- A start job for unit mythtv-backend.service has finished with a failure.
>>>
>>> Check the /etc/mythtv/config.xml file to see how mythbackend connects
>>> to the database.  That is where it is in Ubuntu and I think it is also
>>> in Debian.  If not, find all the config.xml files using:
>>>
>>> locate config.xml
>>>
>>> That only works if the mlocate package is installed, which I think it
>>> is by default in Debian.  If it is not, install it and then run:
>>>
>>> sudo updatedb
>>>
>>> before doing the locate command.
>>>
>>> The config.xml file will have a <Host>xxxxxx</Host> field which should
>>> have the IP address or hostname to connect to for the database.  It
>>> defaults to "localhost", but may have been changed.  There should be
>>> config.xml files for all users that run MythTV programs.  One use used
>>> by mythbackend, and should be in /etc/mythtv, or maybe under
>>> /var/lib/mythtv, or maybe /home/mythtv/.mythtv.  The others will be
>>> under user directories (/home/<username>/.mythtv) and are used by
>>> mythfrontend.  It is common to just have those copies as links to the
>>> mythbackend config.xml.
>>>
>>> If the <Host> setting is not localhost, then you need to set up
>>> MariaDB or MySQL so that it is accessible from other than localhost.
>>> First, find out whether you are running MariaDB or MySQL:
>>>
>>> sudo systemctl status mysql
>>>
>>> If the result of that in the first line says "mariadb.service" then
>>> you are running MariaDB.  Otherwise it should say "mysql.service" (or
>>> maybe "mysqld.service") and you are running MySQL.  In either case, do
>>> this:
>>>
>>> cd /etc/mysql
>>> grep -ir "bind-address"
>>>
>>> There may be more than one "bind-address" line.  The order that they
>>> are loaded from the config files matters - only the last one loaded
>>> gets used.  So the simple way to make sure only one works is to
>>> comment all of them out by putting a # at the start of the line, and
>>> add a new one with the correct address in it.  Normally, you will find
>>> that there is a /etc/mysql/conf.d/mythtv.cnf file (created by one of
>>> the MythTV packages), which is a good place to put the correct
>>> bind-address line when running MySQL, but less so for MariaDB.  But if
>>> you comment out all other bind-address lines, putting a new one in
>>> mythtv.cnf will work.  Add this line in the [mysqld] section:
>>>
>>> bind-address=::
>>>
>>> The :: bind-address tells MariaDB/MySQL to bind to all available IP
>>> addresses, both IPv4 and IPv6.
>>>
>>> Then restart MariaDB/MySQL:
>>>
>>> sudo systemctl restart mysql
>>>
>>> Now try restarting mythbackend:
>>>
>>> sudo systemctl restart mythtv-backend
>>
>>
>> Also note that $MYTHCONFDIR can be used to point to the location of
>> what's frequently ~mythtv/.mythtv etc. See:
>>
>>    https://www.mythtv.org/wiki/MYTHCONFDIR
> 
> Here is some additional information:
> 
> - As seen below it is /lib/systemd/system/mythtv-backend.service that is trying to start the backend.
> - It sets Environment=HOME=/var/lib/mythtv but there is no config.xml in /var/lib/mythtv.
> - I ran /usr/bin/mythbackend with no arguments as root and then it started up.
> - I ran /usr/bin/mythbackend with no arguments as mythtv and then it started up.
> - Should I create a /etc/systemd/system/mythtv-backend.service to overwrite settings in
>    /lib/systemd/system/mythtv-backend.service and with what values?
> 
> cat /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
> Environment=HOME=/var/lib/mythtv
> EnvironmentFile=-/etc/default/mythtv-backend
> ExecStart=/usr/bin/mythbackend $EXTRA_ARGS
> StartLimitBurst=10
> StartLimitInterval=10m
> Restart=on-failure
> RestartSec=1
> 
> [Install]
> WantedBy=multi-user.target
> 
> 
> locate config.xml
> 
> /etc/mythtv/config.xml
> /home/mythtv/.mythtv/config.xml
> /root/.mythtv/config.xml
> /usr/share/doc/mythtv-backend/contrib/config_files/config.xml
> /usr/share/doc/mythtv/examples/config_files/config.xml
> /usr/share/mythtv/config.xml
> 
> 
> locate mythtv-backend.service
> 
> /etc/systemd/system/multi-user.target.wants/mythtv-backend.service
> /usr/lib/systemd/system/mythtv-backend.service
> /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/mythtv-backend.service
> /var/lib/systemd/deb-systemd-helper-enabled/mythtv-backend.service.dsh-also
> 
> 
> systemctl status mythtv-backend
> 
> ● mythtv-backend.service - MythTV Backend
>       Loaded: loaded (/lib/systemd/system/mythtv-backend.service; enabled; vendor preset: enabled)
>       Active: failed (Result: exit-code) since Mon 2020-12-14 22:21:41 CET; 37s ago
>         Docs: https://www.mythtv.org/wiki/Mythbackend
>      Process: 19714 ExecStart=/usr/bin/mythbackend $EXTRA_ARGS (code=exited, status=130)
>     Main PID: 19714 (code=exited, status=130)
> 
> dec 14 22:21:41 htpc systemd[1]: mythtv-backend.service: Scheduled restart job, restart counter is at 10.
> dec 14 22:21:41 htpc systemd[1]: Stopped MythTV Backend.
> dec 14 22:21:41 htpc systemd[1]: mythtv-backend.service: Start request repeated too quickly.
> dec 14 22:21:41 htpc systemd[1]: mythtv-backend.service: Failed with result 'exit-code'.
> dec 14 22:21:41 htpc systemd[1]: Failed to start MythTV Backend.
> 
> I really appreciate your help and detailed explanations.
> 
> /Peter
> 
The simplest method would probably be to 'systemctl edit mythtv-backend.service'.

This will allow you to edit the file above and put the correct home directory in, probably something 
like 'Environment=HOME=/home/mythtv/.mythtv'.

-- 

Mike Perkins



More information about the mythtv-users mailing list