Backend on Pi 4

For discussion of topics specific to MythTV on Raspberry Pi devices
User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Mon Aug 26, 2019 9:32 am

MikeB2013 wrote:
Mon Aug 26, 2019 8:42 am
kojaked wrote:
Sat Jul 13, 2019 5:20 am
Dare I ask: how well does commercial flagging work on a Pi 4?
I don't use commercial flagging, I just use 30 second forward skip to run past commercials.

Mike
The same for me. I have found that with my OTA recordings, it misses more than it gets right. So I adjusted the forward skip to 60 seconds and the backward to 15. Most commercials over here are 4-5 minutes these days.

Jim A

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Sun Oct 27, 2019 2:15 pm

MikeB2013 wrote:
Tue Jul 23, 2019 7:46 pm
pgbennett wrote:
Sat Jul 06, 2019 12:38 pm
mythtv-light does include the backend so it should not be necessary to build from source. Also the wiki guides should give all the info on setting up the database etc. although that info is in the "Build from source" article https://www.mythtv.org/wiki/Build_from_ ... tall_tasks
Attached is a helper script (by product of my testing mythtv-light builds) to automate the setting up of mythbackend after mythtv-light (30 or 31pre) has been installed on a Pi 4 or a Pi 3.
In brief, see comments in script for more details:

Installs mariadb-server, creates mythconverg database (password is mythtv) and sets daily backup
Installs mythweb
Installs xmltv
setup mythtv user for running mythbackend
setup various directories on the file system for recordings etc. uses /srv/mythtv/
setup logging with rotation
setup systemd mythtv-backend.service file
setup remote access

The script is provided "as is" but any comments are welcome.
Just download the file,unzip, make sure it is executable and run it.

Edit : 20190822 attachment updated to fix issue with daily backup on mythtv-light 30

Mike
in studying the script I see that only the systemd service for mythtv backend was setup and not any override for waiting on the network to be up so the network tuners like HDHR don't fail.

Did you use a networked tuner? and if you did, how did you delay mythtv-backend until the network was up. I tried the raspi-config boot options of wait for networking, but that screws up a lot of other things.

MikeB2013
Senior
Posts: 516
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Backend on Pi 4

Post by MikeB2013 » Sun Oct 27, 2019 2:38 pm

Jim,

I use a SiliconDust HD HomeRun CONNECT QUATRO (Model: HDHR5-4DT, Firmware: 20190621) all I have done is set "Wait for network" using Raspberry Pi Configuration screen (or sudo raspi-config in a terminal session).

My Raspberry Pi's get ip address from my router.

This works for me and I do not see any other problems.

Can you expand on "screws up a lot of other things" ?


Mike

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Sun Oct 27, 2019 2:51 pm

MikeB2013 wrote:
Sun Oct 27, 2019 2:38 pm
Jim,

I use a SiliconDust HD HomeRun CONNECT QUATRO (Model: HDHR5-4DT, Firmware: 20190621) all I have done is set "Wait for network" using Raspberry Pi Configuration screen (or sudo raspi-config in a terminal session).

My Raspberry Pi's get ip address from my router.

This works for me and I do not see any other problems.

Can you expand on "screws up a lot of other things" ?


Mike
When I first turn on "Wait for network" everything seems to work as you'd expect, but if I add fstab mount statements for NFS drives, then next boot I don't have a menu at the top of the screen. It may appear and go away or it may only show a white bar. if I have a terminal shortcut on the desktop I can get in and check stuff, but I've never been about to fix it. So for now I do not wait for network and do a systemctl stop/start mythtv-backend. I had this menu issue even back on Stretch on a RPi3B+ when I'd use NFS mounts in fstab. I have a lot of my scripts and stuff on a NAS so once of my first moves is to get access to that.

MikeB2013
Senior
Posts: 516
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Backend on Pi 4

Post by MikeB2013 » Sun Oct 27, 2019 5:07 pm

I don't use nfs much, but I have run a quick test from my pi4 using nfs to a test server (xubuntu 18.04 LTS).

Without Wait for network enabled my share does not get connected
It is fine if Wait for network is enabled, but this could be luck as I have done nothing extra with systemd to ensure nfs is connected.
In all cases no problems with display.

My Pi4 fstab is as follows:

Code: Select all

pi@pi4-20191006:~ $ cat /etc/fstab 
proc            /proc           proc    defaults          0       0
PARTUUID=83c29599-01  /boot           vfat    defaults          0       2
#PARTUUID=83c29599-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
/dev/disk/by-uuid/c69b1b51-2c53-4ce3-a099-5aa3d077b702    /   ext4    defaults,noatime  0       1
192.168.0.22:/mnt/sharedfolder   /srv/sharedfolder   nfs   defaults,timeo=900,retrans=5,_netdev	0 0

Code: Select all

pi@pi4-20191006:~ $ df -h
Filesystem                      Size  Used Avail Use% Mounted on
/dev/root                       220G   99G  110G  48% /
devtmpfs                        1.7G     0  1.7G   0% /dev
tmpfs                           1.8G     0  1.8G   0% /dev/shm
tmpfs                           1.8G  8.9M  1.8G   1% /run
tmpfs                           5.0M  4.0K  5.0M   1% /run/lock
tmpfs                           1.8G     0  1.8G   0% /sys/fs/cgroup
/dev/mmcblk0p1                  253M   53M  200M  21% /boot
192.168.0.22:/mnt/sharedfolder  234G   66G  157G  30% /srv/sharedfolder
tmpfs                           367M     0  367M   0% /run/user/1000
Details of your Pi4 fstab will help.
Also details of any other configuration changes you have made e.g. dhcpcd.conf (used instead of Network Manager on Raspbian)

Mike

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Sun Oct 27, 2019 7:23 pm

so I tested this by:
1. putting my NFS entries in /etc/fstab
2. running sudo raspi-config and turning on "wait for Network" in the boot options.
3. rebooting

So once the system has rebooted I have all my NFS drives mounted, mythtv-backend is running with all HDHR tuners working correctly. So you would think; success. However, no menu. I have a screenshot of the desktop with no menu, but can't get it posted here. It's on Google drive at:

https://drive.google.com/file/d/1UsFmDg ... sp=sharing


pi@rpimythtv:~ $ cat /etc/fstab
proc /proc proc defaults 0 0
PARTUUID=d9b3f436-01 /boot vfat defaults 0 2
#PARTUUID=d9b3f436-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
/dev/disk/by-uuid/35a5f7b0-d17c-4d8f-9c0f-bb8bb3bdd20b / ext4 defaults,noatime 0 1
#
#192.168.0.250:/mnt/md0/recorded-tv1 /mnt/recorded-tv1 nfs defaults 0 0
#192.168.0.250:/mnt/md1/recorded-tv2 /mnt/recorded-tv2 nfs defaults 0 0
#
192.168.0.250:/mnt/md0/samba/anonymous /mnt/anonymous nfs defaults 0 0
192.168.0.250:/mnt/md1/samba/public /mnt/public nfs defaults 0 0


pi@rpimythtv:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 916G 206G 664G 24% /
devtmpfs 1.7G 0 1.7G 0% /dev
tmpfs 1.8G 8.0M 1.8G 1% /dev/shm
tmpfs 1.8G 8.9M 1.8G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 53M 200M 21% /boot
192.168.0.250:/mnt/md0/samba/anonymous 1.8T 257G 1.5T 15% /mnt/anonymous
192.168.0.250:/mnt/md1/samba/public 1.8T 273G 1.5T 16% /mnt/public
tmpfs 367M 0 367M 0% /run/user/1000
pi@rpimythtv:~ $

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Mon Oct 28, 2019 12:48 pm

I think I have a workaround. I went back to basics and installed raspbian buster lite and then added the XFCE desktop stuff per the guide on the RPI forum: https://www.raspberrypi.org/forums/view ... p?t=133691

I was able to move the rootfs to the SATA SSD on USB3 and do my normal mythtv -light FE/BE install. I turned on "wait for network" in raspi-config. I also added NFS drive mounts to fstab. No issues with the network not being up before NFS or mythtv-backend needed it. At this point I have not added tv_grab_zz_sdjson_sqlight grabber in for EPG and I have not restored my old database and files in but I'm hoping that has no impact on this problem.

Jim A

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Sun Dec 15, 2019 11:04 pm

MikeB2013 wrote:
Tue Jul 23, 2019 7:46 pm
pgbennett wrote:
Sat Jul 06, 2019 12:38 pm
mythtv-light does include the backend so it should not be necessary to build from source. Also the wiki guides should give all the info on setting up the database etc. although that info is in the "Build from source" article https://www.mythtv.org/wiki/Build_from_ ... tall_tasks
Attached is a helper script (by product of my testing mythtv-light builds) to automate the setting up of mythbackend after mythtv-light (30 or 31pre) has been installed on a Pi 4 or a Pi 3.
In brief, see comments in script for more details:

Installs mariadb-server, creates mythconverg database (password is mythtv) and sets daily backup
Installs mythweb
Installs xmltv
setup mythtv user for running mythbackend
setup various directories on the file system for recordings etc. uses /srv/mythtv/
setup logging with rotation
setup systemd mythtv-backend.service file
setup remote access

The script is provided "as is" but any comments are welcome.
Just download the file,unzip, make sure it is executable and run it.

Edit : 20190822 attachment updated to fix issue with daily backup on mythtv-light 30

Mike
@MikeB2913 I can't run the mythtv-setup from the application menu like I can mythfrontend. It fails to launch with an error. When I look into why I see the properties of the launcher uses "@env@/usr/bin/mythtv-setup"

If I eliminate the @env@ it works. Any reason it's there?

MikeB2013
Senior
Posts: 516
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Backend on Pi 4

Post by MikeB2013 » Fri Dec 20, 2019 1:08 am

Sorry for delay in responding - I have been traveling.

No idea why it's there, it is original code which I have not changed.
I have done nothing to fix any issues with running mythtv-setup from application menu for Raspbian Buster.
I only run mythtv-setup from a terminal on Raspbian.

After mythtv 31 is released I will have a look a seeing if a normal packaged build of mythtv for Raspbian is easily doable (not my area of expertise so it will take a while to get up to speed).

Mike

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Fri Dec 20, 2019 1:37 pm

MikeB2013 wrote:
Fri Dec 20, 2019 1:08 am
Sorry for delay in responding - I have been traveling.

No idea why it's there, it is original code which I have not changed.
I have done nothing to fix any issues with running mythtv-setup from application menu for Raspbian Buster.
I only run mythtv-setup from a terminal on Raspbian.

After mythtv 31 is released I will have a look a seeing if a normal packaged build of mythtv for Raspbian is easily doable (not my area of expertise so it will take a while to get up to speed).

Mike
The reason I use the application menu is I need to launch both the setup and the frontend with the option to disable the CEC stuff and I can't remember that command line so I edit the properties in the application menu for the 2 launch items and then I don't have to remember. I can also pin those launch items to the Desktop or add them to the quick launch box at the bottom of the screen of XFCE4. I have it solved and document for myself so I know how to fix it.

I also noticed that you pull from git Master to add the missing pieces and say in the comments that Master is okay for v30, which it is. It got me thinking about updates. apt upgrade won't do; not that there's a lot in the stuff you're pulling that changes much.

Thanks, for all your work.
Jim A

DennisAnders
Newcomer
Posts: 2
Joined: Tue Jan 21, 2020 11:42 pm
United States of America

Re: Backend on Pi 4

Post by DennisAnders » Thu Jan 23, 2020 7:08 am

MikeB2013 wrote:
Sun Oct 27, 2019 2:38 pm
Jim,

I use a SiliconDust HD HomeRun CONNECT QUATRO (Model: HDHR5-4DT, Firmware: 20190621) all I have done is set "Wait for network" using Raspberry Pi Configuration screen (or sudo raspi-config in a terminal session).

My Raspberry Pi's get ip address from my router.

This works for me and I do not see any other problems.

Can you expand on "screws up a lot of other things" ?


Mike
Hello MikeB2013 and everyone,

MythTV-Light is not cooperating for me. I am trying to use it as a PVR and possibly watch live TV.

I am new to the Forum and new to MythTV. I have been running linux since 1996. I used to compile lots of things including custom kernels but haven't been doing that for several years now, just an occasional venture into compiling something quick and easy that I might need. Now on to my problem.

I am using a SiliconDust HDHomeRun CONNECT QUATRO HDHR5-4US, Firmware: 20190621.
Raspberry Pi 4B, 4 GB
Fresh install of Raspian Buster - updated to date as of 22 Jan 2020
MythTV-Light (Backend and Frontend), MythTV Plugins-light, installed on Pi 4 B.
MythWeb and MariaDB and all the set-up installed using your script on Pi 4 B

During mythtv-setup of tuner card, video source and inputs everything appears to work. In Capture cards The HDHR5-4US shows up as expected and I enable it, in Video Source, I use SchedulesDirect, input my username and password, if finds my two lineups so I select one and select us-broadcast. For Input connections, the HDHR5-4US (with unique ID) shows up, my video source is listed and us-broadcast gets scanned and 56 channels are recognized and saved. I exit Mythtv-setup. Start the backend, run mythfilldatabase -v all . The output from mythfilldatabase shows no errors and appears to get the lineup from SchedulesDirect (DataDirect) and looks like it is working.

MythTV Frontend starts and runs. The Program Guide lists all 56 Channels but none of the Schedules Direct info shows up. Watching Live TV and recording live TV do not work (no audio or video, nothing happens), after menu selection of 'Watch this channel' the screen flashes to black with "Please wait..." centered in the display then flashes back almost instantly to the Mythtv frontend. I get the same results running MythTV frontend from my desktop computer connecting to the backend on the RPI 4 B.

I have done two separate complete installs of Buster and MythTV-light to different SD cards thinking I must have messed something up on the first try. On the second install (as described above) I tried to do no 'extra' configurations, just what was needed to try to get things working. I have gone back through all of the settings trying to find something incorrect but have not been able to find anything that looks incorrect to me. I have no idea where to go from here.

Any suggestions on where to start looking would be greatly appreciated. Any debugging or diagnostics help also appreciated.

Thank you,

MikeB2013
Senior
Posts: 516
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Backend on Pi 4

Post by MikeB2013 » Thu Jan 23, 2020 9:26 am

There are many possible reasons for LiveTV/Recordings not working. The good news is that mythfrontend can connect to mythbackend

I presume you have setup atleast the DEFAULT storage directory using mythtv-setup. On Pi4, using my script, the storage directories are in /srv/mythtv/
The DEFAULT should be set to /srv/mythtv/recordings.

In mythfrontend on the Pi4

Go to Information Centre>System Status>Input Status and check that your HDHR tuners are listed and show as available. If not, check the mythbackend log in /var/log/mythtv/mythbackend.log. A common cause of the HDHR tuners not being found is that during boot sequence mythbackend starts before networking has been fully established. An easy check for this is in a terminal session run "sudo systemctl restart mythtv-backend" if the HDHR tuners are now found you need to set "wait for network" in raspi-config Boot Options and then reboot.

For DataDirect I cannot help, others on this board may be able to help.
Note the next version of MythTV (31) support for the DataDirect guide service from Schedules Direct has been removed. Either of the two XMLTV grabbers for Schedules Direct should now be used.

Mike

DennisAnders
Newcomer
Posts: 2
Joined: Tue Jan 21, 2020 11:42 pm
United States of America

Re: Backend on Pi 4

Post by DennisAnders » Fri Jan 24, 2020 1:19 am

Thank you Mike.

I didn't realize that the storage groups had to be set to the directory that your script set up. I assumed that was just to get something started, like a place holder. I had set the directories in mythtv-setup to use an external harddrive. After correcting my error and using /srv/mythtv/recordings for default group and /srv/mythtv/livetv group, LiveTV works! I haven't tried recording yet.

Information Centre>System Status>Input Status showed my tuner(s) active (before my latest changes and still working).

Should I configure my HDHR5-4US as just one capture card and set the Input device for a max of 4 recordings? Or configure the HDHR5-4US four times as a capture card and then tell the 4 inputs (with max of 1 recording each) to interact and 'Schedule as a group'? I currently have it configured as 4 cards and interacting.

I changed my Video Source>Listings Grabber to "Schedules Direct JSON API (xmltv)", us-bcast. Then worked through the set-up for the line-up/channels and saved and exited. Restarted mythtvbackend and ran 'mythfilldatabase -v all' and watched the flurry of information scroll up the terminal window. After it completed, with no errors, I ran the mythtv frontend and was greeted with live tv and a completely filled 18 day guide schedule!

So, everything so far seems to be working.

I have questions about external storage, NAS vs simply attaching an external hd to the RPI. At the same time I would like to get Raspian to boot from the SD card and then change root to run off an external drive (as detailed in a thread in these forums (I'll find it again before starting)). Do you recall any discussion about NAS vs locally attached harddrives? Have an opinion? Where should I be posting? In the Hardware forum?

I'll be going through the Mythtv documentation again several times trying to get a better handle on what I am doing.

Thanks again,
Dennis

MikeB2013
Senior
Posts: 516
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Backend on Pi 4

Post by MikeB2013 » Sat Jan 25, 2020 5:33 pm

HDHR configuration.
You need 4 Capture cards defined.
For Input Connections, Interaction Between Inputs, Max Recording at 1 and Schedule as Group selected. This will allow multiple channels to be recorded from the same multiplex at the same time using only one tuner.

As far as external disks (both SSD and conventional HD) are concerned, I use them all the time on Pi 2, 3 and 4.

My view, is that than a SD Card on a Pi is fine for mythfrontend, but not for a mythbackend which has a lot disk activity that will likely result in SD card failure. Also an SSD/HD will be faster than most SD cards.

The largest external HD I have used is 2TB, with no issues, just don't connect to Pi whilst Pi is powered, the disk spin up is likely to cause a power surge and lock up the Pi and at worst could corrupt the micro SD card.

For helper script to move /root from the micro SD card to external USB disk (SSD or HD) see viewtopic.php?f=46&t=3232&start=15#p15884

There is one potential issue with various USB3 to SATA converters that in UAS does not always work with Pi4, typically poor transfer speeds, but can have other problems. See
https://www.raspberrypi.org/forums/view ... =usb+quirk
https://jamesachambers.com/raspberry-pi ... sh-drives/

You can use a NAS, "mythtv" user on Pi4 requires the appropriate read/write permissions on the NAS and configure MythTV Storage Directories to point to those on the NAS.

With NAS (I did a quick test a while ago) "wait for network" must be enabled on the Pi, otherwise the NAS will not be seen. You will still need SSD/HD for /root on the Pi 4, it does not have to be large (120 GB SSD is very cheap these days) as recordings will be stored on the NAS,

Mike

User avatar
jfabernathy
Senior
Posts: 260
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Backend on Pi 4

Post by jfabernathy » Sat Feb 22, 2020 1:20 pm

I've been using my mythtv frontend/backend combo on my RPI 4 4GB for a while and have decided to put some more maintenance scripts into cron.daily besides the database backup.

When trying to test the optimize database script in /usr/share/doc/mythtv-backend/contrib/maintenance I found a missing perl lib; libxml-simple-perl. I just did "sudo apt install libxml-simple-perl" to fix it, but for completeness maybe this should be added to "pi-mythbackend-helper.sh"

Jim A

Post Reply