[mythtv-users] Udev rules on upgrade?

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Jul 22 00:49:33 UTC 2017


On Fri, 21 Jul 2017 23:07:07 +0100, you wrote:

>On 21/07/17 20:54, Bill Meek wrote:
>> On 07/21/2017 12:47 PM, Simon Hobson wrote:
>>> Mike Perkins <mikep at randomtraveller.org.uk> wrote:
>>>
>>>> Now, in the old system I had udev rules to give the tuners repeatable aliases and I'm wondering,
>>>> since udev got swallowed by the monster, if they have to be put somewhere else now... or if
>>>> anything else in that subsystem has changed.
>>>
>>> No, AIUI you are now (under systemd law) not allowed to decide for yourself what devices get
>>> called what, that decision has been taken for you by LP and his friends at RedHat - because they
>>> are so incredibly clever that they know better than any of us how we might want to use our
>>> systems. And of course, it's so easy to go and find every instance of eth<something> in all the
>>> packages and config files and scripts that use it when something changes - much easier than just
>>> changing one line in udev rules :-/ You could try raising a bug report, but they seem to get
>>> filtered by the undocumented wontfixd ;-)
>>>
>>> Have you considered Devuan, the distribution for people that like(d) Debian but want control of
>>> their systems ?
>>> It still uses udev (but without the systemd screwups) for now, there are people working on
>>> alternatives. From my reading of the mailing list, vdev is usable for many devices and they'd like
>>> more people testing it - or you can still with the udev you already know (and which worked for you).
>>>
>>> PS - the Devuan project welcomes all refugees from Debian, those with admin/dev/packaging skills
>>> especially welcome.
>>>
>>
>> OK, more off topic ;). but if users prefer not to use
>> the "predictable names", then the bottom of this
>> page will help:
>>
>>  https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
>>
>> For Mike, the following works on my 16.04 box (the subsystem_device
>>  and SYMLINK may be backwards, I didn't check):
>>
>> $ cat /etc/udev/rules.d/hauppauge.rules
>> SUBSYSTEM=="dvb", \
>>     KERNEL=="dvb?.frontend0", \
>>     ATTRS{subsystem_vendor}=="0x0070", \
>>     ATTRS{subsystem_device}=="0x7444", \
>>     SYMLINK+="dvb/hvr-1600"
>>     TAG+="systemd"
>>
>> SUBSYSTEM=="dvb", \
>>     KERNEL=="dvb?.frontend0", \
>>     ATTRS{subsystem_vendor}=="0x0070", \
>>     ATTRS{subsystem_device}=="0x7911", \
>>     SYMLINK+="dvb/hvr-1250"
>>     TAG+="systemd"
>>
>> $ sudo udevadm trigger --subsystem-match=dvb
>>
>> $ ls -l  /dev/dvb/hvr-*
>> lrwxrwxrwx 1 root root 18 Jul 21 14:38 /dev/dvb/hvr-1250 -> adapter1/frontend0
>> lrwxrwxrwx 1 root root 18 Jul 21 14:38 /dev/dvb/hvr-1600 -> adapter0/frontend0
>>
>> See also: https://www.mythtv.org/wiki/Systemd_mythbackend_Configuration
>>
>I already use something similar to this on the old system, shown below:
>
># Create a symlink /dev/dvb/adapter-T-0 pointing to Nova T with serial 4034659290
>SUBSYSTEM=="dvb", ATTRS{manufacturer}=="Hauppauge", ATTRS{product}=="Nova-T Stick", 
>ATTRS{serial}=="4034659290", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter-T-0/%%s 
>$${K#*.}'", SYMLINK+="%c"
>
># Create a symlink /dev/dvb/adapter-T-1 pointing to Nova T with serial 4034657139
>SUBSYSTEM=="dvb", ATTRS{manufacturer}=="Hauppauge", ATTRS{product}=="Nova-T Stick", 
>ATTRS{serial}=="4034657139", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter-T-1/%%s 
>$${K#*.}'", SYMLINK+="%c"
>
># Create a symlink /dev/dvb/adapter-T2-0 pointing to PCTV 290e with serial 000000104KK5
>SUBSYSTEM=="dvb", ATTRS{manufacturer}=="PCTV Systems", ATTRS{product}=="PCTV 290e", 
>ATTRS{serial}=="000000104KK5", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter-T2-0/%%s 
>$${K#*.}'", SYMLINK+="%c"
>
>(This works perfectly.)
>
>The "Predictable Network Names" don't interest me here since my tuners are USB. The reason I asked 
>was because, when I looked in /etc/udev/rules.d the directory was empty, missing the usual 
>"70-persistent-network.rules" and "70-persistent-cd.rules". I wondered where they had gone. The web 
>page referenced above explains what was decided and why. I'm not going there.
>
>I have also investigated Devuan but, with currently 12 hosts and counting, changing is not an option 
>at present, though I might consider a move in the future. It's taken me 8 months so far just to 
>upgrade everything I already have from Wheezy to Jessie without breaking anything, the two myth 
>boxes being the final step. I don't have  the time for the hassle of moving distributions as well.

You might also want to add something like this:

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"

That allows you to set up mythbackend to only run after your tuners
are available, by adding things like this to its systemd unit:

Wants=dev-dvb-adapter0-frontend0.device
After=dev-dvb-adapter0-frontend0.device
Wants=dev-dvb-adapter1-frontend0.device
After=dev-dvb-adapter1-frontend0.device
Wants=dev-dvb-adapter2-frontend0.device
After=dev-dvb-adapter2-frontend0.device

I had to do that when I moved to booting from a fast NVME SSD as it
was starting before all the tuners were ready, due to them having to
load their firmware.

This is what I have in my test box to fix the stupid ethernet names:

root at lith:/etc/udev/rules.d# cat 20-network.rules
# Asus P5K-E motherboard
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:1f:c6:24:64:ce",
NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:07:e9:11:c5:95",
NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:1b:21:25:13:96",
NAME="eth2"

If you have a UPS on your server, be aware that systemd is actually
capable of refusing to shut down on command under some circumstances,
saying its shutdown or reboot target is "unsafe" or some such
description.  I get this sometimes on my laptop, but have as yet not
been able to work out why.  To fix it, I have to manually shut down
mythbackend and sometimes also restart lightdm.  Then a shutdown
command will work.  So your UPS shutdown script may need to check the
results of the shutdown command and take remedial action if it fails.

When using systemd, I get very frustrated by having to type it
stupidly long command names all the time.  So I have this set up:

root at mypvr:~# cat .bash_aliases
alias sc='systemctl'
alias jc='journalctl'
alias sco='systemctl stop'
alias scs='systemctl start'
alias scr='systemctl restart'
alias scst='systemctl status'


More information about the mythtv-users mailing list