Installing Mythbuntu 14.04.1 with MythTV 0.27
Summary
This tutorial outlines the steps to install Mythbuntu 14.04.1 and
MythTV 0.27 on a custom MythTV PVR.
It's been over three years since we first started the process in May
2011 of cutting
the cord on cable TV,
and selecting
hardware for a custom MythTV PVR. We were happy with our
Mythbuntu 12.04
install, however recent changes with the TV listings provider for
Schedules Direct prompted us to take action.
See Mythbuntu:
Actions required by Nov 1st due to Schedules Direct change.
We chose to move to Mythbuntu 14.04 with MythTV 0.27 and the latest
fixes that work with the new Schedules Direct service. Note that if
you are migrating from an existing Mythbuntu installation and wish to
migrate your recordings, then be sure to read this and other migration
specific articles so that you save the appropriate information before
you begin installing Mythbuntu 14.04. For example,
read Migrating
Mythbuntu 12.04 to Mythbuntu 14.04.
Following are the steps to install Mythbuntu and configure MythTV to
work on the custom MythTV PVR. By the end of this tutorial you will
have a functional PVR.
Update 2018-06-27: Add remote control button mapping for
Teletext and other keys available on Phillips MCE remote control.
Update 2016-08-08: Add "noatime, nodiratime" to /etc/fstab for
/data mount (contains recordings) to reduce hard disk drive wear and
tear.
Contents
- Completed PVR
- A. Setup BIOS
- B. Partition Drive
- C. Create Mythbuntu CD/USB
- D. Install Mythbuntu
- E. Choosing Country, Language, and Database Configuration
- F. Exiting MythTV Frontend after Mythbuntu Boot
- G. Configure Desktop [Optional]
- H. Opening Terminal Window
- I. Enable TV Capture Card
- J. Apply Updates
- K. Install TV, DVD, and HDD Utilities [Optional]
- L. Ensure Full Boot Up After Power Off
- M. Direct Sound Through HDMI on Intel HD Graphics
- N. Install Flashplayer and Firefox
- O. Add Extra MythTV Plugins
- P. Update to latest MythTV Packages [Optional]
- Q. Add New Remote Control Button Mappings
- R. Prepare RAID [Optional]
- S. Setup /data Directory
- T. Setup Static IP Address [Optional]
- U. Create Schedules Direct Account [Optional]
- V. Reboot Computer
- W. Navigating MythTV
- X. Configure MythTV Backend
- Y. Configure MythTV Frontend
- Z. Setup Mythbrowser [Optional]
- AA. Setup Mythmusic [Optional]
- BB. Setup Mytharchive [Optional]
- CC. Create Mythbrowser Bookmarks [Optional]
- DD. Optimize for SSD [Optional]
- Installation Complete
- References
- Future Articles
Completed PVR
Following is a picture of the completed PVR in operation.
Hopefully this picture will provide the incentive to complete the
build of your own PVR.
Although this page has a lot of steps, remember that these only need
to be performed once. The reward of building your own custom PVR will
be worth it. It certainly has been for us.
A. Setup BIOS
Often the default Basic Input Output Settings (BIOS) are fine. However, since I would be providing support to family (three PVRs), I wanted to ensure that each PVR would be the same and would boot properly after a power outage.
To view or change the BIOS settings you usually need to press a key while the computer boots. For this custom PVR the key to press while booting is the Delete key.
On each ASUS P8H61-M motherboard I made sure I had the following BIOS settings:
- Ensure BIOS updated to same level (0702 in May 2011)
- Set dedicated iGPU memory to maximum amount (128 MB)
- Set SATA to AHCI mode
- Set Power ON when power restored
- Disable full screen on bootup
- Change boot order to DVD then USB then HDD
B. Partition Drive
When I set up a computer I like to choose my own custom partition layout. For the PVR I created an MSDOS partition table with the following partition layout:
Path name Partition type Size File system Volume label /dev/sda1 Primary 40690 MiB ext4 mythbuntu1404 /dev/sda2 Primary 8192 MiB linux-swap swap /dev/sda3 Primary ###### MiB ext4 data
NOTE: The last partition (sda3) uses all of the remaining space on the disk.
Though you can create this partition layout with the Mythbuntu installer, I prefer to use a graphical partitioning tool such as gparted from a GParted Live CD-RW. With GParted it is much easier to create new partitions so I will not document the steps.
NOTE:
If you do not wish to create a custom partition layout, then you can
choose to let Mythbuntu create a default partition layout during the
Mythbuntu installation. MythTV will work fine with either setup.
The only difference is that you will need to ignore tutorial steps
that deal with settings using the /data directory. Solid State Drive /dev/sda: Path name Partition type Size File system Volume label /dev/sda1 Primary 40690 MiB ext4 mythbuntu1404 /dev/sda2 Primary 8192 MiB linux-swap swap Hard Disk Drives /dev/sdb and similarly /dev/sdc: Path name Partition type Size File system Volume label Flags /dev/sdb1 Primary ###### MiB unformatted raid The single partition takes up the whole disk, 953869 MiB on an 1 TB drive. RAID 1 Mirror /dev/md0: Path name Partition type Size File system Volume label /dev/md0p1 Primary ###### MiB ext4 data The RAID uses /dev/sdb1 and /dev/sdc1 in a mirror configuration. |
C. Create Mythbuntu DVD/USB
In order to install Mythbuntu, we first need to download the software and write it to a DVD or a USB flash drive.
-
Download Mythbuntu
14.04.1 64-bit .iso
-
Burn the .iso file as an image to a DVD-R(RW),
or write the image to a USB flash drive.
Note that the image is too large to fit on a CD-R(RW).
D. Install Mythbuntu
- Boot computer with Mythbuntu Live DVD.
- When prompted, choose English language
and click on Install Mythbuntu. - Select Download updates while installing
and Install this third-party software (mp3)
and click on Continue. -
If you pre-created the partitions, choose Something else
and click on Continue
NOTE: If you do not wish to custom partition the drive, choose Install Mythbuntu, click on Continue and skip to the next numbered step.
- Select from Device column: sda1
- Click on Change...
- Choose the following setttings:
Use as: Ext4 journaling file system Mount point: / Format the partition: [ ] # Yes if need to erase file system # No will maintain volume label
and click on OK
TIP: If you choose _not_ to reformat a partition, then you will be prompted later with a message similar to:
The file system on /dev/sda1 assigned to / has not been marked for reformating...
Simply click on Continue when this happens. - Select from Device column: sda3
NOTE: If you place the recordings on RAID then skip setting up /data on /dev/sda3. We will set up the RAID later.
Remember to perform the last of this section of steps to select the device for the boot loader installation. - Click on Change...
- Choose the following setttings:
Use as: Ext4 journaling file system Mount point: /data Format the partition: [ ] # Yes if need to erase file system # No will maintain volume label
and click on OK
- Select Device for boot loader installation: /dev/sda
- Click on Install Now
- When prompted Where are you? choose your own
time zone (e.g., Edmonton)
and click on Continue - Choose the Keyboard layout (e.g., English (US))
and click on Continue - When prompted Who are you? choose the following:
Your Name: Personal Video Recorder Computer Name: mythpvr User Name: pvr # You should choose your Password: pvrpassword # own user name and password Login automatically: Yes Require my password to login: No Encrypt my home folder: No
and click on Continue - Choose the Installation type Primary Backend
w/Frontend
and click on Continue - Choose the following Additional Services
SSH: enable # secure shell Samba: disable # windows file system sharing NFS: disable # network file system MythTV: disable # remote frontend connections
and click on Continue - For Infrared Remotes choose the following:
Choose: USB & Serial Remote Support via LIRC (Linux Infrared Remote Control) Choose Remote: Windows Media Center Transceivers/Remotes (all) Generate dynamic button mappings: enable Generate frontend restart mapping (Power followed by Clear): enable
and click on Continue - Grab yourself a fine beverage to enjoy.
*** The installation might take 1/2 hour or so (15 minutes on SSD) *** - When Installation Completed then click on Restart Now
- Remove Live DVD when prompted, press the Enter key and let the PVR reboot.
E. Choosing Country, Language, and Database "Configuration
Choose the country, language, and database configuration settings.
- Choose your country and language.
For example,Country: Canada Language: English
and click on Save. - On Database Configuration 1/2 screen
leave settings alone
and click on Next. - On Database Configuration 2/2 screen
configure the following settings:Enable database server wakeup: enable Reconnect time: 1
TIP: The above database setting prevented the country and language window from popping up every time I rebooted the PVR.
F. Exiting MythTV Frontend after Mythbuntu Boot
In several of the following configuration steps we will need to reboot the computer. By default the computer will boot into the MythTV Frontend. This is perfect for when we are using the computer as a PVR, but since we have more configuration to perform we need to exit out of the MythTV Frontend.
TIP: If prompted with a warning regarding connection to the database, simply acknowledge this by pressing the Esc or Enter key. |
TIP: If prompted with a note that a new version of theme chooser is available then click on OK. |
To exit the MythTV frontend:
- Press Escape key until prompted: Do you really want to exit MythTV?
- Use arrow keys to select Yes, Exit now and press Enter key.
G. Configure Desktop [Optional]
Following are some desktop configuration changes I make to improve my desktop experience, and so that I am not nagged to apply desktop updates.
Ensure Correct Display Resolution
- Start Applications -> Settings -> Display
TIP: If the menu is off-screen, you can right-click to access the menu.
- Choose a Resolution from the drop-down list.
- At the prompt Would you like to keep this configuration? click Keep this configuration.
- Close the window.
Enlarge Desktop Font
- Start Applications -> Settings -> Appearance
- Click on the Fonts tab.
- Change font from Ubuntu 10 to 16.
- Click OK.
- Close the window.
Delay Screensaver
- Start Applications -> Settings -> Screensaver
- Change Blank after from 10 to 500 minutes.
- Close screensaver window.
Turn Off Update Notifier
- Start Applications -> Settings -> Session and Startup
- Click on Application Autostart tab.
- Disable Update Notifier (Check for available updates automatically)
- Click Close button.
H. Opening Terminal Window
Several of the following steps require commands to be entered in a
terminal window.
To open a terminal window:
- Start Applications -> System -> Xfce Terminal
I. Enable TV Capture Card
The driver for the Hauppage WinTV HVR-2250 MC Dual TV Tuner / Encoder card is not included in the default Mythbuntu installation. Hence we will need to install the appropriate driver.
In a terminal window:
- Download the driver.
wget http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164-2010-03-10.1.fw
- Copy the driver to the proper location.
sudo cp -p NXP7164-2010-03-10.1.fw /lib/firmware
NOTE: When prompted to authenticate, use your "pvr" account password.
*** a reboot is needed later to load the firmware ***
CAUTION: Hauppauge Shipping HVR-2255 in HVR-2250 Packaging. |
J. Apply Updates
Because many software updates have been released since the Mythbuntu 14.04.1 was officially released, we should update the software to include the latest bug and security fixes.
- If Software Updater is flashing on top task
bar, then click on Software Updater.
Otherwise select menu option Applications -> System -> Software Updater. - Wait while the Software Updater is checking for
updates
*** This might take 5 minutes or so to finish ***
- Click Install Now.
*** This might take a 1/2 hour or more to download and install all of the updates ***
NOTE: If or when prompted to authenticate, use your "pvr" account password.
- Close window.
- Reboot if prompted and use the Exiting MythTV Frontend after Mythbuntu Boot steps above to get back to the desktop.
K. Install TV, DVD, and HDD Utilities [Optional]
Following are applications I install to help with viewing pictures and creating DVDs. These are optional. However, if you are not familiar with Linux text editors then I highly recommend installing at least leafpad.
In a terminal window, enter the following commands:
-
sudo apt-get install leafpad # Graphical Text Editor
TIP: Start Applications -> Accessories -> Leafpad.
Close the leafpad editor window.
This creates the ~/.config/leafpad/leafpadrc configuration file with the proper "pvr" ownership.
-
sudo apt-get install ivtv-utils # TV Tuner Utilities
-
sudo apt-get install avidemux # Video Editor
-
sudo apt-get install devede # DVD menu creator
-
sudo apt-get install gsmartcontrol # Hard Disk Health Monitor
-
sudo apt-get install ristretto # Picture Viewer
-
sudo apt-get install xfce4-screenshooter # Screenshot tool
L. Ensure Full Boot Up After Power Off
In a terminal window:
- Edit /etc/default/grub
sudo leafpad /etc/default/grub
to add the following two lines to the bottom of the file:
---------- begin lines to add ----------
# Ensure full boot up after power outage
GRUB_RECORDFAIL_TIMEOUT=10
---------- end lines to add ----------TIP: Optionally reduce GRUB boot timeout.
Change GRUB_TIMEOUT from 10 to 5 seconds.
Save the file and exit the editor. - Update the GRUB 2 boot loader with:
sudo update-grub
M. Direct Sound Through HDMI on Intel HD Graphics
Normally sound from your computer is routed through the audio out jacks. This works well when you have speakers connected directly to your computer. However for a PVR, we wish this sound to be directed through the HDMI cable.
In a terminal window:
- Determine the card and device number with the command:
aplay -l
Sample output:
**** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 1: ALC887-VD Digital [ALC887-VD Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0
Check the row containing HDMI for these details. For my PVR it was card 0, device 3. - Create file /etc/asound.conf with command:
sudo leafpad /etc/asound.conf
and paste in the following contents, replacing the card and device numbers with the ones for your computer.
---------- begin file /etc/asound.conf ----------
pcm.hdmi_hw { type hw card 0 device 3 } pcm.hdmi_formatted { type plug slave { pcm hdmi_hw rate 48000 channels 2 } } pcm.hdmi_complete { type softvol slave.pcm hdmi_formatted control.name hdmi_volume control.card 0 } pcm.!default hdmi_complete
---------- end file /etc/asound.conf ----------
Save the file, and exit the editor. - Test you can hear sound with:
speaker-test -Dplug:hdmi -c2 -twav
- Remove pulseaudio package.
sudo apt-get remove --purge pulseaudio
- Reload alsa drivers.
sudo alsa reload
A reboot will also reload the drivers. - Test you can hear default sound setup with:
speaker-test -c2 -twav
N. Install Flashplayer and Firefox
In order to be able to stream live content from the Internet, tools such as Adobe Flashplayer are often required.
In a terminal window:
- Install firefox
sudo apt-get install firefox
- Install flashplayer.
sudo apt-get install --reinstall flashplugin-installer
Flashplayer is installed by default, this command re-installs. - Start Applications -> Internet -> Firefox Web Browser
TIP: If prompted Firefox is not default browser, click Yes.
- Enable Firefox Menu and Bookmarks toolbars.
- Click on the icon with three stacked horizonal bars in the upper right-hand corner of the Firefox window.
- Click Customize
- If prompted, close Hint
- Click Show / Hide Toolbars
- Enable Menu Bar
- Enable Bookmarks Toolbar
- Click Exit Customize
- Create Firefox bookmarks [Optional]
- Select View -> Bookmarks Toolbar
- Remove bookmark Getting started
- Create bookmarks for your local TV stations
For myself, I created the following bookmarks
Global TV* CTV* CityTV CBC google
* These TV stations did not work with native GNU/Linux Firefox. For a solution, see Streaming CTV shows not working with Firefox on Linux.
- Close Firefox.
O. Add Extra MythTV Plugins
To enable MythTV to archive shows to DVD and view web sites we need to install a few extra MythTV plugins.
- Start Applications -> System -> Mythbuntu
Control Center
- Choose Plugins
- Enable the following:
MythArchive MythBrowser
Note the following are left enabled by defaultMythGallery MythMusic MythWeb
- Click on Apply.
NOTE: If or when prompted to authenticate, use your "pvr" account password.
- Click on Quit.
P. Update to latest MythTV Packages [Optional]
If you are not using the Schedules Direct service, then you can skip
this section.
Otherwise, in order to accomodate the
Nov.
1st, 2014 Schedules Direct URL Change, we need to update to
MythTV 0.27.4 or higher. Since this version is not included in the
Mythbuntu 14.04.1 image, we need to enable two repositories and
update packages.
- Start Applications -> System -> Mythbuntu Control Center.
- Choose Repositories.
- Enable Activate MythTV Updates repository.
- Enable Activate Mythbuntu Updates repository.
- Click Apply.
- In Apply Settings? window,
click Apply.
If prompted, provide your "pvr" password. - Close Mythbuntu Control Center window.
- In a terminal window enter:
sudo apt-get update # If prompted, provide your "pvr" password. sudo apt-get upgrade
When prompted with Configuring mythtv-database dialog, tab to No and press Enter
Will other computers run MythTV? <No>
When prompted with Configuring mythweb dialog, tab to Yes and press Enter
Will you be using this webserver exclusively with mythweb? <Yes>
- Close terminal window.
Q. Add New Remote Control Button Mappings
The default Media Center Edition remote control codes are sufficient for operating the PVR. However, I like to add a few more mappings for keys that are not used in the default configuration.
TIP: To learn the remote control keycodes, in a terminal window start the program irw and it will echo the keycodes as you press keys on the remote control. |
The file containing the raw keycodes from the remote control is
/etc/lirc/lircd.conf
.
We need to edit the user file to add additional functions in
~/.lirc/mythtv
.
The keys we wish to re-map are:
Remote Key LIRC Key Key Function ---------- --------- ------ --------- Pictures Pictures PgUp Page Up Music KEY_AUDIO PgDown Page Down Videos KEY_VIDEO End Forward 1 day in TV Guide Radio KEY_RADIO Home Backward 1 day in TV Guide Zoom Aspect W Zoom Subtitle BB2 T Toggle teletext closed captioning ---------- --------- ------ --------- Red* KEY_RED W Zoom Blue* KEY_BLUE T Toggle teletext closed captioning Teletext* Teletext T Toggle teletext closed captioning
[*] Keys available on Phillips 5100 4in1 MCE Remote Control.
- Edit the file ~/.lirc/mythtv
leafpad ~/.lirc/mythtv
and add the following many lines to the end of the file:
---------- begin many lines ----------begin remote = mceusb prog = mythtv button = Pictures config = PgUp repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = KEY_AUDIO config = PgDown repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = KEY_VIDEO config = End repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = KEY_RADIO config = Home repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = Aspect config = W repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = BB2 config = T repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = Teletext config = T repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = KEY_RED config = W repeat = 0 delay = 0 end begin remote = mceusb prog = mythtv button = KEY_BLUE config = T repeat = 0 delay = 0 end
---------- end many lines ----------
Save and exit the editor.
Note to self: Investigate if/how we can use KEY_DVD for the DVD Menu
R. Prepare RAID [Optional]
If you are not using RAID then skip this entire section.
If you choose to store your recordings on RAID, then additional
preparation steps are needed.
The steps in this section were taken
from Setting Up RAID
and Migrating MythTV Recordings and adapted for Mythbuntu 14.04.
- Install Linux Software RAID package.
sudo apt-get install mdadm
TIP: Use TAB or ARROWS to navigate prompts, and ENTER to accept.
- At first Package Configuration screen:
TAB to "Ok" and press ENTER. - At second Package Configuration screen:
ARROW UP to "No configuration", and TAB to "Ok" and press ENTER.
- At first Package Configuration screen:
- Ensure boot from degraded RAID.
- Edit /etc/default/grub.
sudo leafpad /etc/default/grub
Change the line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
By adding "bootdegraded=true" to become:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash bootdegraded=true"
Save the file and exit editor.
- Edit /etc/default/grub.
- Update the boot loader to boot from degraded RAID.
sudo update-grub
NOTE: RAID Monitoring Suggested
In the default configuration, Mythbuntu will not boot if the RAID is in a degraded state (for example, one drive has failed). Hence when a drive in the RAID fails, we will become aware of this by Mythbuntu failing to fully boot up.
Since we change the configuration to continue with boot even in a degraded state, we need another way to know when there are problems with the RAID. Later on we describe how to add basic RAID monitoring.
- Install gparted graphical partitioning software.
sudo apt-get install gparted
NOTE: Mythbuntu 14.04 uses older GParted 0.18.0
This older version of GParted echos many error messages which can be safely ignored. The problem was fixed with GParted 0.19.0. See Prevent GLib-CRITICAL Source ID not found warning messages. - Partition the RAID drive (For example: /dev/sdb and
/dev/sdc).
Run GParted from a terminal window using the following command:
sudo gparted
- Select the /dev/sdb device using the upper right-hand-side drop-down list.
- Use Device -> Create Partition Table to write an msdos (MBR) partition table.
- Select the unallocated space.
- Use Partition -> New to create one new
unformatted primary partition spanning the drive.
NOTE: On my 1 TB drive this is 931.51 GiB or 953,869 MiB. - Use Edit -> Apply All Operations to apply this operation.
- Close the Applying pending operations window.
- Use Partition -> Manage Flags to set
"raid" flag.
- Repeat steps "a" to "g" selecting /dev/sdc this time round.
- Exit gparted.
- Create the RAID level 1 mirror on the drive
partitions (For example: /dev/sdb1 and /dev/sdc1).
sudo mdadm --create /dev/md0 --auto=p --level=1 \
--raid-devices=2 /dev/sdb1 /dev/sdc1
NOTE: Creating RAID will take a long time
Creating the RAID level 1 mirror on my 1 TB drives took 3 hours.
You can use the watch command to frequently check the progress of building the RAID:
watch -n 10 cat /proc/mdstat
Use Ctrl+C to stop watching the progress.
- Partition the RAID.
sudo gparted /dev/md0
- Use Device -> Create Partition Table to write an msdos (MBR) partition table.
- Select the unallocated space.
- Use Partition -> New to create one new
ext4 primary partition spanning the drive with label
"data".
NOTE: On my 1 TB partitioned drive this is 953,738 MiB. - Use Edit -> Apply All Operations to apply this operation.
- Close the Applying pending operations window.
- Exit gparted.
- Update /etc/mdadm/mdadm.conf to re-assemble RAID
with name md0 on boot.
- Add the RAID configuration to the end of the
/etc/mdadm/mdadm.conf file with the following command:
sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
This should add a line like the following to the end of mdadm.conf:
ARRAY /dev/md/0 metadata=1.2 UUID=8d8a88cc:e239f398:8c202a01:d3750e45 name=mythpvr:0
NOTE: If you run this command multiple times, then you will need to edit /etc/mdadm/mdadm.conf to remove the duplicate entries. - Rebuild the current initramfs.
sudo update-initramfs -u
- Add the RAID configuration to the end of the
/etc/mdadm/mdadm.conf file with the following command:
- Create script for mdadm to notify of RAID
problems.
- Create new script file
/usr/bin/mdadm-notify-mythtv.sh
sudo leafpad /usr/bin/mdadm-notify-mythtv.sh
and paste in the following contents:
---------- begin file /usr/bin/mdadm-notify-mythtv.sh ----------
#!/bin/bash # Purpose: To notify user of problems with Linux software RAID # Called by: /etc/mdadm/mdadm.conf # Parameters: 1 - Event, 2 - Device, 3 - Optional Component # # # Write message to MythTV Frontend / MythWelcome # mythutil --message \ --message_text="RAID Status :: $1 :: $2 :: $3" \ --timeout=5 \ --bcastaddr=127.0.0.1 # # Write message to Desktop # notify-send 'RAID Status' "$1 :: $2 :: $3" \ --expire-time=5000
---------- end file /usr/bin/mdadm-notify-mythtv.sh ----------
- Ensure script file is executable.
sudo chmod a+x /usr/bin/mdadm-notify-mythtv.sh
- Create new script file
/usr/bin/mdadm-notify-mythtv.sh
- Add notification script to mdadm configuration.
- Edit /etc/mdadm/mdadm.conf:
sudo leafpad /etc/mdadm/mdadm.conf
add the following two lines:
# notify if problems with RAID
PROGRAM /usr/bin/mdadm-notify-mythtv.sh
The resulting file should look something like the following:
---------- Begin example file mdadm.conf ----------
# mdadm.conf # # Please refer to mdadm.conf(5) for information about this file. # # by default (built-in), scan all partitions (/proc/partitions) and all # containers for MD superblocks. alternatively, specify devices to scan, using # wildcards if desired. #DEVICE partitions containers # auto-create devices with Debian standard permissions CREATE owner=root group=disk mode=0660 auto=yes # automatically tag new arrays as belonging to the local system HOMEHOST <system> # instruct the monitoring daemon where to send mail alerts MAILADDR root # definitions of existing MD arrays ARRAY /dev/md/0 metadata=1.2 UUID=8d8a88cc:e239f398:8c202a01:d3750e45 name=mythpvr:0 # notify if problems with RAID PROGRAM /usr/bin/mdadm-notify-mythtv.sh # This file was auto-generated on Sun, 19 Oct 2014 09:56:47 -0600 # by mkconf $Id$
---------- Begin example file mdadm.conf ----------
- Rebuild the current initramfs:
sudo update-initramfs -u
- Test notification with:
sudo mdadm --monitor --scan --oneshot --test 2>/dev/null
When I ran my tests, I was only able to see a visual indication of any RAID problems while viewing the XFCE desktop. While the MythTV Frontend was running, or when viewing a recording, I did not see a visual indication of RAID problems until after I exited the MythTV Frontend.
- Edit /etc/mdadm/mdadm.conf:
- Create a root crontab file to automatically have
mdadm monitor the RAID at a time when you usually watch TV.
I choose 8:35pm or 20:35 in 24 hour time format.
- Start up the crontab file editor using the
leafpad editor.
sudo sh -c "export VISUAL=leafpad && crontab -e"
- Add and save the following three lines at the
end of the file:
---------- Begin three crontab lines ----------
# # Monitor mdadm RAID and notify if problems 35 20 * * * /sbin/mdadm --monitor --scan --oneshot 2>/dev/null
---------- End three crontab lines ----------
- Confirm the crontab file by listing the contents.
sudo crontab -l
- Start up the crontab file editor using the
leafpad editor.
S. Setup /data Directory
If you did not create a separate /data file system, then you can
skip this section.
From my personal experience, I have found it very useful to store
recordings separate from the operating system. The main reasons are
for ease of migration, upgrades, and failed disk replacement.
In a terminal window:
- Create a /data mount point.
sudo mkdir /data
Note that /data should already exist if /data was specified when installing Mythbuntu. - Determine the UUID of your separate data partition
using a command like:
sudo blkid /dev/sda3
- Edit /etc/fstab to entry to mount /data.
sudo leafpad /etc/fstab
and check for a line for /data.
If no line for /data is found, then add the following lines, replacing the UUID value with the one you discovered in the above step.
---------- begin /etc/fstab lines ----------
# /data on /dev/sda3 UUID=2f02b4a8-acfa-4a09-b809-73d1823d1d01 /data ext4 defaults,noatime,nodiratime 0 2
---------- end /etc/fstab lines ----------
TIP: If using RAID then add an entry like:
---------- begin /etc/fstab lines ----------
# /data on /dev/md0p1 /dev/md0p1 /data ext4 defaults,noatime,nodiratime 0 2
---------- end /etc/fstab lines ----------
- Test mounting the directory.
sudo mount -a
- Change into the directory.
cd /data
- Create sub-directories.
sudo mkdir mythtv mythtv/recordings mythtv/videos \ mythtv/music mythtv/pictures \ mythtv/livetv mythtv/db_backups \ mythtv/mytharchive mythtv/mytharchive/temp \ mythtv/streaming
- Change ownership.
sudo chown -R mythtv.mythtv /data/mythtv
- Change permissions.
sudo chmod -R g+ws /data/mythtv
T. Setup Static IP Address [Optional]
By default Mythbuntu will use a dynamically assigned Internet Protocol (IP) address. Personally I like to have a known static IP address configured so that I can easily remotely connect to the PVR.
If you do not wish to set up a static IP address, then you can skip this step and your PVR will continue to work correctly.
For my PVR I chose:
IP-address: 192.168.1.55
hostname: mythpvr
For the steps to set up a static IP address see the following tutorial:
How To and Why Set Up
a Static IP Address on GNU/Linux
U. Create Schedules Direct Account [Optional]
In North America, television show listings are conveniently provided by a Schedules Direct subscription. MythTV can be configured to automatically use these TV show listings.
If you are not in North America, then consult the MythTV XMLTV page to learn how to acquire TV show listings.
High level instructions on how to create a Schedules Direct account follow.
- Start a web browser and visit http://www.schedulesdirect.org.
- Create an account ($25 USD per year).
Write down all the details you provide. - Set up TV listings.
To get all listings on Schedules Direct: login, refresh all lineups and edit for the channels you desire.
For Over-The-Air broadcasts, I used the name HD Antenna
For Analog Cable connection, I used the name Shaw Cable
For my PVR, I only have an HD antenna connected. I note the Shaw Cable connection for my family and my friends that still have analog cable TV subscriptions.
TIP: To update MythTV immediately, use the following command in a terminal window: mythfilldatabase --dd-grab-all |
V. Reboot Computer
At this point we reboot the computer to ensure all of the above settings become active.
- Start Applications -> System -> Logout
- Choose Restart.
- Exit the MythTV Frontend using the steps described in Exiting MythTV Frontend after Mythbuntu Boot.
W. Navigating MythTV
In some of the following steps we need to navigate through the MythTV backend or frontend and alter values. Rather than detailing each keypress required, I have opted to describe how the keys work.
Key Action --------- ------------------------------ Tab Moves forward through options Shift+Tab Moves backward through options Esc(ape) Backs out of a screen or setting Enter Enters a screen or setting Right arrow Like Enter, but also change value Left arrow Like Esc, but also change value Down arrow Move down through options Up arrow Move up through options
X. Configure MythTV Backend
Before we can use MythTV, we need to tell it about the computer hardware. The MythTV backend handles recording shows and hence must be told about the TV capture card and the TV listings source.
- Start Applications -> System -> MythTV Backend Setup
- Click Yes to close any currently running mythbackend processes.
- Enter your "pvr" account password.
- Configure each of the backend screen settings as
described below:
1. General On Miscellaneous Settings (near File Management Settings) Follow symbolic links when deleting files: Enable Delete files slowly: Enable On Job Queue (Backend Specific) Max simultaneous jobs on this backend: 2 On Job Queue (Global) Start auto-commercial-detection jobs when recording starts: Enable On Program Schedule Downloading Options Automatically update program listings: Enable 2. Capture Cards For ATSC Over-The-Air Antenna (connection LHS from front of PVR): Select New Capture Card Card type: DVB-T/S/C, ATSC or ISDB-T tuner card DVB device number: /dev/dvb/adapter0/frontend0 Recording Options # This was slow to open for me Max simultaneous recordings: 2 Select New Capture Card Card type: DVB-T/S/C, ATSC or ISDB-T tuner card Recording Options DVB device number: /dev/dvb/adapter1/frontend0 Max simultaneous recordings: 2 For Shaw Analog Cable (physical connection RHS from front of PVR): Select New Capture Card Card type: MPEG-2 encoder card DVB device number: /dev/video2 Select New Capture Card Card type: MPEG-2 encoder card DVB device number: /dev/video3 3. Recording Profiles Choose MPEG-2 Encoders (PVR-x50, PVR-500) For each of Default, Live TV, High Quality, Low Quality, Volume (%): 60 See also: How to Fix MythTV Analog Volume Too Loud 4. Video Sources NOTE: Here you will use you schedules direct account New Video Source Schedules Direct - "HD Antenna" Channel frequency table: us-bcast Retrieve lineup New Video Source Schedules Direct - "Shaw Cable" Channel frequency table: us-cable Retrieve lineup 5. Input Connections For ATSC Over-The-Air Antenna: Choose /dev/dvb/adapter0/frontend0 Video source: HD Antenna Name: HDTuner1 Starting Channel: 2_1 Input Priority: +1 Schedule Order: 1 # Ascending order, increment by capture card max simultaneous recordings Live TV Order: 3 # Descending order, to avoid conflicts with scheduled recordings Choose /dev/dvb/adapter1/frontend0 Video source: HD Antenna Name: HDTuner2 Starting Channel: 2_1 Input Priority: +1 Schedule Order: 3 Live TV Order: 1 For Shaw Cable (tuner on LHS near power supply): Choose [MPEG: /dev/video2](tuner) -> (none) Video source: Shaw Cable Name: Shaw Cable Tuner 1 Starting Channel: 3 Choose [MPEG: /dev/video3](tuner) -> (none) Video source: Shaw Cable Name: Shaw Cable Tuner 2 Starting Channel: 3 6. Channel Editor NOTE: For Over-The-Air HDTV broadcasts do a full channel scan. For Analog Cable TV fetch listings from source. Full Channel Scan Icon Download # ~pvr/.mythtv/channels/*.jpg Note: Space bar chooses icon Upload for others Delete unneeded channels 7. Storage Directories "Default" Storage Group directories Select /var/lib/mythtv/recordings Edit to be /data/mythtv/recordings "LiveTV" Storage Group directories Select /var/lib/mythtv/livetv Edit to be /data/mythtv/livetv "DB Backups" Storage Group directories Select /var/lib/mythtv/db_backups Edit to be /data/mythtv/db_backups "Videos" Storage directories Select /var/lib/mythtv/videos Edit to be /data/mythtv/videos "Streaming" Storage directories Select /var/lib/mythtv/streaming Edit to be /data/mythtv/streaming 8. System Events No changes.
- Press Esc until you exit the MythTV Backend.
- Enter your "pvr" account password to start mythv-backend.
- Click Yes to run mythfilldatabase.
Y. Configure MythTV Frontend
The MythTV frontend handles the display of recordings from the backend. As such we need to configure the frontend for our preferences.
- Start Applications -> Multimedia -> MythTV Frontend
- Select Setup -> General
On Database Configuration page:
Note this page contains the database password if you should need it in the future. - Select Setup -> Appearance
On Appearance page: Paint engine: Auto
- Select Setup -> Audio
On Audio System page: Audio output device: ALSA:default On Audio mixer page: Master Mixer Volume: 70 -> 100 PCM Mixer Volume: 81 -> 100
- Select Setup -> Video -> Playback
On Playback Profiles (3/8) page: Select Content Video Playback Profile: OpenGL High Quality On Commercial Skip (8/8) page: Commercial skip automatic rewind amount (secs): 1
TIP: The OpenGL High Quality setting fixes the video tearing problem with Intel GPUs.
Be sure to navigate forward through all 8 pages in the playback section to ensure that the setting is saved. - Select Setup -> Media Settings -> Video Settings
-> Player Settings
DVD Drive: /dev/sr0 # was /dev/dvd
TIP: Mythbuntu 14.04 does not create /dev/dvd entry.
Since /dev/dvd is missing, we change to use /dev/sr0 instead.
See Mythbuntu 14.04: /dev/dvd and /dev/dvdrw symlinks no longer created.
Z. Setup Mtyhbrowser [Optional]
This plugin permits you to view web pages on the MythTV frontend Information Center -> Web page. Personally I use this page to stream TV shows that are hosted by my local television station web sites. Later on I describe how to create bookmarks.
- Select Setup -> Info Center Settings -> Web
Settings
Text Size: 1.5 Enable browser plugins (Flash, etc): Enable
AA. Setup Mythmusic [Optional]
This plugin permits you to store and play music on the MythTV frontend Media Library -> Listen to Music page.
- Select Setup -> Media Settings -> Music Settings
-> General Settings
On General Settings screen Directory to hold music: /data/mythtv/music CD Device: /dev/sr0 # was /dev/cdrom On Player Settings screen Automatically play CDs: Enable On Ripper Settings screen Encoding type: Lame (MP3) Leave default rip quality at "Low" = 128 kb/s "Medium" = 192 kb/s Disable "Automatically eject CDs afte..."
BB. Setup Mytharchive [Optional]
This plugin permits you to burn recordings to DVD-R on the MythTV frontend Optical Disks -> Archive Files -> Create DVD page.
- Select Setup -> Media settings -> Archive Files
Settings
On Mytharchive Settings screen MythArchive Temp Directory: /data/mythtv/mytharchive/temp # was /var/lib/mytharchive/temp Video Format: NTSC Location of DVD: /dev/sr0 # was /dev/dvd
The NTSC video standard is used in North America. The PAL video standard is used in many other parts of the world.
CC. Create Mythbrowser Bookmarks [Optional]
Personally I create bookmarks to various locations for weather, and
also links to TV stations such as: Global TV, CTV, City TV, and
CBC.
I use the category zTV Shows so that this sorts to the end
of the categories as I more often check the Weather.
- Select Information Center -> Web
- Press the M key to access the menu to add
bookmarks and follow the prompts to create your a bookmark.
Category: Weather Name: location URL: link to weather web site Category: zTV Shows Name: TV station URL: link to TV show web site
- Repeat above step for each bookmark you desire.
Note that you can use your mouse, keyboard, or remote control to navigate web sites in the Mythbrowser.
DD. Optimize for SSD [Optional]
Solid State Drives (SSDs) are completely different than standard
spinning hard disk drives. As such I spent some time researching SSDs
and discovered some optimization tips. The general recommended
practice is to lessen write activity where possible, and to reserve
~10% unallocated space when partitioning (some newer SSDs supposedly
do this already -- maybe that explains the difference in SSD sizes such
as 60 GB versus 64 GB).
Following are the tips I implemented on my Mythbuntu PVR.
- Add "noatime" and "nodiratime" to SSD file system
mounts to inhibit last access time updates.
Edit /etc/fstab
sudo leafpad /etc/fstab
and add "noatime,nodiratime" parameters to "/" mount. The resulting line should look something like the following:
---------- begin /etc/fstab lines ----------
# / was on /dev/sda1 during installation
---------- end /etc/fstab lines ----------
UUID=d819744e-5a07-4039-95b8-9d322954b065 / ext4 noatime,nodiratime,errors=remount-ro 0 1
NOTE: Some Recommend Adding "discard" or Scheduling TRIM
From my research some people advise adding "discard" to /etc/fstab to help with wear levelling. However I have read that this can increase the time to perform a delete.
Some other people advise scheduling regular TRIM operations to perform this same wear levelling.
Since I was unsure of all the implications, I opted to not implement either method and instead take a wait-and-see approach. So far my PVR has been running without these "discard/TRIM" settings since May 2013 and I have not experienced any noticeable degradation in SSD performance. - Limit swap space wear and tear by reducing the
inclination to swap.
Edit /etc/sysctl.conf
sudo /etc/sysctl.conf
and add the following 5 lines to end of file:
---------- begin 5 /etc/sysctl.conf lines ----------
#
---------- end 5 /etc/sysctl.conf lines ----------
# Sharply reduce swap inclination
vm.swappiness=1
# Don't shrink the inode cache aggressively
vm.vfs_cache_pressure=50
- Limit write actions in Firefox.
Start Applications -> Internet -> Firefox Web Browser.
Select Edit -> Preferences -> Advanced
On Network tab
Click on Clear Now
Override automatic cache management:
Limit cache to 0 MB of space
Click on Close
Exit Firefox
Installation Complete
Congratulations! You have now completed the steps to setting up an always on PVR, that should reboot and work properly after any power outages. Enjoy!
References
While setting up a Mythbuntu MythTV PVR, I found the following references useful:
Future Articles
In future articles, I plan to cover the following steps of our path: