Introduction

This wiki entry will detail the installation of a combined frontend and backend in Fedora 21. Ensure you have met the hardware requirements.

Fedora provides updates for a release until two releases after that. At the time of this writing, the current release is Fedora 21, which means support for Fedora 21 - 2 becomes discontinued a month after Fedora 21 is released. Thus, it makes sense to update to the latest release at least every other version, if not every version.

You are welcome as a MythTV user and general wiki participant, to add to, and modify this document that will help the community the best way possible.

Getting Fedora

ISO images

Note that the Workstation edition has the default GNOME Desktop available whereas the DVD install has alternative desktop environments available. For the remainder of this installation guide, the default desktop environment GNOME will be used to avoid confusion. Other desktop environments should be similar.

Physical media

CD-ROM and DVD-ROM discs can be purchased from online and local vendors.

Installing Fedora

The official Fedora 21 installation guide is an excellent place to start when installing Fedora. There are a few modifications on the procedure given in the official documentation; user creation and filesystem partitions. The notes in this wiki will detail an installation from the Live Desktop Media - Workstation. It should be noted that additional desktop environments are also available if the GNOME 3 desktop is not suitable. Some alternatives are listed in the Fedora spins page and installation is detailed here. Desktop environments other than GNOME 3 are outside of the scope of this wiki for brevity.

Date/Time

During installation you should adjust the date and time of the machine to the current date and time. To do this ensure the Network Time slider is set to on under the Localization options. Making sure the system is running to the correct time is important for timely scheduling of recordings.

Filesystems

Among the MythTV community, it is highly recommend to use a custom partitioning scheme rather than auto-partitioning with a dedicated /video (or similar) partition for storage of all your recordings. If possible, for best efficiency, the video partition should be on a drive physically separate from the operating system partitions. Software RAID and LVM for your video partitions will only slow it down and should be avoided. LVM is no longer necessary for MythTV due to Storage Groups.

Currently EXT4 format is the default in Fedora and other distributions. A partition setup example is given in the Table below.

User creation

When prompted during the installation, create a non-administrator user on the system with the username "mythtv". You can set the password for this user to anything you want. This should be a Strong Password that is different than the root password.

Partition

Mount Point

Size

Format

/dev/sda1

/boot

500MB

ext4

/dev/sda2

swap

same as RAM (ex: 4096MB)

swap

/dev/sda3 (for the OS)

/

8-12GB

ext4

/dev/sda4

/home

8-12GB

ext4

/dev/sda5

/video

Remainder

ext4

First boot

At this point Anaconda will ask you to remove the installation media from the drive and reboot the system. Once your system has finished rebooting you will be prompted to do some final configurations and be given a short tour of GNOME 3.

GNOME terminal

Tasks in linux are performed with greater ease through the command line and are therefore required in this How-To. In GNOME 3, the terminal is accessed by going to Activities and typing terminal in the search box.

Some commands need to be run as the mythtv user, and some commands need to be run as the root user. The boxes below will indicate with a prompt which user should run the command. Commands with a "$" prompt should be run as the mythtv user. If you see a command that starts with a "#", you will need to use the su command to become the root user.

To execute commands as the root run "su -" and enter the Fedora root password.

[mythtv@machine_name ~]$ su -
Password:
[root@machine_name ~]#

Notice the way the username changes from mythtv to root and the prompt changes from "$" to "#". Be sure you run all of the following commands as the correct user. If you do not, you will likely run into problems sooner or later. To become the mythtv user again, type "exit".

[root@machine_name ~]# exit
logout
[mythtv@machine_name ~]$

Your screen should clear, and your prompt should be a "$" again. If this is not the case, keep typing "exit" until it is. You can copy and paste text in the terminal by using 'Control-Shift-C' and 'Control-Shift-V' respectively.

Update Fedora

Firstly get your system fully updated. Simply run the command from terminal:

# yum update

When you see the Transaction Summary, you will need to press "y" to begin downloading the packages.

After the update has finished, reboot your computer for the effects to take place.

Network configuration

On the Network Configuration screen (Activities -> Network Connections), setting a static IP address is highly recommended (could be either a static, or statically mapped DHCP address). It really isn't a huge deal if you only have one Mythbox (though you probably don't want MythWeb to be a moving target), but it could cause major headaches once you have more than one machine, since non-primary systems won't know where the master backend is located if the address changes.

Firewall

Note that since Fedora 21 Workstation the firewall application has been removed for ease of use. The VNC ports are open on this machine by default. It can be installed by

# yum install firewall-config

A basic MythTV box should not have any problems running with the default Public zone firewall settings. If there are issues with service access you will at the very least want to enable SSH, Secure WWW (HTTPS) and WWW (HTTP) checkboxes to enable those services under the appropriate Firewall zone with the Permanent configuration.

If you plan to run separate front end and back end servers you will need to allow those ports through on under "Other Ports". Add TCP ports 6543 and 6544 to allow the MythTV protocol access through the firewall and TCP 3306 for MariaDB.

Autologin and display timeout

You can choose to have GNOME autologin in the mythtv user on boot so that the mythfrontend can automatically load. To set this behaviour go to Activities > Users. Unlock the user panel with the administrator password and slide the Automatic Login to the on position.

The screen timeout will also cause problems when using MythTV. You can set the display to not turn off by going to Activities > Power and setting the blank screen option to never. Be sure not to leave the display on with this option as it can cause issues with the display panel (burn in etc).

Sound setup

Fedora uses PulseAudio by default, as do many Linux distributions. MythTV works with Pulseaudio. Ensure the sound is working in the GNOME desktop otherwise try changing the output (e.g., HDMI) in Activities > Sound.

Remote desktop

The remote desktop in GNOME can be enabled through Activities > System Settings > Sharing. Turn on Screen Sharing and Allow Remote Control through the attached network device. It is strongly recommended that a secure password is set.

Fedora setup

The next section will require you to be logged in as the mythtv user.

Configure package repositories

RPMFusion

Configuration of yum is needed to use the RPMFusion package repository. Follow the links below and install the RPMs for the latest version and correct architecture for your system.

Note: You will need to download the packages rpmfusion-free-release and rpmfusion-nonfree-release under Firefox graphical installation and install with GNOME Software or rpm -ivh *.

Some MythTV installations require additional kernel modules to make all the hardware work. When installing firmware/drivers such as the proprietary nVidia graphics drivers the akmod or kmod packages can be chosen. The akmod packages automatically check and compile the driver on boot if required. This incurs a small penalty of having to install development packages. The kmod packages are built against a specific kernel version and if a new kernel is installed without the corresponding kmod then errors on boot may occur. Therefore for system safety the akmod packages are recommended.

NVIDIA

We recommend you use a card that supports VDPAU for video acceleration.

You can install binary drivers from NVIDIA, but in most cases it's simpler to use yum to get and install them from RPMFusion. It is essential to get the proper version of the drivers. Start by running

$ /sbin/lspci -nn | grep 'VGA'

This will give you the chipset name and the PCI id (which is after the colon inside the bracket set before the rev number). Compare these to the NVIDIA docs. Unless your card is in one of the legacy lists, you can install the latest drivers. If you have one of the legacy products you will have to modify the yum package name to get the proper drivers. The newer drivers will NOT work on "legacy" cards.

To install from the RPMFusion repository, run:

# yum install kernel-devel akmod-nvidia

You might encounter a message about a GPG key, accept this with y. Upon reboot the boot will be interrupted to build akmod-nvidia against the current kernel version which may take some time. You can check that the driver installed correctly by entering the following command in the terminal.

$ glxinfo | grep -i nvidia

Which should return an entry for the NVIDIA card.

If you need a legacy package from RPM Fusion consult the available packages table at http://rpmfusion.org/.

DVD playback

If you require DVD playback then you will need to install the libdvdcss package from an alternative repository. Please check if this is legal in your country.

Install MythTV

MythTV has numerous required dependencies to function correctly, which are automatically taken care of with one simple command:

# yum install mythtv

SELinux

It is strongly recommended that SELinux is run in "enforcing" mode as set by default. You can choose the permissive mode which will only warn you of problems.

Fedora comes with the excellent setroubleshoot tool which will notify of denials whilst permitting you to leave SELinux enabled on your system. Audit2allow in enforcing mode can also be used to catch SELinux denials and rules can be automatically created to allow program access in the future.

If you prefer running enforcing SELinux with mythweb, the following commands may be helpful:

If you have followed the previous instructions and the MythTV recordings and videos are on a seperate drive and you wish to use MythWeb, then you will need to tell SELinux about this. On the test machine the videos are mounted at /mnt/sdb/Videos. The SELinux Troubleshooting tool gives errors that httpd wants to access these directories. To allow httpd read permission:

In this instance the keymap being used is /lib/udev/rc_keymaps/rc6-mce.

To test the key mappings run the following command that will capture the input and button name of each keypress.

# ir-keytable -t

The mappings can be changed by finding your corresponding keymap in /lib/udev/rc_keymaps. Be sure to comment out the original mappings in case an error is made during the file modification and re-load the keymap using:

# ir-keytable -c -w /lib/udev/rc_keymaps/<keymap name>

If your remote control does not exist in the kernel and you don't get any output in ir-keytable -t then you will have to install LIRC.

Note for rc6-mce: at the top of the /lib/udev/rc_keymaps/rc6_mce keymap file the protocol is changed to RC6-MCE and this will need to be changed back to RC6 if an error regarding unsupported protocol occurs.

Install LIRC

This LIRC instruction may well be outdated

Note for Fedora 12 + users the default LIRC socket file name has changed to /var/run/lirc/lircd , so you will need to update MythTV Settings -> General from /dev/lircd ->/var/run/lirc/lircd and then restart mythfrontend.

Check first if lirc is installed before proceeding below...(eg find / -name lircd)

# yum install lirc

This will install the Linux Infra-Red Control package. This is a daemon which translates infra-red key presses into keyboard events, therefore you will need to configure your remote control accordingly.

Setup MariaDB

In Fedora 20, mySQL has been replaced with MariaDB but backwards compatibility is maintained such that the following commands should still be applicable. We'll need to enable MariaDB to load at startup, set some passwords and create the MythTV database which we'll populate shortly. The population of this database is handled by mythtv-setup in the next step, and all MythTV add-on module database additions must be done after running mythtv-setup at least one time.
Start by enabling automatic load at boot and start the database:

Again, all subsequent database population for MythTV's add-on modules must now be done after running mythtv-setup at least one time. It's worth customizing some parameters in /etc/my.cnf for optimal performance with MythTV.

In the event the mythtv-setup fails (current in Fedora 20), it may be because the time zone tables are not loading. See the wiki on the time zones. This entry fixed the problem:

$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Pre-launch checks

Before going further it is wise to check whether things have worked so far. Has a /dev/dvb/ entry been created for a digital video source?

$ ls /dev/dvb*

Which should return (or similiar if successful):

adapter0 adapter1

If not, you should be reading https://fedoraproject.org/wiki/DavidTimms/DVB), if you have an digital source yet something has gone wrong with installing it (in which case you should look at /var/log/dmesg using dmesg | grep -i dvb), and check whether udev, ivtv, and so on are working, and required modules are loaded). A useful quick test for USB video sources is to unplug them then plug them in again and look at the ends of whatever /var/log files get updated.

Setup MythTV

To launch the MythTV setup utility search for mythtv in the Activities overview. You should be presented with a graphical interface and you may be required to update the database schema. Now we will move onto assigning the tuners, channels and storage directories.

1. General

In General settings, set the local and master backend IP address to the local IP address of your machine for a combined frontend / backend. On the test machine this was 192.168.0.2 (may be different for you). Set your channel frequency table in the next page and continue to scroll through until you have reached Finished.

2. Capture cards

In order for MythTV to record a stream, you must firstly setup the capture devices. This is under 2. Capture Cards. Select the card type (DVB-T/S/C for terrestial) and make sure the DVB device is recognised correctly and select Finish. Do this for each available capture device. At this stage you can also set each recording device to record multiple channels per multiplex (DVB) by Recording Options > Max Recordings: and set to 3 (from a value of 2).

4. Video sources

Once the capture devices have been created successfully and you have decided between SchedulesDirect or using EIT to schedule recordings, a video source is required. Create a video source under 4. Video sources and give it a name (e.g. vidSrc0) and enter in your SchedulesDirect details or use EIT under Listings Grabber and accept the remaining defaults.

5. Input connections

In the next section 5. Input Connections assign each capture device a display name (adapterX) and a video source. Then select Scan for channels and ensure the country and scan type (TV or TV+Radio) is correct and select Next. The selected capture device will now scan for available channels. Once complete, a summary of the channels is given, select Insert All and Finish.

In many parts of the world the program guide data is transmitted free over the air and is used by MythTV to schedule recordings and provide program information (EIT). However if you are in the US, you will may need a paid account with schedulesdirect. The current pricing is $25US per year (current at November 2014). This will give you television feed data that your Mythbox uses for scheduling once you have localized your account to your zip code, chosen a content provider service and then set your channels from the web page.

6. Channel Editor

There may be duplicate channels that can be removed safely and allows for less clutter for the backend to deal with when scheduling. In 6. Channel Editor the duplicate channels can be deleted using key d and further additions to channels / transports can be done if desired. There may be icons available for you to download using Download icons option.

7. Storage directories

The storage directories can be configured in 7. Storage Directories. Those using a dedicated /video partition as per the previous recommendation, you should obviously set /video/recordings for storage of recorded shows. However, you can do pretty much whatever you like here, such as recording to an NFS or Samba mount. Just make sure your mythtv user has permission to read and write to whatever location you choose.

Mythbackend startup

It is highly recommended that you go through the above setup steps in order. Follow the on-screen instruction, with aid from the MythTV website documentation where required.

Once you've gone through the setup, you have to populate the MythTV database with some program info. Once you have your listings to your liking, you're ready to fill your database with programming info. You must start up the backend first and we'll set it to autostart later. Enter the following command in a terminal:

$ mythbackend

Assuming all goes well and the process doesn't exit on you (if it does, check out the troubleshooting section below), lets get some guide data, in a new terminal window type:

$ mythfilldatabase

If you're using a guide data source other than SchedulesDirect (i.e., anyone outside the U.S. and Canada), you may need to add a "--manual" flag to the end of that command to get it to work. Look at the output of "mythfilldatabase --help" for more clues if you have problems.

Be patient. This step can take a fairly long time, depending on your internet connection speed and how many channels your service provides. To get automatic updates of programming data daily, see the available options in mythtv-setup, under 1. General on the 10th page for further configuration.

Mythfrontend configuration

Now start up the MythTV frontend. It is recommended launching mythfrontend in a separate shell window, so you can distinctly see the output for the backend and frontend processes for debugging purposes. From a terminal:

$ mythfrontend

There are various options within mythfrontend that you can tweak relating to appearance, video, audio and scheduling of recordings.

Audio

To configure the audio go to Setup > Audio. Choose the Audio output device that gives the current line output (e.g. HDMI). On the test computer this was ALSA:hdmi:CARD=NVidia,DEV=0. Use the inbuilt Test function to see if MythTV is outputting sound to the correct device. Select Next to choose the mixer properties. If your remote control has volume buttons then MythTV can respond the volume changes when the Mixer device is set to software.

Video

Likewise for the audio, the video can be configure under Setup > Video. If the captured streams are interlaced, then the choice of interlacer is critical to an enjoyable viewing experience. It is generally considered that nVidia with VDPAU has the most advanced deinterlacing methods (Advanced and Temporal) and these should be selected under Playback > Playback Profiles (3/8). Here VDPAU / OpenGL / Normal settings can be tweaked along and rules set based on the source video resolution. Advanced options are under Edit for each resolution rule. Otherwise if your hardware is sufficient choose the YADIF filter. Once tweaking is finished, select Next until you appear back in the menu.

Scheduling of recordings

Recordings can be scheduled under Manage Recordings > Schedule Recordings > Program Guide. A variety of rules can be set but it should be noted that recordings can conflict and the priority will determine which program will be recorded. This can be checked in Upcoming recordings.

Downloadable themes

MythTV frontend allows multiple themes to be added with ease provided you have an internet connection. Under Setup > Theme Chooser you can select between the available themes as desired.

Configure automatic startup

The necessary init script for the MythTV backend to automatically start at system boot is already in place for you, just simply turn it on:

# systemctl enable mythbackend.service

If the backend isn't already running, save yourself a reboot and issue this command:

MythExit

We're done!

This should be the entire guide required to get MythTV installed and operational on Fedora. If you have any feedback or a request additonal explanations, post in the discussion panel or jump in and add it yourself! Don't forget to checkout the troubleshooting section and the enhancements to get the best out of your Mythbox.

Troubleshooting

SELinux

Note: If you receive an error involving permissions on a .so library, you may have SELinux installed and preventing you from accessing those libraries. You can allow access to the libraries with the following command:

# chcon -t texrel_shlib_t /usr/lib/libmyth*.so*

Tuners do not load on boot

If the DVB tuners do not load on boot when systemd loads mythbackend.service but can be accessed through mythfrontend after the following commands are issued:

# systemctl stop mythbackend.service
$ mythbackend

Then this could mean that the tuners not ready when systemd starts the mythbackend.service. This can be fixed by following the instructions given in /etc/systemd/system/multi-user.target.wants/mythbackend.service and adding the tuners as a requirement on boot. Simply find the required device in /dev/dvb/adapter0 as a general guide (might not be specific to your tuner).

[Unit]
Description=MythTV backend service
After=network.target mariadb.service mysqld.service time-sync.target dev-dvb-adapter0-frontend0.device
# Uncomment the following line if you will be using the mythweb plugin on the
# same system as mythbackend.
Wants=dev-dvb-adapter0-frontend0.device
# Uncomment below if running mythweb and comment the above
# Wants=httpd.service dev-dvb-adapter0-frontend0.device

Auto-load scripts

I have a few things that don't seem to want to play nice anymore (i.e., nvidia-settings don't load like they should, alsa volume levels aren't restored), I decided to create a quick little shell script in ~/.kde/Autostart/myth-load.sh to handle loading up all the extra goodies I need/want to auto-start, as well as force stubborn things to work. This script loads my nvidia settings, restores alsa volumes, launches irexec for my little power button script (on the Tips 'n' Tricks page), then launches mythfrontend, all in one fell swoop. Just copy and paste all this into ~/.kde/Autostart/myth-load.sh (adjust accordingly for different desktop environments):

Enhancements

Space saving

Since most Mythboxes would not be used as a general workstation some packages can be removed with relative certainty. A big ticket item is the Libreoffice suite and the removal of this should make for much smaller updates.

# yum remove libreoffice*

MariaDB performance

These adjustments to /etc/my.cnf under the [mysqld] section improve performance with both MythTV (especially in the GUI) and MythWeb:

Power saving

Since the frontend/backend is likely to be powered on around the clock, some power saving enhancements will allow the device to run cooler, quieter and reduce the impact on the electricity bill. Firstly install powertop and tlp using

# yum install powertop tlp

And start tlp with:

# tlp start

And this should return the power on status (TLP Started in AC Mode). You can modify the defaults in /etc/default/tlp to allow power saving modes while in ac mode. Apply the changes with the tlp start command. You can check if the power saving features are enabled by using powertop under the tunables tab by using:

# powertop

And using 'tab' to access the other pages in the terminal interface. The status good should be reported next to each item. If not try using turning on the experimental PCI-E support in /etc/default/tlp (assuming the hardware you have is recent).