<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 12/19/18 5:39 AM, Ian Campbell
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:bf8db7204eff3d176aa151ecaa7e1011d75688fb.camel@hellion.org.uk">
<pre class="moz-quote-pre" wrap="">On Wed, 2018-12-19 at 14:33 +1300, Stephen Worthington wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Tue, 18 Dec 2018 15:46:40 +0000, you wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Mon, 2018-12-10 at 17:03 -0500, James Abernathy wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">on my production system I use without issue the systemd override
provided by.
sudo systemctl edit mythtv-backend.service
[Unit]
After=NetworkManager-wait-online.service
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
I notice that a lot of the examples (general ones, not myth
specific)
on the web seem to also have a Wants= line with the same target. Is
there some subtle distinction between having one vs having both
lines?
(I don't run systemd on my myth box and don't really grok this
systemd
thing).
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
The distinction is not at all subtle. If you have an "After=" line,
then the unit with that line will not be started until the specified
unit has completed startup. But if you do not have a "Wants=" (or
"Requires=" or something similar), and there is no other cause for the
Wants= unit to be started, it will not be started, and then your
After= unit will also not be started. After= sets up ordering between
units. Wants=, requires= and the like cause startup of other units.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
IOW the use of `After=` only, withouit some other `Want=` or similar
dependency is likely insufficient to ensure the thing is run at all?
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">I also see that the service referenced in [0] is named `network-
online.service` (but that it says to enable `NetworkManager-wait-
online.service` to satisfy it). Maybe that doesn't matter and
you've
just harmlessly "dereferenced" one link in a dependency chain.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
The network-online.target (not .service) is a systemd "special"
target. It happens when minimal networking is available. That
usually means that only the localhost interface is available - to
meet
the requirements for network-online.target, only one interface needs
to be available, and localhost is normally the one that comes up
first
as it is pure software and does not need to wait for any hardware.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
This contradicts
<a class="moz-txt-link-freetext" href="https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/h">https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/h</a> which
says re `network-online.target` (under "How do I make sure that my
service starts after the network is really online?"):
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">This will ensure that all configured network devices are up and have
an IP address assigned before the service is started.
network-online.target will time out after 90s. Enabling this might
considerably delay your boot even if the timeout is not reached.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Are you saying the "all configured network devices" statement here is
incorrect (or somehow misleading?), contrary to what you said below
(trimmed) it also says "an IP address assigned" not merely "up".
Nevertheless, James, have you tried following the suggestions on that
systemd documentation page, specifically using:
After=network-online.target
Wants=network-online.target
_and_ enabling the `NetworkManager-wait-online.service` (to satisfy the
network-online.target)? I think that would be:
# systemctl enable NetworkManager-wait-online.service
According to the page the command to check is:
# systemctl is-enabled NetworkManager-wait-online.service
I think that is definitately worth trying before getting into other
more complex workarounds suggested here. If it doesn't work I'd also
encourage you to report a bug with your distro, at the very least the
docs need fixing to not so unambiguously recommend this as the approach
to use if it isn't actually intended to work that way.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Also, it is fairly common for server PCs not to run NetworkManager,
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Note that the OP who I was addressing does appear to be using
NetworkManager.
Ian.
</pre>
</blockquote>
<p>on my test system NetworkManger is installed and enabled because
it's a full Ubuntu 18.04.1 fresh install. I went back to my
documentation I created for my production system and there was a
section that I stole from some smarter person than myself and it
mentions the After=NetworkManager-wait-online.service should get
the network up enough for Mythtv before launching it. However, the
mythhdhrrecorder goes a lot further out on the network than the
original mythtv-backend.</p>
<p>On my production system which is Ubuntu server based (originally
16.04, now upgraded in place with 18.04) with no desktop
installed, I also have Network Manager enabled. I used these
instructions which produced a workable system back when I had PCIe
capture cards and HDHR without mythhdhrrecorder:</p>
<p>-------------------------------------<br>
</p>
<p> </p>
<ol>
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> Now we need to fix some startup issues because of
the move to ‘systemd’ instead of the ‘init’ in mythbuntu
16.04. Here’s some guidance I used from Stephen Worthington.</p>
</li>
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> Because I have network tuners and remote
frontends, the default systemd file for mythtv backend is
broken, and needs to be fixed. The HVR-2250 is a tuner that
has a slow firmware upload, so I will likely need to make
mythtv backend wait until the tuners are up before starting.</p>
</li>
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> Create a new set of rules for udev that produce
systemd events for the tuners. Create a new file in
/etc/udev/rules.d. I have called mine 99-mythbackend.rules.
Put this in it:</p>
</li>
</ol>
<font style="font-size: 10pt" size="2">SUBSYSTEM=="video4linux",
TAG+="systemd"</font><br>
<font style="font-size: 10pt" size="2">SUBSYSTEM=="dvb",
TAG+="systemd"</font><br>
<font style="font-size: 10pt" size="2">SUBSYSTEM=="firewire",
TAG+="systemd"</font>
<ol start="4">
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> Create a new directory
/etc/systemd/system/mythtv-backend.service.d where you put an
override file for systemd to override some of the settings
from the package installed file
(/lib/systemd/system/mythtv-backend.service) that controls
mythbackend startup and shutdown. </p>
</li>
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> Create a new .conf file in the new
mythtv-backend.service.d directory. I have called mine
mythtv-backend-override.conf. This is what I needed for the
HVR-2250 which creates two devices on /dev/dvb0 and dev/dvb1:</p>
</li>
</ol>
<p class="western" style="margin-bottom: 0in; line-height: 100%;
orphans: 0; widows: 0">
<font style="font-size: 10pt" size="2">[Unit]</font><br>
</p>
<br>
<font style="font-size: 10pt" size="2">Wants=dev-dvb-adapter0-frontend0.device</font><br>
<font style="font-size: 10pt" size="2">After=dev-dvb-adapter0-frontend0.device</font><br>
<font style="font-size: 10pt" size="2">Wants=dev-dvb-adapter1-frontend0.device</font><br>
<font style="font-size: 10pt" size="2">After=dev-dvb-adapter1-frontend0.device</font><br>
<br>
<font style="font-size: 10pt" size="2">After=NetworkManager-wait-online.service</font><br>
<p><i>The final ‘after’ line tells systemd to wait until
NetworkManager
has the network fully up and running, instead of just the
localhost
interface being up. That allows mythbackend to find the
external IP address it is configured for, otherwise it will
immediately shut down again. It also means that mythbackend
will be able to talk to the HDHR tuners, which it does
immediately
after startup. If it cannot talk to them then, it will mark
them as failed and not try to use them after that</i>.</p>
<ol start="8">
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> I installed NetworkManager; not sure I had, but
the next step worked better if I did.</p>
</li>
<li>
<p style="margin-bottom: 0in; line-height: 100%; orphans: 0;
widows: 0"> Check if the NetworkManager-wait-online.service is
enabled:</p>
</li>
</ol>
<font style="font-size: 10pt" size="2">systemctl
status NetworkManager-wait-online.service</font><br>
<br>
<p class="western" style="margin-bottom: 0in; line-height: 100%;
orphans: 0; widows: 0">
See the "enabled" on the third line. If that is not
present, then you need to enable the service:</p>
<p class="western" style="text-indent: 0.5in; margin-bottom: 0in;
line-height: 100%; orphans: 0; widows: 0">
<font face="Courier, serif"><font style="font-size: 10pt" size="2">systemctl
enable NetworkManager-wait-online.service</font></font></p>
<p>-------------------------------------------------------<br>
</p>
<p>I have not tested:</p>
<pre class="moz-quote-pre" wrap=""> After=network-online.target
Wants=network-online.target
</pre>
<p>but will sometime today. However, since mythhdhrrecorder falls
completely apart if it can't discover the hdhr tuners using the
external website, I think I'll keep the ping script and
full-internet.service in place.</p>
<p>Jim A</p>
<p><br>
</p>
<p> </p>
</body>
</html>