[mythtv-users] Mythbackend may be starting too soon?

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Jul 3 09:41:16 UTC 2017


On Sun, 2 Jul 2017 14:40:45 -0400, you wrote:

>On 07/02/2017 01:19 PM, Don Brett wrote:
>> Is there a way make mythbackend wait until the network is ready?
>
>
>If you are using systemd, which mythbuntu should be using, look at your 
>mythtv-backend.service file. You should find it somewhere under 
>/lib/systemd. It should include these lines. I believe there was a 
>version where one of the items in these lines was misspelled.
>
>[Unit]
>Description=MythTV Backend
>Wants=mysql.service network-online.target
>After=mysql.service network-online.target

The network-online.target in the
/lib/systemd/system/mythtv-backend.conf file is insufficient to allow
external network access - it happens when the first network interface
comes up, which is normally localhost (127.0.0.1).  You need to make
mythbackend wait until full network access is available.

Do NOT edit the /lib/systemd/system/mythtv-backend.conf file.  It will
be overwritten next time the mythbackend package is updated.  Instead
you need to create an override file that modifies mythtv-backend.conf,
using the mechanism prescribed by systemd.  To do that, you need to go
to the /etc/systemd/system directory and create a new subdirectory.
Run these commands as root or use sudo at the front:

cd /etc/systemd/system
mkdir mythtv-backend.service.d
chown root:root mythtv-backend.service.d
chmod a=rx,u+w mythtv-backend.service.d
cd mythtv-backend.service.d

In the new subdirectory you need to create your override file.  It can
have any name as long as it ends with .conf.  This will create an
empty file for you to edit:

touch mythtv-backend-override.conf
chown root:root mythtv-backend-override.conf
chmod a=rw mythtv-backend-override.conf

Now edit your mythtv-backend-override.conf file and put in the
overrides needed to make mythbackend wait until the network is up.  In
Mythbuntu 16.04 if you have not disabled Network Manager, then it can
be used to tell when the network is up enough for external accesses to
work.  For that, put these lines in your mythtv-backend-override.conf
file:

[Unit]
Wants=NetworkManager-wait-online.service
After=NetworkManager-wait-online.service

Then run this command (sudo or as root):

systemctl enable NetworkManager-wait-online.service

Then you should be able to reboot and have mythbackend wait until the
network is up before it starts.

There are several previous threads on this list about this problem.


More information about the mythtv-users mailing list