[mythtv-users] systemd foo

James Linder jam at tigger.ws
Thu Jan 11 05:09:36 UTC 2024



> On Jan 10, 2024, at 11:31, Stephen Worthington <stephen_agent at jsw.gen.nz> wrote:
> 
> On Wed, 10 Jan 2024 06:13:25 +0800, you wrote:
> 
>> 
>> Multiple Wants on same line and enable again got it working. (many failed tries)
>> 
>> [Unit]
>> Description=MythTV backend service
>> Wants=store.mount dev-dvb-adapter0.mount dev-dvb-adapter3.mount
>> Requires=mysql.service
>> After=store.mount dev-dvb-adapter3.mount dev-dvb-adapter0.mount mysql.service
>> 
>> [Service]
>> Type=simple
>> EnvironmentFile=/etc/sysconfig/mythbackend.env
>> User=jam
>> Group=video
>> ExecStart=/usr/local/bin/mythbackend --logpath /var/log/mythtv $MYTHBACKEND_OPTIONS
>> 
>> [Install]
>> WantedBy=multi-user.target
>> 
>> James
> 
> dev-dvb-adapter<x>.mount is wrong.  It should be
> dev-dvb-adapter<x>-frontend0.device.  To make this work, you need to
> add these udev rules:
> 
> root at mypvr:/etc/udev/rules.d# cat 99-tuner.rules
> #
> # Create systemd device units for capture devices
> #
> SUBSYSTEM=="video4linux", TAG+="systemd"
> SUBSYSTEM=="dvb", TAG+="systemd"
> SUBSYSTEM=="firewire", TAG+="systemd"
> 
> The "dvb" one is the one you need, but it is best to add them all just
> in case.
> 
> The naming is done the same way as the .mount names:
> 
> Device path: /dev/dvb/adapter0/frontend0
> Becomes:     dev-dvb-adapter0-frontend0.device
> 
> Having those device names wrong will likely be causing a long timeout
> (60 seconds?) before mythbackend is started.
> 
> Make sure you always remember to do:
> 
> sudo systemctl daemon-reload
> 
> every time you make any changes to the systemd files.  Otherwise the
> changes will not be seen.

The deeper I wade in to an area I don’t understand …

I have this

[Unit]
Description=MythTV backend service
Wants=store.mount dev-dvb-adapter0.device dev-dvb-adapter3.device
Requires=mysql.service
After=store.mount dev-dvb-adapter3.device dev-dvb-adapter0.device mysql.service

[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/mythbackend.env
User=jam
Group=video
ExecStart=/usr/local/bin/mythbackend --logpath /var/log/mythtv $MYTHBACKEND_OPTIONS

[Install]
WantedBy=multi-user.target

Initially I forgot to update Wants from .mount to .device
mythbackend started in “off line” mode. Restart worked ok.

Fixed.

mythbackend starts normally after a [guess] 1 minute timeout.
I could just timeout before starting, already subtle timing changes made the service that ‘worked’ for years fail, so I’m keen to not use arbituary delays.

How do I tell if the udev items for systemd are being created?

This hardware, GMK K1, does not generate an event for usb devices at boot time, only for plug events. I can see the device files (adaper[1234]). Any reason to not wait for .mount on those instead of .device ?

cheers
james


More information about the mythtv-users mailing list