tuning the Pi4 MythTV rig

from 32-bit buster to 64-bit bookworm

frontend without graphical desktop

Since the only thing the pi4 displays is MythTV I didn’t want to lug around the a whole desktop environment or even just a window manager. Under Debian Buster I was able to start just one graphical window from the console:

xinit "mythfrontend" $* -- :0 vt$XDG_VTNR

but this didn’t work after the OS upgrade. It took a couple hours over a few days to figure it out. It seems that X under bookworm requires root privs to run xinit. Fine, I’ll do it:

sudo xinit /usr/bin/mythfrontend -- :1 


The monitor blanking after sitting a while is annoying so I wanted to stop that from happening. Many sources said that:

xset s off
xset s noblank
xset -dpms

… should work. I could do it from the commmand line (ssh’d in from the laptop) but couldn’t it to take effect programatically from the usual places on the pi like .xinitc, Xsession, etc. . If I called it before xinit that program complained it couldn’t find the display. True enough, there wasn’t one running yet. If I moved xinit to a background process with & and called xset afterwards it still complained about no display. What? I knew there was a display running that point.

An hour of Google-fu revealed frequent mention of timing issue and sleep. Ohhhh. xset was running before the X window was fully on its feet. The working invocation is now:

sudo xinit /usr/bin/mythfrontend -- :1 &

sleep 5
export DISPLAY=:1
xset s off
xset s noblank
xset -dpms

dark theme

The Mythcenter-wide theme that comes bundled with MythTV has excellent functionality for my use case:

  1. shows when shows are recording normally (green dot) or if there are signal losses (yellow dot)
  2. shows the progress of the recording (“40% recorded”)
  3. if the show is partially-watched it will show the position (“15% watched”)

The problem it is blindingly bright blue, a problem at night especially when one is trying to be stealthy.

I tried all the dark themes but each was missing one or more of the features above. I decided to see how hard it would to modify the functional theme to be darker. Turned out to be much easier than I thought.

  1. copy /usr/share/mythtv/themes/Mythcenter-wide/ to /usr/share/mythtv/themes/dark-wide/
  2. make a black verion of /usr/share/mythtv/themes/ui/background.png to replace the blue original.
  3. edit /usr/share/mythtv/themes/themeinfo.xml to change the name so there are not two themes that show up as Mythcenter-wide in the theme chooser.
  4. select the new theme in the theme chooser to see if everything looks ok
  5. take a screenshot of the main menu to replace /usr/share/mythtv/themes/preview.jpg so it shows up properly in the theme chooser

The resulting theme isn’t pretty but it is much darker. I’m calling it Good Enough.

disk i/o hangs

While performance is quite good, sometimes if I’m hammering the frontend with rapid changes (like holding down the key to rapidly scroll through the recorded programs) is the pi’s green LED goes solid for a few seconds and everything hangs for a bit…

I wanted to know what was clogging the SD card I/O so I triggered the problem a few times while watching fatrace:1 over ssh:

mariadbd(859): W   /var/lib/mysql/mythconverg/program.MYI
mariadbd(859): R   /var/lib/mysql/mythconverg/program.MYD
mariadbd(859): W   /var/lib/mysql/mythconverg/program.MYD

mariadb is the FOSS fork of mysql after that project was sold. We can see that both Read and Write processes in the MythTV database are involved.

At this point I don’t know if it’s a tuning issue with mariadb, an SD card issue, or something else. It happened on two different Class 10 cards so who knows. If I figure it out I’ll update y’all about it.

  1. this is not a slur against our heavy brothers and sisters. It appears to mean “file access trace”