TVHeadend Server not restarting after power loss

What I noticed is after pulling the plug the active time was incorrect. It seems to be pulling the wrong active time from somewhere. Also, the dvr information is from the day before.

The active time is correct after rebooting.

When tvh starts the time set is not correct. It is the original problem as it were before.
If time-sync doesn’t help you could delay starting tvh a little. Try adding this line under Service in file service.tvheadend42.service

ExecStartPre=-/bin/sh -c "sleep 10"

I did the above and I still get a server does not respond properly message after pulling the plug. Below is the status:

 service.tvheadend42.service - TVHeadend42 Service
     Loaded: loaded (/storage/.kodi/addons/service.tvheadend42/system.d/service.tvheadend42.service; enabled; vendor preset: disabled)
     Active: active (running) since Fri 2021-08-06 07:43:19 PDT; 3 months 9 days ago
    Process: 4055 ExecStartPre=/bin/sh -c sleep 10 (code=exited, status=0/SUCCESS)
   Main PID: 5076 (tvheadend)
      Tasks: 27 (limit: 1735)
     Memory: 246.3M
     CGroup: /system.slice/service.tvheadend42.service
             ├─5076 /storage/.kodi/addons/service.tvheadend42/bin/tvheadend -B -C -u root -g video -c /storage/.kodi/userdata/addon_data/service.tvheadend42
             ├─5622 sh /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_url -u http://192.168.1.83:6077/xmltv.xml
             └─5623 wget -q -T 60 -O - http://192.168.1.83:6077/xmltv.xml

Nov 15 07:43:39 CoreELEC tvheadend[5076]: subscription: 0002: "DVR: Rob on the Road" unsubscribing from "KVIEHD"
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: "Rob on the Road" on "KVIEHD": End of program: Time missed
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: "PBS NewsHour" on "KVIEHD" recorder starting
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: About to set stop timer for "PBS NewsHour" on "KVIEHD" at start 1636678800 and original stop 1636680600 and overall stop
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: "KCRA 3 News at 5pm" on "KCRA-TV" recorder starting
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: About to set stop timer for "KCRA 3 News at 5pm" on "KCRA-TV" at start 1636678800 and original stop 1636680600 and overal
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: "NBC Nightly News With Lester Holt" on "KCRA-TV" recorder starting
Nov 15 07:43:39 CoreELEC tvheadend[5076]: dvr: About to set stop timer for "NBC Nightly News With Lester Holt" on "KCRA-TV" at start 1636680600 and original stop 163668
Nov 15 07:45:30 CoreELEC tvheadend[5076]: xmltv: /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_url: grab /storage/.kodi/addons/service.tvheadend42/bin/tv_grab_u
Nov 15 07:45:30 CoreELEC tvheadend[5076]: spawn: Executing "/storage/.kodi/addons/service.tvheadend42/bin/tv_grab_url"

Ignore the time on Active line because now with using sleep command doesn’t matter. You could try to increase the time.

I tried increasing the time to 100 and it seems that Tvheadend isn’t starting:

 service.tvheadend42.service - TVHeadend42 Service
     Loaded: loaded (/storage/.kodi/addons/service.tvheadend42/system.d/service.tvheadend42.service; enabled; vendor preset: disabled)
     Active: activating (start-pre) since Mon 2021-11-15 08:09:43 PST; 3s ago
Cntrl PID: 5667 (sleep)
      Tasks: 1 (limit: 1735)
     Memory: 108.0K
     CGroup: /system.slice/service.tvheadend42.service
             └─5667 sleep 100

Nov 15 08:09:43 CoreELEC systemd[1]: Starting TVHeadend42 Service...

One thing I’ve noticed is it takes several minutes to get to the CoreELEC boot screen (this isn’t new) when I pull the plug. It is a lot quicker if I just do a reboot. Also, I have a USB drive connected to the box if that matters.

Seems some strange device :slight_smile:

I changed the sleep to 20 and it seems to be happy with that for now. I guess 100 was too much for some reason.
I have a feeling this is going to be an ongoing battle…

1 Like