Archive for December, 2008

How to fix a corrupted mythtv channel lineup

December 30, 2008

For some reason mythtv (mythweb) channel line up gets corrupted: same programs appear on multiple channels and channel ids are not correct.
Fix is pretty simple. As root run:

mythfilldatabase --do-channel-updates

See also mythfilldatabase in mythtv wiki.


Restoring mythtv database from backup

December 24, 2008

My mythtv database got corrupted and mysqlcheck repair and check commands

mysqlcheck --repair -u mythtv -pmythtv mythconverg
mysqlcheck --check -u mythtv -pmythtv mythconverg

were unable to fix it.

Ironically database got corrupted when my backend server crashed and rebooted while defragmenting xfs file system that stores my recordings..

Error message from log files:

root@hippo:/var/log# grep recorded syslog
syslog:Dec 23 20:12:42 hippo mysqld[3432]: 081223 20:12:42 [ERROR] /usr/sbin/mysqld: Incorrect key file for table './mythconverg/recorded'; try to repair it

root@hippo:/var/log/mythtv# grep Incorrect mythbackend.log
mythbackend.log:Incorrect key file for table './mythconverg/recorded'; try to repair it

Also myisamchk was unable to fix recorded.MYI file:

root@hippo: cd /var/lib/mysql/mythconverg
root@hippo:/var/lib/mysql/mythconverg# myisamchk -f -r recorded.MYI
myisamchk: Unknown error 126
myisamchk: error: 'recorded.MYI' doesn't have a correct index definition. You need to recreate it before you can do a repair

So mythtv backup file to rescue…

I’m using this perl script to backup my mythtv database daily.

My crontab:

root@hippo:/var/log/mythtv# crontab -l
# m h  dom mon dow   command
00 4 * * * nice -19 /usr/local/bin/ --rotate 3

Backup files are here:

root@hippo:~/mytti# ls -ls
total 165152
19284 -rw-r--r-- 1 root root 19721887 2008-12-21 04:00 mythconverg-20081221040003.sql.gz
18736 -rw-r--r-- 1 root root 19160852 2008-12-22 04:00 mythconverg-20081222040003.sql.gz
18180 -rw-r--r-- 1 root root 18589893 2008-12-23 04:00 mythconverg-20081223040002.sql.gz

So restore full myth database per these instructions

Database itself must be created first:

root@hippo:~/mytti# cat /usr/share/mythtv/sql/mc.sql
CREATE DATABASE if not exists mythconverg;
GRANT ALL ON mythconverg.* TO mythtv@localhost IDENTIFIED BY "mythtv";
GRANT CREATE TEMPORARY TABLES ON mythconverg.* TO mythtv@localhost IDENTIFIED BY "mythtv";

root@hippo:~/mytti# mysql -uroot -p < /usr/share/mythtv/sql/mc.sql
Enter password:

Next restore command:

root@hippo:~/mytti# --filename mythconverg-20081223040002.sql.gz

ERROR:  Unable to do a full restore. The database contains data.

It fails since database contains data. So we drop database:

root@hippo:~/mytti# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysq> DROP DATABASE IF EXISTS mythconverg;
Query OK, 96 rows affected (0.05 sec)

mysql> quit;

This fails since no database exists:

root@hippo:~/mytti# --filename mythconverg-20081223040002.sql.gz

ERROR:  The database does not exist.

Need to recreate database:

root@hippo:~/mytti# mysql -uroot -p< /usr/share/mythtv/sql/mc.sql
Enter password:

Now restore works:

root@hippo:~/mytti# --filename mythconverg-20081223040002.sql.gz

Successfully restored backup.
[ OK ]
root@hippo:~/mytti# /etc/init.d/mythtv-backend start
* Starting MythTV server: mythbackend                                                             [ OK ]

And all of my recordings and recording schedule are backup again.

“Verifying DMI Pool Data” solution on Linux

December 19, 2008

“Verifying DMI Pool Data” message can appear for many reasons…

This may not be universal solution, but it worked for me.

All of this trouble started when I inadvertently selected “Install the package maintainer’s version” option when updating Ubuntu 8.04. and my /boot/grub/menu.lst got messed up and upon next reboot got “Verifying DMI Pool Data” message and Linux system hanged.

In fact prompt about updating menu.lst is not very clear in Ubuntu…


Rescue boot using Ubuntu 8.04 cdrom. Highlight “rescue broken system” and hit F6 and type “fb=false” and hit return.
This is a required step. Otherwise grub does not run from shell.

Keep hitting default values and select your root partition. Soon you get choice to start shell, reinstall grub or reboot system (dont remember all the choices).
Start shell and goto /boot/grub/.

Make sure menu.lst and match your system config and edit if needed.

Dont panic. You may need multiple iterations to get things fixed. You can also edit boot parameters (essentially menu.lst) on the fly: upon rebooting Linux hit ESC to display grub boot menu, highlight desired kernel choice and hit ‘e’ to edit boot parameters. It is pretty handy and quick way to get (hdX,Y) line correct!

GRUB uses a special syntax for specifying disk drives which can be accessed by BIOS. This file is /boot/grub/

It is good idea to keep working backup copies of these files! Make also sure groot is correct in menu.lst file.

Finally reinstall grub and reboot.

These links helped me:

My (sda is IDE, sdb is SATA and sdc is SATA disk):

root@hippo:/boot/grub# cat
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc

groot in menu.lst:

root@hippo:/boot/grub# grep groot menu.lst
## e.g. groot=(hd0,0)
## old groot=(hd2,0)
# groot=(hd0,0)

root lines in menu.lst:

root@hippo:/boot/grub# grep root menu.lst|grep -v \#
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-21-generic root=UUID=2479d97c-58e1-4958-8340-3302beab8202 ro quiet splash
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-21-generic root=UUID=2479d97c-58e1-4958-8340-3302beab8202 ro single
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=2479d97c-58e1-4958-8340-3302beab8202 ro quiet splash
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=2479d97c-58e1-4958-8340-3302beab8202 ro single
root (hd0,0)