You are not logged in.
This is a in relation to a post I made some time ago that received no replies but is still relevant.
My DVB card uses the dvb_bt8xx kernel module and it does not work until I manually remove and reload the module.
I have been looking around for a solution again and have found nothing.
I have tried to install a work-around script and have systemd load it but it doesn't work for some reason unless I do it manually. Here's the service unit
# /etc/systemd/system/dvb_bt8xx.service
#
# Systemd unit file to reload the BT878 kernel module
#
# Work-around for a bug documented in these places:
# https://bbs.archlinux.org/viewtopic.php?id=170389
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/366606
#
[Unit]
Description=Reload dvb_bt8xx kernel module
ConditionFileIsExecutable=/etc/systemd/scripts/dvb_bt8xx
Before=lxc@tvserver.service
After=systemd-modules-load.service
[Service]
Type=oneshot
ExecStart=/etc/systemd/scripts/dvb_bt8xx
[Install]
WantedBy=lxc@tvserver.serviceand here is the script it invokes:
#!/bin/bash
#
# Systemd script to reload the BT878 kernel module
#
echo "Removing module dvb_bt8xx"
rmmod -v dvb_bt8xx
sleep 5
echo "Loading module dvb_bt8xx"
modprobe -v dvb_bt8xxThis has no effect during boot. It is executed and it does what it should, but the dvb card doesn't work. I have stated that it should start afer the systemd kernel module load and finish before my TV server container starts up (I run a vdr server in a Linux container). The unit here is installed on the host system.
If I manually do a "systemctl start dvb_bt8xx" and re-start my vdr system, everything works fine.
If anyone has had problems with their btxxx and can offer any advice that would be appreciated. Ideally I would like to fix the problem and remove the need for a work-around.
If the module re-load work-around is the only solution then I'd appreciate any information that might make the above unit work during booting.
Thanks.
Offline
What does systemctl status dvb_bt8xx/systemds journal say? When is lxc@tvserver.service started? Try adding this to your service file:
WantedBy=default.targetThis should run dvb_bt8xx unit twice.
The issue itself is with the bt8xx module which probably leaves hardware in a different state after unloading and therefore works second time. I have two bt878 compliant cards laying around, but will not be able to test them, before next system shutdown (which could be days/weeks). The proper solution is to fix the driver, either contact (previous) developers or dig into it yourself.
Offline
Here's my log after adding the second WantedBy (and re-enabling the unit so the link gets created). The unit is still only executed once, however.
# journalctl -b -u dvb_bt8xx
-- Logs begin at Tue 2014-03-25 09:57:55 GMT, end at Sat 2014-03-29 11:27:05 GMT. --
Mar 29 11:19:22 myhost dvb_bt8xx[757]: Removing module dvb_bt8xx
Mar 29 11:19:23 myhost dvb_bt8xx[757]: Loading module dvb_bt8xx
Mar 29 11:19:23 myhost dvb_bt8xx[757]: insmod /lib/modules/3.13.7-1-ARCH/kernel/drivers/medi
Mar 29 11:19:23 myhost systemd[1]: Started Reload dvb_bt8xx kernel module. I thought I'd also try just having the script do it twice but that didn't help either.
It's a pain because I have to stop vdr so it releases its hold on the module then systemctl start the unit and then restart vdr again. I am currently working around the problem with a little script that I execute when logging into my desktop
#!/bin/bash
lxc-attach -n tvserver -- systemctl stop vdr
systemctl start dvb_bt8xx
lxc-attach -n tvserver -- systemctl start vdrI've had a search in the kernel sources and I'll see if I can contact the driver's maintainer.
Offline
As for the workaround you could add this to the dvb_bt8xx.service:
ExecStartPre=lxc-attach -n tvserver -- systemctl stop vdror maybe even better to use systemds options Conflicts, PropagatesReloadTo, ReloadPropagatedFrom and others. There is a sufficient number of options to do this within systemd entirely without the need for outside scripts. You can use that whole reload module sequence in multiple (or a single long one) ExecStart options. Just watch out for formatting requirements which come with systemd.
But that should not be needed in the first place. I ask again: When is lxc@tvserver.service started? I assume that it starts the vdr server, please post content of that service. It might be more productive to change it, instead of lurking around.
If I manually do a "systemctl start dvb_bt8xx" and re-start my vdr system, everything works fine.
This made me think about hardware state issues, but obviously from your recent post, the dvb modules where not released (properly).
What modules do you have loaded? I have seen people suggesting blacklisting certain modules, because of dvb. Maybe the driver needs a specific modules load order to work properly, which still should be handled by the driver itself. Are there any options for bttv module or any other dvb module specified? From your other post is seems the correct card id is used (according to CARDLIST.bttv you should be using card id 104).
Offline
The "lxc@tvserver.service" is started along with a number of other LXC instances. This is done before any attempt to reload the dvb module. The tvserver is a Linux Container (LXC) that runs "vdr". The container itself is booted using systemd and that starts vdr. All of that bit works fine. I don't think it's the problem and I don't really want to change that as it works well. Here's the unit contents anyway:
[Unit]
Description=LXC Container %i
ConditionPathExists=/var/lib/lxc/%i/config
[Service]
Type=forking
ExecStart=/usr/bin/screen -dmS systemd-%i /usr/bin/lxc-start -n %i
ExecStop=/usr/bin/lxc-stop -n %i --kill
KillMode=control-group
Restart=no
[Install]
WantedBy=lxc.targetI modified my unit to do the tasks of both the wrapper script and the module reload script. It still doesn't work during boot, only afterwards. I think this is because It's unable to do the "lxc-attach", probably because, although the unit that starts the "tvserver" has completed, the container hasn't finished booting and the necessary things aren't in place. I don't know if its possible to make a unit depend on a service inside a container. That would probably help this situation.
The only difference in lsmod before and after restarting is that the "in use" cound for dvb_bt8xx changes from 1 to 7. Everything else is the same. I don't know enough to know how to investigate that further. I don't think there are any module options in play here (but I am not sure how I would confirm that - I have not specified any though).
Another possibility that I could try is to allow the tvserver container to load/unload modules and then do the load/unload from inside the container. I don't like this, as it gives the container more capability than it needs and it ties it more closely to the host environment's kernel version (it can only load modules for the same version as the kernel which would require updating the container whenever I update the host, something I don't always do).
I'm rambling a bit now ![]()
Offline
I don't know if its possible to make a unit depend on a service inside a container
If lxc services are started from the host, then using Type=oneshot and After, Before statements should take care of that. Just like you did with dvb_bt8xx.service, lxc@tvserver.service should run after dvb_bt8xx.service exits. You would have to sequence every part (or at least those which are relevant) of lxc.target. From the container side, I am not sure, but systemd should function analogously inside and outside.
I have stated that it should start afer the systemd kernel module load and finish before my TV server container starts up
This is done before any attempt to reload the dvb module
So which one is it? If the last one, then why not the other way around? Usually you should have all modules loaded and running (meaning functioning properly) before starting a container that uses those modules. I would try installing dvb_bt8xx.service in another target prior to that lxc, or delay lxc. Even better, get the dvb device working without lxc first, then try to run with lxc alongside. Maybe doing everything by hand step by step will get you in right direction and save you time.
Offline