Installing MythTV on Fedora

From MythTV Official Wiki
Revision as of 09:39, 13 December 2009 by Monkeypet (Talk | contribs)

Jump to: navigation, search

This "How-To" guide is for installing MythTV on the latest release of Fedora.

Introduction

This guide is shamelessly based on Jarod Wilson's how to guide which you can find here. However, it has not been updated with information on how to install with Fedora. Apparently, Jarod no longer maintains his guide.

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

Getting Fedora

ISO images

The latest version of Fedora can be downloaded from the Fedora Download Page.

Physical media

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

Installing Fedora

Anaconda is the Fedora installer program and will launch a GUI by default.

Filesystems

The 2.6 kernel series includes several journaling file systems, some of which are more suited for use with large files — like MythTV recordings — than Red Hat's default file system, ext3.

In order to use a different file system at install time when loading the Fedora install disc, exit the GUI by selecting the Escape key. You can then type in:
boot:linux <otherfs>
Where <otherfs> is for example reiserfs, jfs, xfs.

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.

Previously, XFS was Jarod Wilson's recommendation for the file system to use for such a purpose, but some additional stability issues with using XFS on Fedora stock kernels has been brought to light. In the case where you're stacking software RAID, LVM and XFS all together, stack overflows tend to crop up. If you are willing to run your own kernel (compiled from source), you need to make sure that CONFIG_4KSTACKS is unset in the kernel configuration. This should fix the problems with XFS+LVM stack overflows. JFS is becoming the more recommended file system, so boot the installer with "linux jfs", then choose JFS for your /video partition.

ReiserFS is also an option, though it is believed JFS performs a bit better (XFS is even better still, at least, when its stable...). An example partitioning setup can be found below.

Partition Mount Point Size Format
/dev/hda1 /boot 50-100MB ext3
/dev/hda2 swap same as RAM (ex: 512MB) swap
/dev/hda3 / 8-12GB ext3
/dev/hda5 /video Everything else jfs

At the Installation Type screen, you want to choose a Custom installation (rather than Personal Desktop, Workstation or Server), because none of the defaults give us everything we need and/or add junk we don't need.

On the Disk Partitioning Setup screen, choose to Manually partition with Disk Druid. A suitable custom partitioning setup is as follows (assuming a single IDE hard drive):

Be sure to choose JFS (or XFS or ReiserFS) as the partition format type for the /video partition, as the selection will default to ext3. Note that there's really no point in using anything but ext3 on / and /boot. Red Hat tests ext3 heavily, its the only one that is pretty well guaranteed to be problem-free for / and /boot. Those expecting to add additional hard drives to their system for more video storage might want to set the partition type for hda5 to LVM, then create a logical volume over the top of it, formatted JFS. That'll allow you to increase the size of your /video partition transparently across multiple drives. Details on how to do that can be found in the official MythTV documents, at http://mythtv.org/docs/mythtv-HOWTO-24.html#ss24.1. (In version 0.21 there is a new storage feature, http://www.mythtv.org/docs/mythtv-HOWTO-9.html).

Network configuration

On the Network Configuration screen, it is highly recommend setting a static IP address (could either be truly static, or a statically mapped DHCP address). It really isn't a huge deal if you only have one Myth box (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 wouldn't know where the master backend was anymore if the address changed. I also have disabled ipv6 and would recommend you do the same if you don't need it.

Package selection

Required

On the package selection screen, select (at least) these package groups:

Optional

Some other packages that might be of interest, but are not required:

  • Applications
    • Graphical Internet (includes Pidgin and Firefox)
    • Sound and Video
  • Development
    • Development Tools — if you want or need to compile anything
  • Servers
    • Network Servers (under details, select vnc-server)
    • Windows File Server (includes Samba)

Either KDE or GNOME are equally suitable as an X environment for running MythTV. If you wish to switch to another desktop environment, you can fire up a terminal session, and issue the command:

$ switchdesk KDE

or

$ switchdesk GNOME

There are also reports of it working equally as well in lesser known Desktop Environments such as XFCE and in window managers such as fluxbox or ratpoison.

First boot

At this point Anaconda will ask you to remove the disc from the drive and reboot the system. Once your system has finished rebooting you will be prompted to accept the license agreement and a few more installation configuration options.

Firewall

A basic MythTV box should not have any problems running with the firewall turned on however you will probably save yourself a lot of headaches if you disable it completely. This is especially recommended for new users. If you do need to enable the firewall, you will at the very least want to enable SSH, Secure WWW (HTTPS) and WWW (HTTP) checkboxes to enable those services.

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 mysql.

SELinux

It is strongly recommended that SELinux is disabled or run in "permissive" mode. There are a few things that will not work properly if you set SELinux to "enforcing" such as ResierFS and the MythWeb plugin. If you think you might want to run with SELinux in enforcing mode in the future, choose the permissive mode which will only warn you of problems. This will enable you to quickly and easily set SELinux to enforcing mode at a later time. Fedora Core 6 comes with the excellent setroubleshoot tool which will notify of denials whilst permitting you to leave SELinux enabled on your system.

If you insist on running enforcing SELinux with mythweb, the following two commands may be helpful:

$ /usr/sbin/setsebool -P httpd_can_network_connect=1
$ /usr/sbin/setsebool -P httpd_ssi_exec=1

Date/Time

Here you should adjust the date and time of the machine to the current date and time. Once you have done this, select the "Network Time Protocol" tab and select the "Enable Network Time Protocol" checkbox. Making sure the system is running to the correct time is important for timely scheduling of recordings.

Display

The Setup Agent should have detected your video card and your monitor. Select the screen resolution that is best for your monitor.

Switch user

Create a user on the system with the username "mythtv". You can set the password for this user to anything you want. This should be be a Strong Password that is different than the root password.

Sound card

From the Sound Card screen you should see your sound card and be able to play a test sound. If you sound card is not showing up, your sound card may not be supported. It is possible to manually configure Fedora to use unsupported sound cards, but that is out of the scope of this document. try the aplay command to test sound output

Fedora setup

The next section will require you to be logged in as the mythtv user. Some commands will need to be executed from the command line. You can run commands with the "Konsole" program. To start Konsole, right-click on your desktop and select "Konsole..." and a new Konsole window should appear.

In GNOME, this is under Applications > Accessories > Terminal.

Some commands will need to be run as mythtv and some commands will need to be run as the root user. The boxes below will indicate with a prompt which user a command should be run as. 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 root password you set when you installed Fedora.

[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 will be a "$" sign again. If this is not the case, keep typing "exit" until it is.

Special Note: I do not recommend doing a yum upgrade until you have all packages/modules/drivers you want on your computer installed and also have yum-fedorakmod yum-kernel-module installed through yum. I've run into multiple instances were yum upgrades your kernel and makes it so kernel specific modules no longer work because it's a new kernel and no updates have happened for driver/module packages. Going about installing fedora the way described in this article will keep that from happening.

As of Fedora 11, yum-fedorakmod and yum-kernel-module are no longer available in the Fedora or RPM Fusion repositories.

Set $KVER variable

To make life simpler after we've rebooted and are prepared to start installing drivers for some of our hardware not supported natively by the kernel, we're going to set up a custom environment variable, KVER, that will help avoid problems from typos, user error, confusion, and so-forth. Simply drop a file in /etc/profile.d, like so:

# echo "export KVER=\`uname -r\`" >> /etc/profile.d/kver.sh

(Note: those are back-ticks, not single-quotes.)

Now you're ready to reboot into that new kernel and start installing kernel modules for your tuner card(s), remote, and so-forth.

# reboot

Add a few important yum packages

yum-fastestmirror

To ensure that yum always uses the fastest available mirror for a repository (if it has more than one mirror) you can install the package yum-fastestmirror. This will decrease the time for downloads in many cases.

yum install yum-fastestmirror

If the above command does not work you get something like this: (this was using Fedora 8)

yum install yum-fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 21830.
Another app is currently holding the yum lock; waiting for it to exit...

To get around this you will need to stop the yum update helper: (the update helper will restart when you reboot your machine)

service yum-updatesd stop
Stopping yum-updatesd:                                     [  OK  ]

To permanently stop the updater from running use the following command

chkconfig yum-updatesd off

To prevent your system from updating the kernel if you have kernel-modules installed which are not available yet for the new kernel, you can install the two packages yum-fedorakmod and yum-kernel-module

yum install yum-fedorakmod yum-kernel-module

yum-priorities

To protect the base Fedora packages from being overwritten with ATrpms packages, consider using the yum-priorities plugin. A good howto is located here: http://wiki.centos.org/PackageManagement/Yum/Priorities

yum install yum-priorities

Then edit the /etc/yum.repos.d/fedora.repo and /etc/yum.repos.d/fedora-updates.repo files by adding a priority=1 line like below:

[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
priority=1

Add a priorities line to the /etc/yum.repos.d/atrpms.repo file (once you've downloaded it in the next step), giving it a lower (higher-numbered) value:

priority=10

Configure package repositories

A very helpful guide is available here: [http://www.howtoforge.com/managing_packages_repositories_yum_yumex_fedora7 yum repositories on fedora.

Configuration of yum is needed to use ATrpms and FreshRPMs package repositories. Pre-configured files can be downloaded and run from the desktop. Follow the links below and install the RPMs for the latest version and correct architecture.

ATrpms

 http://atrpms.net/dist/f10/atrpms-package-config/

Note: This link is for Fedora 10. Be sure you browse the ATrpms site for the correct version for your distribution.

Freshrpms

 http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/10/
 http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/10/freshrpms-release/

Note: These links are for Fedora 10. Be sure you browse the Freshrpms site for the correct version for your distribution. You will need to download the packages rpmfusion-free-release and rpmfusion-nonfree-release from the first URL, then freshrpms-release from the second URL, put them all in the same directory, and install with rpm -ivh *.

Next you need to grab the gpgkeys for the repositories you just created, run this as root in terminal:

rpm --import http://atrpms.net/RPM-GPG-KEY.atrpms
rpm --import http://freshrpms.net/RPM-GPG-KEY-freshrpms

Generally, any problems encountered with ATrpms and ATrpms packages should be addressed on the atrpms-users mailing list before being taken to the MythTV list. You can subscribe to the ATrpms lists here.

FreshRPMs is structured a bit different than ATrpms — it generally only provides add-on packages, while ATrpms provides both add-on packages as well as packages that replace/upgrade/enhance packages originally provided by Red Hat. FreshRPMs has only one channel of packages. You can subscribe to the FreshRPMs mailing list here.

Many MythTV installations require additional kernel modules to make all the hardware work. The ATrpms repository offers a package which downloads new kernel modules when the stock Fedora kernel is updated. You should wait a few days after the new kernel appears to update, giving the packagers time to create kernel module rpms. You can get this package with the following command

# yum install yum-plugin-kmdl

As with any other mailing list, please search their respective archives first.

Note to users of Fedora 8 & 9: You may encounter problems with dependency failures, particularly in installing the NVidia and ITTV drivers. If this is the case, you most likely are missing the Fedora-Updates-Newkey and Fedora-Updates-Testing-Newkey repositories and their resective GPG keys. (Fedora went to new GPG keys as a response to having been hacked. More detailed information is available at: Enabling_New_signing _key) If this is the case, you will want to proceed with:

For Fedora 8:

# rpm -Uvh http://kojipkgs.fedoraproject.org/packages/fedora-release/8/6.transition/data/signed/4f2a6fd2/noarch/fedora-release-8-6.transition.noarch.rpm

For Fedora 9:

# rpm -Uvh http://kojipkgs.fedoraproject.org/packages/fedora-release/9/5.transition/data/signed/4f2a6fd2/noarch/fedora-release-9-5.transition.noarch.rpm

Followed by (for either version):

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9

NVIDIA

Binary NVIDIA drivers can be installed from NVIDIA or use yum to get them from ATrpms. The first step is to choose the proper version. Use the NVIDIA website to determine what the appropriate version is. The new drivers (177.80+) will NOT work on "legacy" cards like the Geforce 4 MX series. For older cards you'll probably want the 96 series (96.43+). You can also try the version 71 series.

# yum install nvidia-graphics

Note that this command will install the latest version. To install legacy version 96, do yum install nvidia-graphics-legacy-96xx. If dependencies are missing you will probably just have to wait for them to be created. Try yum install nvidia-graphics-legacy-71xx if version 96 doesn't work.

Following this, edit /etc/X11/xorg.conf and change the following line under Section "Device":

Driver "nv"

to

Driver "nvidia"

After restarting X ( Ctrl+Alt+Backspace or rebooting), the accelerated graphics drivers should be enabled.

You can also add

Option "No Logo" "true"

to the above section in your xorg.conf file if you do not wish to view the nvidia logo on each boot.

Sound setup

If you are using KDE, then you may find the KDE sound server aRts does not work well with MythTV though work has been done recently to remedy that. It is still highly recommended that you disable aRts from starting up if you encounter audio problems. To do so, while logged in as mythtv user, choose "Control Center" off the Fedora (Red Hat) menu. Navigate through "Sound & Multimedia" to "Sound System" and deselect "Start aRts soundserver on KDE startup" ("Enable the sound system" on KDE 3.3 or later) and then click "Apply". On subsequent logins, aRts will not launch.

Note: outside of setting your audio mixer levels, this step is not essential. Just set your volumes with the mixer program of your choice and move on to the next step if you like. ALSA is the default sound system in the 2.6 kernel, so you've already got it, and your sound card should have been auto-configured during firstboot. If you have some flashy new card, there's a chance you might need a newer ALSA version, which ATrpms does provide. Those wanting to install the latest ALSA packages from ATrpms should do so with these commands:

# yum install alsa-kmdl-$KVER
# yum install alsa-driver 

For multiple sound cards an edit of /etc/modprobe.conf file is needed for a specific card. Details for supported cards can be found here.

Included below is a excerpt of an /etc/modprobe.conf ALSA configuration, which is for a SoundBlaster Audigy sound card. This should be valid for SB Live! and Audigy2 cards as well.

If your card isn't one of those, check out the ALSA site's sound card matrix to find information for your card. The differences are very minor for most cards, and usually only the driver name has to be changed. For example, to configure ALSA for use with the onboard audio of an nForce2 board, it should be a simple matter of replacing all instances of "emu10k1" in the following modprobe.conf and .asoundrc with "intel8x0".

# Example modprobe.conf entries for my Audigy
alias snd-card-0 snd-emu10k1
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-emu10k1 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1 

Below is a modprobe.conf ALSA snippet example for a dual sound card system with a SoundBlaster Audigy and nForce2 onboard (i810) audio.

#Example modprobe.conf entries for Audigy and nForce2 onboard (i810) audio
alias snd-card-0 snd-emu10k1
options snd-card-0 index=0
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-emu10k1 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1
alias snd-card-1 snd-intel8x0
options snd-card-1 index=1
install snd-intel8x0 /sbin/modprobe --ignore-install snd-intel8x0 && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-intel8x0 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-intel8x0 

NOTE: As of Fedora 11, the /etc/modprobe.conf is deprecated in support of adding files to the /etc/modprobe.d/ directory instead. For Fedora 11 and later, it would be preferable to place these lines in /etc/modprobe.d/sound.conf instead of /etc/modprobe.conf.

Next, create a .asoundrc file for the mythtv user (full path of /home/mythtv/.asoundrc). Technically, this isn't necessary, but it can help out quite a bit in some cases (especially if you're outputting via an S/PDIF connection), and can't hurt. Anyhow, just make a new text file called .asoundrc like so, adjusting for your specific card, substituting for "emu10k1" where necessary:

$ cat > ~/.asoundrc
pcm.emu10k1 {
type hw
card 0
}

ctl.emu10k1 {
type hw
card 0
}
(Now hit Control-D to end cat input) 

Start the audio controller of your choice (aumix, alsamixer, kmix or gnome-alsamixer) and adjust the volumes, inputs and outputs to your liking.

A simple way to test whether or not you've got sound is to use ALSA's aplay utility, like so:

$ /usr/bin/aplay /usr/share/sounds/KDE_Startup.wav 

Install MythTV

Now, here's why we really like yum… MythTV has numerous required dependencies to function correctly, which are automatically taken care of with one simple command:

# yum install mythtv-suite 

You may run into some problems with dependencies. These can usually be resolved by removing the offending package and re-running the above command. Dependency issues can be mitigated be keeping additional (third-party) repositories to a minimum. MythTV on Fedora Core requires only the default repositories plus ATrpms and Freshrpms to fulfill all requirements.


Note for Fedora 9...

I'm using this guide to install mythtv on a Fedora 9 distro. The only dependency issue I've run into so far is having to remove python-imaging that was installed by default with the distro. After removing python-imaging, mythtv-suite installed smoothly.

Setting up drivers/Modules

Install capture card drivers

Some capture card drivers have been included by default with Fedora. As an example the NOVA-T PCI card from Hauppauge has a Conexant chipset which is recognised out-of-the-box.

For analogue capture cards such as the Hauppauge PVR 150/250/350/500 you will need the ivtv drivers — kernel modules are included in the ATrpms repository.

# yum install ivtv

Install LIRC

For users of later installation builds (i.e MythDora10), you may not need to manually install lirc, but it may not be working properly. In my case (MythDora10, DVICO USB remote) I needed to edit the file /etc/sysconfig/lirc, and change the options to be hiddev type rather than event type (crude explanation). Search elsewhere on this site for DVICO Australia to see the exact edit required, and good luck!

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

# yum install lirc-kmdl-$KVER

Then install the module:

 modprobe lirc_mceusb2

This will install the Linux Infra-Red Control package and kernel module. This is a daemon which translates infra-red key presses into keyboard events, therefore you will need to configure your remote control accordingly. Some examples of the lircrc file can be found under /usr/share/doc/mythtv-$VERSION/

Warning for newer Hauppauge MCE Remotes:

The MCE remote in the most recent popular Hauppauge MCE boxes doesn't work with the lirc installation in the yum repository. You actually need to build your own as described by the MCE Remote page. The quick summary (assumes you have sudo ability otherwise run those commands as root):

 wget http://lirc.sourceforge.net/software/snapshots/lirc-0.8.2pre2.tar.bz2
 bunzip lirc-0.8.2pre2.tar.bz2
 tar -xvf lirc-0.8.2pre2.tar
 cd lirc-0.8.2pre2
 ./configure --prefix=/usr --sysconfdir=/etc --with-x --with-driver=mceusb2
 make
 sudo make install
 sudo cp remotes/mceusb/lircd.conf.mceusb /etc/lircd.conf
 sudo cp /usr/share/doc/mythtv-0.20/configfiles/lircrc.native.example.mceusb2 ~mythtv/.mythtv/lircrc
 sudo service lircd start
 sudo chown mythtv /dev/lircd

Then you should be able to run irw (as the mythtv user) and see it print output when you push a button:

 bash-3.1$ irw
 000000037ff07bf2 00 Home mceusb
 000000037ff07bf2 01 Home mceusb

and running mythfrontend later should just work.

Restore old Firewire modules (optional)

  • Note: These steps don't seem to be necessary on Fedora 9 and will in fact break your firewire support until the packages listed below are removed*

Due to Fedora changes a few new things will need to be done to get your firewire to work correctly with your cable box. The new 2.6.22.x and above kernels switched the firewire modules to a new type that do not really work with anything we use in myth. We need to do a few things to get

yum -y install libiec61883-utils

then

yum -y install ieee1394 ieee1394-kmdl-`uname -r` 

now we need to blacklist those new kernel firewire modules that do not work. You will need to be root.

cd /etc/modprobe.d/
nano firewirerestore

we need these two lines in this file

blacklist firwire_core
blacklist firewire_ohci

hit ctrl-x to close and type yes and enter to save

reboot

Update Fedora

To get your system fully updated, simply run the command:

# yum upgrade

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

Transaction Summary
=============================================================================
Install      20 Package(s)
Update      79 Package(s)
Remove       0 Package(s)
Total download size: 902 M
Is this ok [y/N]: y

Since this is your first upgrade, you will also need to import the GPG key when prompted. You should only need to do this once.

Retrieving GPG key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
Importing GPG key 0x4F2A6FD2 "Fedora Project <fedora@redhat.com>"
Is this ok [y/N]: y
Key imported successfully

Kernel upgrades

  • Note: Fedora is shipped with a specific kernel, over time bugs are discovered and corrected in new versions. If possible update your kernel to the newest one.

Among the packages upgraded just a minute ago with yum should be your kernel, to the very latest errata release. Additionally, your boot loader should have been automatically updated to use the new kernel, so all you need to do is reboot to start using the new kernel, which you'll want to do in just a minute. As of this writing, 2.6.24.3-12.fc8 is the latest released errata kernel. You should be using at least this kernel if not a newer one.

Generally speaking, you should always install the latest errata kernel, shortly after the release of which Axel should have all the needed kernel modules available. Kernel modules are not maintained for older kernels, because of two things. First, a new kernel from Red Hat usually fixes some flaw in earlier kernels (security hole or bug fix), so it is good practice not to use the flawed kernel and second, building kernel modules for every kernel would take forever and a day and cause assorted other headaches for Axel. To make providing kernel modules feasible, only the very latest one or two kernels are supported

Setup MySQL

We'll need to enable MySQL 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 mythtvsetup in the next step, and all MythTV add-on module database additions must be done after running mythtvsetup at least one time.

# /sbin/chkconfig mysqld on
# /sbin/service mysqld start 

Set the MySQL root password, replacing ROOT_PWD with your chosen administrator password:

# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('ROOT_PWD') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

Now we create the MythTV database (called mythconverg) to get us started:

$ mysql -u root -p < /usr/share/doc/mythtv-docs-0.21/database/mc.sql
Enter password:

At this point, enter the password you just set above (ROOT_PWD) when prompted. Also note, "mythtv-0.21" refers to the version of MythTV you are have installed, in this case version 0.21.

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

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

key_buffer = 16M
table_cache = 128
sort_buffer_size = 2M
myisam_sort_buffer_size = 8M
query_cache_size = 16M 

Setup MythTV

Recall what your video device was set up as (likely /dev/video0). Note that the actual device number is not what determines what order MythTV will use your cards in. What matters is the order that you enter them in mythtvsetup, so your best card doesn't have to be /dev/video0. Set up /dev/video8 first, and it'll be the first card used for recordings.

If you are in the US, you will need a paid account with [schedulesdirect.org]. The current pricing is $20 per year. This will give you television feed data that your myth box uses for scheduling once you have localized your acct to your zip code, chosen a content provider service and then set your channels from the webpage. There are a few other ways to get your data, but these are outside this document support scope and the lsitings are not as accurate or as reliable.

Now on to launching the MythTV setup utility. For this part, you need to have an X session started up, as the setup utility is an X application. Fire it up like so:

$ mythtv-setup 

I'm told that non-U.S. folks may have issues correctly getting through the tv_grab_xx/xmltv part of the setup if "focus follows mouse" is already set (in KDE's Control Center), so keep that in mind. Just set "focus follows mouse" when everything else is already configured.

If you receive an error involving permissions on a .so library, you may have SELinux installed and preventing you from accessing these libraries. You can either turn off SELinux, or allow access to the libraries with the following command as root:
chcon -t texrel_shlib_t /usr/lib/libmyth*.so*
The following are fixes for Fedora 8 x86_64.
If you receive an error about not being able to log in to the database, check permissions on the following directory (should be 755):
/usr/lib64/qt-3.3/plugins/sqldrivers
If the background has no color or texture, check permissions on the following directory (should be 755):
/usr/share/mythtv

Those using a dedicated /video partition, per my example, 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, a software RAID array. Just make sure your mythtv user has permission to read and write to whatever location you choose.

It is highly recommended that you go through the setup steps in order. Follow the on-screen instruction, with aid from the MythTV website's documentation on this page:

http://www.mythtv.org/docs/mythtv-HOWTO-9.html

Note: your system may appear to hang at step 3; give it time, it isn't locked up, that part just takes a while!

Once you've gone through the setup, you have to populate the MythTV database with some program info. I spent a good long time tweaking my channel lineup on schedulesdirect's site to remove all the junk channels I didn't really care to have show up. 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. We'll daemonize it a bit later, but for now, just start it up like so:

$ 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:

$ mythfilldatabase 

If you're using a guide data source other than SchedulesDirect (i.e., anyone outside the U.S. and Canada), you may well 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.

Also, 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 below for configuration in mythfrontend.

Now start up the MythTV front-end (I recommend doing this in a separate shell window, so you can distinctly see the different output for the backend and frontend processes)...

$ mythfrontend 

There are various options within mythfrontend that you can tweak... In the past, I've recommended enabling "De-interlace Playback", even if you're using an interlaced display (like a TV). However, I've found with the latest nvidia driver and its flicker filter, this is no longer necessary for TV output (note that the flicker filter can only be used on SVideo or composite TV-Out, it isn't an option for DVI or VGA). You're on your own for the rest of the settings. Just be sure to go through every section, and get to the point where you click a "Finish" button, otherwise some values seem to not get initialized (most notably, you may get crashes that say something about not being able to open the dsp). Another setting I'd recommend enabling, especially if you're using an nVidia video card (not sure about others) is OpenGL VSync, which recently became a toggleable option. It isn't stable for everybody, but works very well for me on several systems (and I find it to be a must for optimal HDTV playback). If everything appears to be working, once you've gone through all the configuration steps, you can set your system up to automatically load everything at startup. And congrats, you've done the bulk of the work. You can stop here if you want, but if you're like me, you'll want everything to load automatically when the system boots.

It is recommended to use the built in features of MythTV to have mythfilldatabase updated automatically. After starting up mythfrontend, enter the Setup > General screen and advance to "Mythfilldatabase", the fourth screen. Select the checkbox, then complete the options as you see fit. If using SchedulesDirect for programming data, selecting the option to allow the scheduler to recommend the next mythfilldatabase option and changing the allowed update time to be from 0 to 24 is best as it allows SchedulesDirect to balance the load on their servers. After setup the mythbackend program will now run mythfilldatabase for you.

Configure 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:

# /sbin/chkconfig mythbackend on

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

# /sbin/service mythbackend start 

Be aware that the .mythtv/mysql.txt file is read in the root directory set while executing the init scripts (e.g. /), and the root directory is set to /root once the init scripts completes. So your mythbackend initialization might fail with a "Unable to connect" message. To fix this simple link the .mythtv directory in / to the one in /root with:

# ln -s /.mythtv /root/.mythtv

Some of the init scripts like mythbackend and lircd does not have a runlevel set in the. Take a look at the chkconfig: line in the scripts. It should read:

# chkconfig: <runlevels> start stop

I had to fix some of my scripts by setting the runlevel to 345 for the scripts to start correctly. This can be done by hand, or one can install the scripts with the command:

# chkconfig --level 345 mythbackend on

You can list which scripts are started by issuing the command:

# chkconfig --list

It might be worthwhile to kill a number of scripts that you not used. Each script in /etc/init.d contains a short explanation of what they do. You can prevent the scripts from starting by issuing the command:

# chkconfig --del <name>

Now, because 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 past all this into ~/.kde/Autostart/myth-load.sh (adjust accordingly for different desktop environments):

#!/bin/bash

# Only do this stuff if we're on the main display
# (i.e., don't do this in a vnc session)
if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ]
then
    # Load nVidia driver custom settings
    nvidia-settings --load-config-only &
    # Restore audio settings
    /usr/sbin/alsactl restore
    # Launch irexec for myth power button stop/start
    irexec &
    # Launch myth welcome 
    mythwelcome &
    # Disable dynamic power management (screen blanking)
    /usr/bin/xset -dpms
    # Disable screen saver
    /usr/bin/xset s off
fi
exit 

Don't forget to make it executable:

$ chmod +x ~/.kde/Autostart/myth-load.sh 

While logged in to an X session, you'll also have to run gdmsetup, to set autologin for your mythtv user. You'll have to get a root terminal open (if you aren't logged into your X session as root already, which is a no-no), then:

# gdmsetup 

In GDM Setup, on the first tab ('General'), you should see a section "Automatic login". Check the box for "Login a user automatically on first bootup" and select your mythtv user from the popup menu. Alternatively, if you are not very comfortable with Linux just yet, and you suspect there may be occasions where you've mucked something up to the point that an auto-login will lock up the computer, you might not want to use Automatic Login. Instead, you might opt to use the "Timed Login" option, to log the mythtv user in a few seconds after the login screen first appears. This way, you can circumvent the mythtv user logging in, and log in as root to hopefully correct whatever you've broken.

NOTE: if you installed the packages from kde-redhat, they probably supplanted gdm as your display manager and put kdm in its place. I like the look of Red Hat's gdm much better than kdm, so I changed it back by editing /etc/sysconfig/desktop and setting "DISPLAYMANAGER=GNOME". Not that you should be seeing the login screen often, my box is always sitting there logged in with the Myth UI up. Maybe I'll add some kdm info in a bit...

Anyhow, I recommend setting the Kicker (the panel at the bottom of the screen) to auto-hide, so it doesn't end up on-screen during video playback, disabling the screen saver, and disabling any monitor-related dynamic power management, or you may not be able to wake your system up if you don't have a mouse and keyboard connected. You can use the KDE Control Center to disable your screen saver, and edit your xorg.conf file to disable dpms (or at least the screen blanking parts). Note that the above myth-load.sh script actually issues a pair of commands at login time that should also disable dpms and the screen saver, but you can turn it off everywhere you can to be sure...

And finally, to turn on auto-hiding of the Kicker, right-click on the Kicker, choose 'Configure Panel...', then select the 'Hiding' tab, and select the radio button for 'Hide automatically'.

Fedora Version Specific Tips

Fedora 12

If analog sound doesn't work, try changing the audio device to ALSA:front, and change the ALSA:default mixer to control the Master control rather than PCM.