Lester Burnham's Blog

Xubuntu 20.04 & Mythtv 0.31

After spending years running Mythbuntu 14.04 & Mythtv 0.27 both updated to their latest point releases, it nearly time to make the jump to Ubuntu 20.04. After my previous failed testing / blog attempt to upgrade to Linux Mint 18 & Mythtv 0.28, I’ve finally started testing with Xubuntu 20.04

To start off I grabbed the Xubuntu 20.04 amd64 image and set about writing it to a USB drive with Belena Etcher. After installing and updating I set about turning off the screen saver and lock screen, which can be found under Settings>Screensaver. I also installed the nVidia driver for my video card, which can be found under Adittional Drivers.

Install a few frequently used applications as well as Mythtv. I also installed the Mythbuntu theme, because I think it looks more polished.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install synaptic gparted 
sudo apt-get install mythtv mythtv-backend-master mythweb mythtv-theme-mythbuntu

During the install of Mythtv below you will be asked a few questions.

  • Will other computers running mythtv access this backend? Yes, I have remote frontends
  • Will mythweb be the default web page for this server. Yes
  • You need to be added to the mythtv group. Yes

After this, restart the PC for the user to be added properly. I found logging out didn’t register the change properly. Restarting did.

Note: For remote frontends to connect, it seems that you still need to edit /etc/mysql/conf.d/mythtv.cnf and un-comment (#) the bind address to:

bind-address=::

To check the connection from the remote machine, grab the DB password from backend setup or the config.xml on the backend machine’s home directory ~/.mythtv/config.xml and test using code below. Type quit to exit mysql.

mysql -u mythtv mythconverg -p -h "backend IP no quotes"

At this point I formatted and created a mount point for a larger HDD I added to the system for the recordings etc. HDD was formatted as ext4 using gparted. Anything after the ‘#’ is a comment not part of the command.

sudo mkdir /data   #create folder where drive space will appear
sudo blkid         #to find the UUID of the disk for fstab
sudo nano /etc/fstab  #add the following line to fstab with your UUID and mount point
UUID=bbd002dd-a5e6-4863-b58f-93f61cf55c6e    /data    ext4    defaults    0    0  #add to the end of the file and save and exit
sudo mount -a      #to mount drive into data folder (should be no errors)

After you have done that lot. I prepare for starting mythtv setup by copying the mythtv folders over from /var/lib/mythtv/ into our new /data folder with lots of space.

sudo mkdir /data/mythtv
sudo chown mythtv:mythtv /data/mythtv
sudo cp -av /var/lib/mythtv/* /data/mythtv/

Now it’s time to go through Mythtv Backend Setup.

  • General – Set master backend IP. I left this as 127.0.0.1 as this test is local machine only
  • Capture Cards – Add new if there is no entry at the bottom. Right arrow in and accept the defaults. Hit ESC to be asked to save & Exit. Add new to add another tuner, doing the same again, remembering to ESC after finished to save changes.
  • Recording Profiles – I don’t use this
  • Video Sources – I add a new source and call it EIT for over the air guide. Go into it and I then select Australia for frequency table and 7 for scan frequency. (I’m guessing 7mhz which is Australia’s scan frequency). Esc to save.
  • Input Sources – Select a tuner and right arrow in. I left the name and selected EIT as our source. Then from memory, select amount of streams for that tuner (2). Select full scan and then drop below and hit scan. After scan is finished, insert all channels and exit. Set a starting channel and ESC to save. Repeat for other tuner, leaving input name as is.
  • Channel Editor – I edit my channels on the same PC in mythweb http://127.0.0.1/mythweb
  • Storage Directories – Go in and select Default and assign it to /data/mythtv/recordings. Repeat for the other entries. For basics I normally only do recordings, livetv & db-backups.

Exit out of the setup, paying attention to any error messages, selecting yes to start backend and yes for mythfilldatabase. Ignore mythfilldatabase errors in terminal.

It’s now time to start Mythfrontend and go to setup>setup wizard and start the wizard after you decide to upload your PC hardware config. For audio, I normally set it up under the audio option in settings, as it tells you when it is connected to a device as you move through the devices, so you know which options you have. Anyway, using the wizard, I knew it would be one of the ALSA:hdmi:CARD=NVidia,DEV ones, as I am using the HDMI on a nVidia video card. I tryed each one and tested speakers until I found the correct one. Next was video, so I selected VDPAU normal, again because of my nVidia video card.

Time to get the MCE RC6 remote control working. (the part I hate) I am going to use ir-keytable with a couple of tweaks for the buttons above 255 that don’t work out of the box. eg OK & BACK buttons. You can also test with evtest for a bit more info.

sudo apt-get install ir-keytable evtest
sudo ir-keytable    #tells me what remote it has found.
Found /sys/class/rc/rc1/ with:
	Name: Sony PlayTV
	Driver: dib0700
	Default keymap: rc-dib0700-rc5
	Input device: /dev/input/event15
	LIRC device: /dev/lirc1
	Supported kernel protocols: rc-5 nec rc-6 
	Enabled kernel protocols: rc-5 
	bus: 3, vendor/product: 1415:0003, version: 0x0100
	Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc0/ with:
	Name: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815)
	Driver: mceusb
	Default keymap: rc-rc6-mce
	Input device: /dev/input/event7
	LIRC device: /dev/lirc0
	Attached BPF protocols: Operation not supported
	Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm 
	Enabled kernel protocols: lirc rc-6 
	bus: 3, vendor/product: 0471:0815, version: 0x0000
	Repeat delay = 500 ms, repeat period = 125 ms

sudo ir-keytable -t   #test a few remote buttons. ctrl+c to exit

So, it found the MCE remote. The Sony PlayTV is the TV tuners. Hopefully the buttons tested OK. Now time to copy the button mappings over to the default location and modify them. As you can see below, I changed only the ones with comments after them. Don’t change the codes.

sudo cp /lib/udev/rc_keymaps/rc6_mce.toml /etc/rc_keymaps/
sudo mousepad /etc/rc_keymaps/rc6_mce.toml   #to edit button mappings

0x800f0400 = "KEY_0"  #WAS KEY_NUMERIC_0
0x800f0401 = "KEY_1"  #WAS KEY_NUMERIC_1
0x800f0402 = "KEY_2"  #WAS KEY_NUMERIC_2
0x800f0403 = "KEY_3"  #WAS KEY_NUMERIC_3
0x800f0404 = "KEY_4"  #WAS KEY_NUMERIC_4
0x800f0405 = "KEY_5"  #WAS KEY_NUMERIC_5
0x800f0406 = "KEY_6"  #WAS KEY_NUMERIC_6
0x800f0407 = "KEY_7"  #WAS KEY_NUMERIC_7
0x800f0408 = "KEY_8"  #WAS KEY_NUMERIC_8
0x800f0409 = "KEY_9"  #WAS KEY_NUMERIC_9
0x800f040a = "KEY_DELETE"
0x800f040b = "KEY_ENTER"
0x800f040c = "KEY_SLEEP"
0x800f040d = "KEY_M" #WAS KEY MEDIA
0x800f040e = "KEY_MUTE"
0x800f040f = "KEY_I" #WAS KEY INFO
0x800f0410 = "KEY_VOLUMEUP"
0x800f0411 = "KEY_VOLUMEDOWN"
0x800f0412 = "KEY_CHANNELUP"
0x800f0413 = "KEY_CHANNELDOWN"
0x800f0414 = "KEY_FASTFORWARD"
0x800f0415 = "KEY_REWIND"
0x800f0416 = "KEY_P" #WAS KEY_PLAY
0x800f0417 = "KEY_RECORD"
0x800f0418 = "KEY_PAUSE"
0x800f0419 = "KEY_X" #WAS KEY STOP
snip
0x800f0422 = "KEY_ENTER" #WAS KEY_OK
0x800f0423 = "KEY_ESC"  #WAS KEY_EXIT
0x800f0424 = "KEY_DVD"
0x800f0425 = "KEY_F12" #WAS KEY_TUNER
0x800f0426 = "KEY_EPG"
0x800f0427 = "KEY_ZOOM"
0x800f0432 = "KEY_MODE"
0x800f0433 = "KEY_PRESENTATION"
0x800f0434 = "KEY_EJECTCD"
0x800f043a = "KEY_BRIGHTNESSUP"
0x800f0446 = "KEY_TV"
0x800f0447 = "KEY_AUDIO"
0x800f0448 = "KEY_F12" #WAS KEY_PVR

Do a restart and then open Mythfrontend to check your remote is working as it should. Now it’s time to setup a remote control button to launch Mythfrontend (I use this in bed). I’ll use F12, as looking through the mythtv keystrokes, it doesn’t look like it’s assigned to anything else. To do this we’ll install xbindkeys and set a config file in our home directoy.

sudo apt install xbindkeys
xbindkeys --defaults > /home/lester/.xbindkeysrc   #sets config-replace lester with your user
xbindkeys -k    #press F12 to register
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
    m:0x10 + c:96
    Mod2 + F12

So now in our ~/.xbindkeysrc file we’ll add the following to the end, just above end of configuration area.

mousepad .xbindkeysrc   #add below to this file
"/usr/bin/mythfrontend"
    m:0x10 + c:96
    Mod2 + F12

Save, close and reboot again. Now test your remote, by pressing the PVR or TUNER button on your remote control. Mythfrontend should now launch. To change it to another remote control button, just move the F12 entry to another button and re-instate the previous entry in /etc/rc_keymaps/rc6_mce.toml as we did earlier. Then restart PC.

Leave a Reply