Tvheadend unreachable - service fails to start

Hi,

Tvheadend has been working flawlessly for several years. At some point in the past two days it has encountered an error that causes the service to abort. Here is the relevant log info taken from journalctl:

Jul 04 12:38:10 osmc-rpi3 systemd[1]: tvheadend.service: Main process exited, code=killed, status=6/ABRT
Jul 04 12:38:10 osmc-rpi3 systemd[1]: tvheadend.service: Unit entered failed state.
Jul 04 12:38:10 osmc-rpi3 systemd[1]: tvheadend.service: Failed with result 'signal'.
Jul 04 12:38:15 osmc-rpi3 systemd[1]: tvheadend.service: Service hold-off time over, scheduling restart.
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: main: Log started
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: tcp: No systemd socket: creating a new one
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: http: Starting HTTP server 0.0.0.0:9981
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: tcp: No systemd socket: creating a new one
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: htsp: Starting HTSP server 0.0.0.0:9982
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: config: loaded
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: config: scanfile (re)initialization with path <none>
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: profile: wrong class profile-transcode!
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: profile: wrong class profile-transcode!
Jul 04 12:38:25 osmc-rpi3 tvheadend[2618]: profile: wrong class profile-transcode!

what is the source of this sudden error? Any help would be greatly appreciated.

Respectfully,

Have you tried manually re-starting tvh?

sudo systemctl restart tvheadend

Yes, I’ve restarted the service, and also rebooted the Pi while removing 1 adapter at a time, then both, same result.

I’ve run tvheadend as root (sudo tvheadend) and I don’t get this error, but of course get access denied with Kodi …

Is the service running or not? What do you see on the console when you restart tvheadend via systemctl?

The service does start and is active/running, but has the same error profile: wrong class profile-transcode!.

The webserver is not reachable as well. Yet, when run as root, the webserver is up, yet default login credentials don’t work …

Sounds to be some config corruption. Can you start from scratch with a virgin tvh config? For this rename or remove directory

/home/osmc/.hts

and restart the device.

I don’t know anything about the transcode profile and can’t find any documentation on it.

I don’t use profiles at all and it works fine.

Can you get us a full set of debug logs, please?

I’d like to avoid starting with a fresh config (time constraints).

I’ve grabbed logs and uploaded here: https://paste.osmc.tv/olucatogav

Thanks,

At a first glance I cannot see the root cause. Could you create some tvheadend debug info and maybe upload here?

  1. sudo systemctl stop tvheadend
    
  2. sudo /usr/bin/tvheadend -d -p /run/tvheadend.pid -C -u osmc -g video 2>purgeme.log 1>purgeme.log
    
  3. if you don’t get back the prompt (tvheadend does NOT crash after 20-30 seconds): ctrl+C
  4. paste-log purgeme.log
    

(and provide the returned URL here)

  1. rm purgeme.log
    
  2. paste-log /etc/systemd/system/multi-user.target.wants/tvheadend.service
    

(and provide the returned URL here)

Why have you omitted the system log? It can sometimes show things that the kernel log (dmesg) doesn’t include.

Here is the purgeme.log: https://paste.osmc.tv/otumekoxik

Same info, nothing new revealed … :expressionless:

I did not intentionally omit the system log. The grab-logs command appeared to hang so I interrupted it, inspected the file, and did not notice system log was missing.

I have rerun the command now in a screen session and it has completed. Here it the complete log file: https://paste.osmc.tv/xajusoruva

Thanks,

Mmmh, there are 3 strange things with the data you provided:

  1. the original error you see trying to start tvheadend
  2. the System Journal error we see in the full logs
  3. a modified ‘tvheadend.service’ file compared with the current service file we have with OSMC packages

Some suggestions to this:

  1. try to modify step 2 in my post above and use
    sudo /usr/bin/tvheadend -d --fileline -p /run/tvheadend.pid -C -u osmc -g video 2>purgeme.log 1>purgeme.log
    (perhaps you can get with --fileline the last config file and line number tvheadend has processed before the error … which could give a hint what is corrupt in your configuration)
  2. only idea which comes to my mind for the system journal error: Is this SD card still 100% error free and fully operating?
  3. the systemd service file of tvheadend look different compared to my systems; you could try to
    sudo apt update && sudo apt install --reinstall armv7-tvheadend-app-osmc
    which should reinstall tvheadend and don’t touch the tvheadend config (at least my configs persist on my systems here)

Regarding the suggestions:

  1. Using --fileline did not yield different results: https://paste.osmc.tv/arojutiqor
  2. I’m not aware of any issue with the SD card, but that is certainly a possibility.
  3. Reinstalling the tvheadend package did not resolve the problem, same error in systemctl status.

Thanks,

The only thing I’ve found regarding this error is the following post at tvheadend forums:
https://tvheadend.org/issues/4106

I have renamed the corrupt .hts directory and rebooted – tvheadend is working again.

I would hope to find the corrupt file or directory in the config so that I can restore most of it …

Apologies for misreading the log.

In addition to the TVH and system journal problems, there are a couple of other anomalies that might suggest an old (and failing) SD card:

  1. In spite of you having run many updates and installed many packages, the APT logs are empty.
  2. I might be misinterpreting this but in the /boot contents section, preseed.cfg has a date of 24 Sep 2016. If that’s when you installed OSMC, the SD card is surely due for a replacement.

Thanks - I hadn’t noticed the empty apt logs. And yes, the preseed.cfg file timestamp is correct … so, looks like it’s time for a new card, fresh install.

Respectfully,

After a smooth first run through the tvheadend config wizard, the PVR is back in action and working as desired.

Regarding a clean install of OSMC on a new SD card, I’ve noticed that OSMC offers one optimized for media center use. Have you found it to significantly out perform and outlast something like a SanDisk ultra?

That’s good to hear. I think you did pretty well to get almost 4 years from your SD card.

Regarding the OSMC SD card, I can’t speak from personal experience, not owning one, and I don’t have any knowledge of the card over and above what’s already stated in the description. Perhaps @sam_nazarko can add some further information.

I am still using some SD cards from 4 years ago for builds without issue.