Tvheadend server not responding

After faultless operation of OSMC for quite a while (at least a year) my Tvheadend server has recently stopped working. This was following a crash (which occurred while browsing songs in the Music library) that required a reboot (via ssh).

Since then I’ve been getting pop-ups from the Tvheadend HTSP client saying either the “Server is unreachable” or “Server does not respond properly” and neither can I access the server via a browser from another machine on the LAN (at port 9981) - it just gives an “Unable to connect” message (Firefox). I don’t know if it’s relevant but the Chorus 2 page (at port 8080) doesn’t properly load on a browser either - it just gets stuck on the “Loading Application” animation. I don’t know whether this is different behaviour as I’ve not had reason (that I can remember) to use the web portal before and was just trying it in the process of trying to get to the bottom of the Tvheadend issue.

Here is an extract from the kodi.log file:

20:53:54.030 T:1550840816   ERROR: AddOnLog: Tvheadend HTSP Client: pvr.hts - un
able to connect to 192.168.1.18:9982
20:54:02.171 T:1661989872   ERROR: Previous line repeats 5 times.
20:54:02.171 T:1661989872  NOTICE: [plugin.video.youtube] Startup: detected Kryp
ton (Kodi-17.1), setting DASH_SUPPORT_BUILTIN = False, DASH_SUPPORT_ADDON = True
20:54:05.142 T:1750070256  NOTICE: script.grab.fanart: Grab Fanart Service Start
ed
20:54:05.898 T:1576006640  NOTICE: Skin Helper Service --> WebService - start he
lper webservice on port 52307
20:54:05.899 T:1708127216  NOTICE: Skin Helper Service --> Skin Helper Service v
ersion 1.1.3 started
20:54:07.299 T:1716515824 WARNING: CSkinInfo: failed to load skin settings
20:54:11.535 T:1498412016   ERROR: AddOnLog: Tvheadend HTSP Client: pvr.hts - Co
mmand hello failed: No response received
20:54:11.536 T:1498412016   ERROR: AddOnLog: Tvheadend HTSP Client: pvr.hts - fa
iled to send hello
20:54:21.538 T:1498412016   ERROR: AddOnLog: Tvheadend HTSP Client: pvr.hts - Co
mmand hello failed: No response received
20:54:21.538 T:1498412016   ERROR: AddOnLog: Tvheadend HTSP Client: pvr.hts - fa
iled to send hello

…and so on.

The implication, I guess, is that the server hasn’t been started.

However, tvheadend.service is shown as “enabled” in Programs>My OSMC>Services and a look at (what I think to be) relevant processes returns as follows:

$ ps -eaf | grep tvh
root      1230     1  0 10:40 ?        00:00:00 /usr/bin/tvheadend -f -p /run/tvheadend.pid -C -u osmc -g video
osmc      1236   943  0 10:41 pts/1    00:00:00 grep tvh

The setup is OSMC (March 2017) running on a RaspberryPi 3 with a PCTV 292e USB tuner. Tvheadend server was installed via the OSMC app store. For what it’s worth there are also two external hard drives serving the Video and Music libraries and a USB DAC for audio output to an amp. Some of the USB connections are through a (powered) USB hub. The original crash actually occurred on OSMC (February 2017) - I updated as part of trying to remedy the problem the crash appears to have caused. As I say, prior to that operation had been faultless for quite some time.

Any suggestions as to how to resolve this would be greatly appreciated.

Apologies - I should add, just in case it’s not clear, that the server and client are on the same machine.

We need complete logs, not a snippet.

Many apologies - my bad. Please find the logs here: http://paste.osmc.io/amifemevuw

SOLVED by:

a) uninstalling and reinstalling tvheadend server through the app store.
(This alone didn’t solve the problem. Tvheadend server worked immediately after install but once again, on reboot the original problem as described above recurred.)

b) then changing Type=forked to Type=simple in /lib/systemd/system/tvheadend.service. I don’t know what this does - it was a suggested solution to similar issues with other services that some searches brought up. It may be a dirty hack and have knock on effects but I haven’t experienced anything obvious yet and it does seem to work fine.

FWIW I was also able to replicate the original issue using a completely fresh install of OSMC (March 2017) on a separate fresh SD card - i.e. tvheadend server worked after install but failed in the way described above after a reboot.

Did you install TVHeadend from our App Store?

Yes - every time.