[mythtv-users] Problem with MythWeb and mythtv-backend being ran from "mythtv" user

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Jul 28 14:25:01 UTC 2017


On Fri, 28 Jul 2017 08:32:59 -0500, you wrote:

>Good morning,
>
>I'm having an issue that is probably a face-palm moment once the problem
>has been found, but wanted to pick the hive-mind.
>
>I am running Ubuntu 16.04.2 LTS, installed MythTV with the MythBuntu
>Control Center and such. This is my second MythTV system, migrating all of
>the recordings/schedules/etc from the original and decomissioning the
>first. There was some headaches in doing so, but things seem to work just
>fine and dandy if I run it as my personal user ($ mythbackend&). The
>problems arise on boot, and the mythbackend process is started with the
>mythtv user account. "service mythtv-backend status" indicates that it is
>running all hunky-dory, and I'm able to use mythfrontend to tune channels,
>but MythWeb (my primary means of scheduling recordings) cannot connect to
>the local DB. If I "service mythtv-backend stop" and then as my personal
>user $ mythbackend&, MythWeb connects no problem and can record, watch TV
>and everything. Rather than put a band-aid and making it run as my user,
>I'd like to get it to run as the correct user.
>
>I have added my user to the "mythtv" group, and mythtv user to my user's
>group. Both mythtv and my personal account also are in the "www-data"
>group.
>
>Any thoughts?
>
>Steve
>Huntsville, AL

That "service" command is out of date - 16.04 uses systemd so you
really should be using the systemd commands to run things.  So that
would be:

systemctl start mythtv-backend
systemctl stop mythtv-backend
systemctl status mythtv-backend

The old service command is now a script that calls systemd anyway, but
it is better to use the right commands as I think that service can run
things the wrong way if there is any misconfiguration.

If mythbackend is set up properly, even when it started from root as a
service, it will be switching to be running under user mythtv.  That
is done by the systemd unit file that runs mythbackend:

root at lith:/lib/systemd/system# cat 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

The line "User=mythtv" means that systemd will be starting mythbackend
under that user.

A possible reason that mythweb is unable to talk to mythbackend is
that it may be using the PC's external IP address to connect to.  If
so, then mythbackend may be starting up before the external IP address
is up and will only be available on localhost.  If that is the case,
then stopping and restarting mythbackend using systemctl should result
in it being able to bind the external IP address and mythweb should
start working.  The fix for that is available in several threads on
this list, such as "Mythbackend may be starting too soon?".


More information about the mythtv-users mailing list