"no free adapter available" after kodi/machine resume from sleep
#1
I have tvheadend set up and working great. However when the box goes into sleep, when it resumes I can't play any live TV. "no free adapter available".
Restarting the box fixes it. I have doubled checked and there's no other PVR add-ons that could be using the card.

I'm using openelec.

I can only seem to find similar issues where restarting the box causes this. But restarting the box for me fixes it! Only caused by resuming from sleep.

Has anyone encountered this before?

Thanks
Reply
#2
I know this problem quite well. Although i dont use openelec.
I set up a normal lubuntu 16.04 and start into kodi on startup. But I encountered your problem because my system didnt unmount the driver for m tv-card when going to sleep. so the adapter is already in use, when you resume.
As I use lubuntu 16.04 and systemd and I am only a user not a developer I kinda did try and error and solved the problem for me.
If you are interested I can share my config with you.
Reply
#3
Yes please ninjafuchs that would be great.
I think I remember seeing an option relating to unmounting, but it was a text entry field and I didn't know what to enter or what it required..
Reply
#4
Maybe that is something, that you could try out.
I for myself wrote a little service file.
First you have to find out which modules you have to unload.
you can use: dmesg|grep DVB or lsmod|grep dvb

so my modules are: budget, budget_core, dvb_core and saa7146

Unfortunately the order of unmounting and mounting seems to have influence on this topic.

So you need sudo rights and create a file:
I chose: /etc/systemd/system/kodi-suspend.service
and wrote in it:

[Unit]
Description=stop tvheadend, dvb-module und xbox-controller treiber
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/systemctl stop tvheadend.service
ExecStart=/sbin/modprobe -r budget
ExecStart=/sbin/modprobe -r budget_core
ExecStart=/sbin/modprobe -r dvb_core
ExecStart=/sbin/modprobe -r saa7146
ExecStop=/sbin/modprobe saa7146
ExecStop=/sbin/modprobe dvb_core
ExecStop=/sbin/modprobe budget_core
ExecStop=/sbin/modprobe budget
ExecStop=/bin/systemctl start tvheadend.service

[Install]
WantedBy=sleep.target

afterwards save the file and enable it with this command:

sudo systemctl enable kodi-suspend.service


I hope this will help you. Again I like to point out that this worked for me and I dont use openelec (never tried it) and I am on a lubuntu 16.04 system with systemd.
Reply
#5
(2017-09-14, 11:23)ninjafuchs Wrote: Unfortunately the order of unmounting and mounting seems to have influence on this topic.
Ah! I did try doing
Code:
lsmod
and putting in a few of the dvb looking modules into the kodi setting of "unload modules before suspend" setting but it didnt seem to work. Perhaps it was the order that was making it not work. There was no indication that anything was being unmounted or not though. Is there a way to check to see what gets unmounted before suspend?

Does your order of unmounting have any relationship to
Code:
lsmod
output?
Reply
#6
Tried several combinations and none seem to work.

I've tried several combinations of
Code:
rc_dvbsky m88ds3103 rc_core dvb_core

If I also include smipcie it causes Kodi to become unresponsive when suspend is select. It doesn't freeze as the fanart background slideshow still rolls.

This is my output of lsmod


Code:
##############################################
#                  OpenELEC                  #
#             http://openelec.tv             #
##############################################

OpenELEC (official) Version: 7.0.1
Backroom:~ # lsmod
Module                  Size  Used by
8021q                  15457  0
rc_dvbsky               1199  0
ts2020                  5943  1
m88ds3103              11047  1
i2c_mux                 2422  1 m88ds3103
intel_powerclamp        6983  0
intel_rapl              8800  0
snd_hda_codec_realtek    53013  1
snd_hda_codec_generic    43541  1 snd_hda_codec_realtek
snd_hda_codec_hdmi     31926  1
snd_hda_intel          20548  3
snd_hda_codec          70076  4 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel
snd_hda_core           28354  5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
snd_hwdep               4819  1 snd_hda_codec
smipcie                10170  1
rc_core                14638  3 smipcie,rc_dvbsky
dvb_core               72343  2 smipcie,m88ds3103
Backroom:~ #
Reply
#7
I am sorry to disappoint you but, but this is beyond my knowledge. But I think that you almost found all modules.
But for testing you can try to unmount the modules one after the other and mount them afterwards manually.
Maybe this will give you a hint to the correct order.
See this topic kept me testing for days. Maybe there is a other way, but I simply dont know it.
Reply
#8
Is there any logs or anywhere to check if the unmounting is happening and happening correctly?
Also is there a way I can simulate the sleep, (unmounting and mounting manually and then restarting tvheadend manually?) so I can try different combinations without having to reboot / sleep and wake the machine each time?
Reply
#9
Of course is this possible.
Just try and execute every line after the other (without the ExecStart or ExecStop in the beggining but most likely you will need sudo rights).
If nothing is returned then the command succeded. If there is a return something went wrong.
Reply
#10
This is pretty puzzling to me. I have the same issue using an hdhomerun device on LibreELEC. I can see in the tvheadend web gui that the adapters are not there after resume. I don't really see anything that I can identify as a related kernel module, nothing like the modules mentioned above. Mostly what I see in journalctl is errors relating to the system trying to run user space drivers like dvb_hdhomerun and dvb_hdhomerun_fe in a startup script. Everything in the journalctl entries has tvheadend as part of the message. I would be very curious and grateful if someone could point me in the right direction to solve this issue.
Reply
#11
(2017-09-26, 02:31)zeke2135 Wrote: This is pretty puzzling to me. I have the same issue using an hdhomerun device on LibreELEC. I can see in the tvheadend web gui that the adapters are not there after resume. I don't really see anything that I can identify as a related kernel module, nothing like the modules mentioned above. Mostly what I see in journalctl is errors relating to the system trying to run user space drivers like dvb_hdhomerun and dvb_hdhomerun_fe in a startup script. Everything in the journalctl entries has tvheadend as part of the message. I would be very curious and grateful if someone could point me in the right direction to solve this issue.

This is puzzling, as the dvb_hdhomerun drivers are quite outdated. They were needed previously to tie the HDHR network tuners into Linux's v4l/dvb subsystem. However, there are HDHR drivers and a frontend in Tvheadend, and they have been there for quite some time now; conversely, the dvb_hdhomerun drivers have not been updated in ages.

The fact that LE is shipping such kludges in a current release is one more reason to stay away from them.

LE's version of Tvheadend has also had quite a few issues about network connectivity and not properly starting up or binding to an interface is there was no internet connection; perhaps this problem is a further extension of LE's poor Tvheadend install.
Reply
#12
I actually switched to Libreelec from openelec to see if that would solve the issue for me but it hasn't. I need to try and do more manual testing of manually unmounting and remounting. But I'm not quite sure what I should be looking for our checking when doing it manually to confirm it is working.
Reply
#13
(2017-09-26, 09:58)IssacBinary Wrote: I actually switched to Libreelec from openelec to see if that would solve the issue for me but it hasn't.
Yes me too. Actually in openelec 8 tvheadend will not even start.

Anyway, I discovered a workaround that works for me. I simply disabled stopping and starting the tvheadend service on sleep and resume by modifying the tvheadend.power script. I have no idea if that is a good idea in general but it works for me so far. All I do is watch live tv, in particular I don't have scheduled recordings. So I would be really nervous about recommending doing this workaround to anyone else w/o knowing why the default is to stop and start the service and w/o considering any unintended consequences.
Reply
#14
(2017-09-26, 03:02)rpcameron Wrote: This is puzzling, as the dvb_hdhomerun drivers are quite outdated. They were needed previously to tie the HDHR network tuners into Linux's v4l/dvb subsystem. However, there are HDHR drivers and a frontend in Tvheadend, and they have been there for quite some time now; conversely, the dvb_hdhomerun drivers have not been updated in ages.

I'm not clear on how all this is organized and works. I think I understand what you're saying, and I think the drivers in my installation are the ones in tvheadend you referred to. I don't think the dvb_hdhomerun drivers are there, but the scripts to run them are. Why, I don't know. It might actually be from the openelec installation that I had originally, in which tvheadend did not run at all, and from which I migrated to libreelec.
Reply

Logout Mark Read Team Forum Stats Members Help
"no free adapter available" after kodi/machine resume from sleep0