Hdhomerun Prime busy after restart

Do you want advice about what hardware to buy for use with MythTV? Ask here.

Moderator: Forum Moderators

Post Reply
JeffDwork
Junior
Posts: 15
Joined: Sat Apr 29, 2017 7:25 am
United States of America

Hdhomerun Prime busy after restart

Post by JeffDwork »

My two HdHomeRun Primes are connected to a dedicated network interface configured link-local. If I restart the tuners, mythtv gets confused and thinks the restarted tuners are all busy. The only solution I have found is to delete the tuners and add them back in.

Anyone know what's happening?
mythpi
Junior
Posts: 18
Joined: Thu Jan 13, 2022 3:38 pm
United States of America

Re: Hdhomerun Prime busy after restart

Post by mythpi »

Have you tried restarting the mythtv backend service AFTER the tuners have completed their restart (don't change anything, just restart it)?

I suspect this is another symptom of the problem where if the network isn't fully connected, mythtv bails on the tuners, and never seems to fully recover.
JeffDwork
Junior
Posts: 15
Joined: Sat Apr 29, 2017 7:25 am
United States of America

Re: Hdhomerun Prime busy after restart

Post by JeffDwork »

Backend restart makes no difference.
hdhomerun_config has no problem finding the tuners and they all show ch=none
User avatar
paulh
Developer
Posts: 909
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: Hdhomerun Prime busy after restart

Post by paulh »

Just wondering why a restart of the backend wouldn't work something must be changing when you restart the HdHomeRun? Could the prime be using DHCP and it's IP address is changing each time?
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: Hdhomerun Prime busy after restart

Post by PhilB »

I have had an oddity with my HDHR this week which may be related.

The HDHR and the backend both get their IP addresses from a DHCP server (on a pihole) which gives fixed addresses. I wait for 'hdhomerun_config discover' to return zero before starting the backend.

After a backend shutdown and reload the backend kept giving tuner failures. I could ping the HDHR and hdhomerun_config discover returned zero.
Restarting the backend and a backend reboot did not fix it, but power cycling the HDHR then restarting backend did. I am not sure why this particular reload caused it.

http://info.hdhomerun.com/info/hdhomerun_config suggests that you can reboot the HDHR with:
hdhomerun_config FFFFFFFF set /sys/restart self

I don't know when this will occur again but I have altered my backend startup file (triggered by an override file) to:
loop waiting for 'hdhomerun_config discover' to return zero
reboot the HDHR
sleep 2
loop waiting for 'hdhomerun_config discover' to return zero


The sleep is needed because an immediate discover returns zero.

The files I have used (in my xubuntu setup) are:
/etc/systemd/system/mythtv-backend.service.d/override.conf

Code: Select all

[Unit]
After=network-online.target
Wants=network-online.target
[Service]
ExecStartPre=/usr/local/bin/mythbackendpre.sh
and /usr/local/bin/mythbackendpre.sh

Code: Select all

#!/bin/bash
function waitforhdhr(){
  echo "waiting for HDHD" >> $LOG
  for i in $(seq 30); do
   hdhomerun_config discover > /dev/null 2>&1
   if [ $? -eq 0 ]; then
	echo "Found hdhomerun at try $i" >> $LOG
	return
   fi
   sleep 2
  done
  echo "Cannot find hdhomerun after 30 tries" >> $LOG
  exit 1
}

# run before backend starts 
sleep 5

LOG=/tmp/mythtvbackendpre.log
echo $(date)>$LOG

# Clear and delete pending flags

#get database password:
PASS=`grep Password /home/mythtv/.mythtv/config.xml | sed 's/ *<\/*Password>//g'`
#clear flags
SQLLINE="UPDATE recorded SET deletepending = 0 where recgroup = 'Deleted' or recgroup = 'LiveTV';" 
echo "$SQLLINE" >> $LOG
echo $SQLLINE | mysql --database=mythconverg --user=mythtv --password=${PASS} >>$LOG 2>&1

#wait until hdhomerun is up and running (and network up)
waitforhdhr
echo "Rebooting hdhomerun" >> $LOG
hdhomerun_config FFFFFFFF set /sys/restart self
sleep 2
waitforhdhr
exit 0

The file includes the code to clear out any ghost files left after deletion. Of course, this HDHR problem happens so unpredictably that I may never know with confidence whether it works. It will of course have to be modified to handle two HDHRs.

Views?
Phil
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: Hdhomerun Prime busy after restart

Post by PhilB »

An update -

I have established that once Mythtv/HDHR are in the 'broken' state a backend restart will not bring it back to life but a reboot
of the HDHR and backend restart will.
I originally thought that the tuners were still in a locked state but they show status of not locked.

Unfortunately, that has not fixed the original problem of why it gets in that state. It will run happily with my test
recordings but then later will fail with messages in the backend log like this:

Could not find channel '' in DB for source '2'.

Once they start, nothing works until I reboot + backend restart.

Now this is a new setup which will replace AMD + Hauppauge with a NUC + HDHR. The database has a mixture of old and new recording rules.
Channel numbering has changed completely.

Any ideas anyone?

A few questions for JeffDwork:

Have you done any database migration from one system to another?
Have you changed tuners?
Do you have any recording rules which pre-date the HDHRs?

Phil
Post Reply