"Hier staunt der Laie und Fachmann wundert sich."

Samstag, Juni 14, 2008

Mythbuntu / Mythtv and Ubuntu

It's been a while. Last year, the xmltv scripts for the German EPG tvtoday broke and nobody seemed to be able to fix them. Having no time to fiddle with them myself I decided to give MediaPortal (for Windows) a try. Well. What can I say? It is fairly easy to get started and some things are really easy to set up (e.g. hibernate and wake up, WLAN (I keep having with my USB stick under Linux)). But other things just drove me crazy. (EPG randomly being off by one day, random freezes etc.) What bugged me most was the overall sluggish interface.

I wanted back my old MythTV. And here I am. This time I chose Mythbuntu instead of Knoppmyth and I can say that I am very pleased with the result. I am using v. 8.04 ("hardy heron"). Besides my usual problems (WLAN + WPA on a Linksys WUSB54G v1 not working reliably) I cannot complain.

Here is small note to myself and whoever is interessted about the correct settings for an old ASUS K8N (nforce3 250 chipset) to get it working with acpi-wakeup correctly. This is true for BIOS version 1009 (briefly displayed at the bottom when entering the BIOS setup), I don't know about the more recent versions.

- DISABLE RTC wake-up in the BIOS (yes, DISABLE!)
- Follow instructions from the Ubuntu-Documentation

Labels: , , ,

Mittwoch, September 26, 2007

Upgrading KnoppMyth R5A22 to R5B7

Prelude


If you are familiar with KnoppMyth R5A22 then you know that upgrading was not recommended for a long time due to some problems with this release. Since my box worked (almost) perfectly with R5A22 I did not care very much. But recently I start having problems. It started when I installed a second harddrive to add some storage space for my TV recordings.

First I thought the problem was the file system. I had chosen ReiserFS without doing any research on it, just remembering that it is a journaling file system, which always seems like a good idea. On my other partitions I had switched to XFS a long time ago since I found ext3 to be very (very!) slow on deletions of large files (which was one of my main occupations :-).

The problem that appeared were these: When watching a recently made recording (one that was freshly stored on the new partition) it simply stopped in the middle of it and then returned me to the menu, just as if it had reached the end of the recording. I used "mythfrontend" from an xterm to see if there were any erros (since "dmesg" did not show anything and the backend-log neither). Turns out, mythfrontend complains about some problem with some prebuffer timeout in connection with an mpeg4 error. I don't remember the exact wording but I figured that it could be the file system. So I switched the new partition to XFS, and the problem was gone.

Until today. It's acting up again. So this time I'll try an upgrade, since the KnoppMyth editor explicitly mentions in the forum that R5A22 users can upgrade to this new version.

Step 1


Backup current partition as described in an earlier post about upgrading to R5A22 using "dd". Then also use KnoppMyth's backup (found under the Extras menu). The automatic upgrade won't work without the latter.

Step 2


While downloading the iso image I read through this recommended post: (sorry, requires registration).

I then tried the auto-install (without doing anything that was mentioned above just to see what would happen: Lilo didn't work (showing "L 99 99 99 99" and so on on the screen). Oh well, it was worth a try :-)

Step 3


So now I reboot from the KnoppMyth install CD again. My system partition is updated so I switch to a console right away. Here, I mount /dev/hda1 (my system partition), and /proc and /dev, then chroot to it with


# This mounts my system partition
mount /dev/hda1 /mnt/hda1
# We also need /proc in the chroot environment
mount --bind /proc /mnt/hda1/proc
# We need /dev as well
mount --bind /dev /mnt/hda1/dev
# Now chroot
chroot /mnt/hda1
# and call lilo
lilo


Two problems may occur:

1) If lilo complains about not recognizing the "part:" token, then open your lilo.conf ("nano -w /etc/lilo.conf" -- withing the chroot environment!) and remove those lines starting with "part:".

2.) If lilo gives you "Fatal: open /dev/hda: Permission denied" then you probably forgot to mount /proc and /dev before chroot-ing.

OK. I rebooted now to see if this did the trick, and it did -- part of it anyway. Of course, it did not install my old lilo-configuration but the new one from RAB7. That's enough to try out how much is working though.

Step 4



X11 starts OK and KnoppMyth asks me for the root password, then the time zone settings, remote control type and so on. Since my wlan is not yet set up, I configure the eth0 interface to some sensible values.

At the end, the mythfrontend starts, but the backend seems not to work ("could not connect..."). This seems normal, since I did not confige mythtv using myth-setup yet. So I need to do this before I can restore my backup using the mythfrontend.

Step 5: Runnding mythtv-setup


In the general section I leave the IP settings alone. The second page asks for the storage dir for recordings. The default is "/mnt/store", which I do not remember to have before the update. No wonder the backend won't start. I'll set this to my old TV dir, which was /myth/tv and see what happens.

Checking my existing recordings (in the frontend) yields an empty page. After a complete reboot the recordings show up (that's strange). Phoo.

Step 6: Setting up WLAN



Todo

Step 7: Automatic shutdown and startup



I was using NVRAM and some scripts to handle the automatic shutdown and wakeup of my mythbox. NVRAM seems to be installed (apt-get install nvram-wakeup says so) and so I decide to simply copy the scripts from my backup.

Before trying it out, read http://knoppmythwiki.org/index.php?page=WakeupToRecord and remeber to

touch /var/log/mythtv/mythevent.date
touch /var/log/mythtv/mythpreshutdown.log
chmod 777 /var/log/mythtv/mythevent.date
chmod 777 /var/log/mythtv/mythpreshutdown.log


Following that I restore the /etc/nvram-wakeup.conf as well and run the nvram-wakeup command like this (if you'ver never used nvram: better read the docs first, because its different for different mainboards):
nvram-wakeup --configfile=/etc/nvram-wakeup.config --directisa


You also have to make sure that the mythtv can run the necessary commands (like nvram-wakeup, lilo, reboot). I simply restored my old /etc/sudoers from the backup.

-- Update --

Step 8: Setting up video


For some reason the ivtv firmware cannot be loaded on bootup. In the KnoppMyth wiki I found the following information, which helped me solve this (though I don't understand why):

* Edit your /etc/mythtv/modules/ivtv file and remove the "simple=1" option for msp3400.

* Edit your /etc/modules file and remove the line that says "ivtv" around line 45.

* Reboot the system.

* After it comes back up you will need to stop the backend, run mythtv-setup, clear your capture card settings, restablish them and the input connections, and finally exit mythtv-setup and restart the backend. Note that with the new driver you will see a different set of inputs for PVR-150 and PVR-500 cards.



Step 9: restoring lvm settings


I restored the content of /etc/lvm/ and added the init-script for lvm to my boot process by running (source: LVM howto)

update-rc.d lvm start 26 S . stop 82 1 .

(Note the two ".")

Step 10: setting up the remote control



I had to adjust /etc/lirc/hardware.conf to DEVICE=/dev/lirc and also I had to create the /dev/lirc device node (see lirc howto) by running

#First I had to delete the existing one, because it was incorrect
rm /dev/lirc
# Then create it correctly using
mknod /dev/lirc c 61 0


After restarting gdm (/etc/init.d/gdm restart) or rebooting the remote worked once again.

Note:
Send lircrc to knoppmyth@gmail.com

Donnerstag, April 27, 2006

Problems with LILO in a chroot environment

If you get a problem similar to this one when you run /sbin/lilo in a chroot environment:

/proc/devices: fopen failed: No such file or directory
Is device-mapper driver missing from kernel?
/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
/proc/devices: fopen failed: No such file or directory
Is device-mapper driver missing from kernel?
/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.01.03 (2005-06-13)(compat) and kernel driver
Fatal: open /dev/hda: Permission denied


you want to try the following outside your chroot, of course:

mount /proc /mnt/hda1/proc --bind
mount /dev /mnt/hda1/dev --bind

Adjust this to fit your drive mappings. What does it do? See "man mount" :-)

Now chroot again and run lilo. Works for me.

Samstag, Oktober 29, 2005

KnoppMyth R5A22: Change bootsplash

I like the bootsplash feature that comes with KnoppMyth, but I don't like the picture :-) Sorry, I just don't. But that's not a big problem as you can configure the splash screen yourself. Simply download a theme you like (e.g. from www.bootsplash.de) and isntall it in the /etc/bootsplash/themes directory. Then run
splash -s -f /etc/bootsplash/themes/YOURTHEME/config/YOURCONFIG.cfg > /boot/initrd.gz

Note the single "greater than" character here.

Upgrading to KnoppMyth R5A22

After getting the then latest release R5A16 of KnoppMyth to work with my equipment (Hauppauge PVR 500 and remote, which is a "new" MCE remote), I was anxious to upgrade to the newer version. After all, I had to make quite a lot of changes to the default installation (compile current ivtv and things like that).

Step one: Backup your system -- the easy way

I backed up my system partition /dev/hda1 using
dd if=/dev/hda1 of=/mythtv/backup/mybackup_r5a16.img bs=1024k

This will create a complete, block by block, backup of /dev/hda1 in the file /mythtv/backup/mybackup_r5a16.img. This way I will have all my configuration files in case I forget some of the necessary changes. Or I can even revert to my old system by copying the image file back to /dev/hda1 using
dd if=/mythtv/backup/mybackup_r5a16.img of=/dev/hda1 bs=1024k

This will overwrite the contents of /dev/hda1 with the contents of the image file. This will be my last resort. In fact, I do not plan to do this unless something goes terribly wrong. Instead I plan to use the backup only as a reference source for my old config-files. The image file can easily be mounted, making the contents accessable like a regular filesystem using
mount -o loop /mythtv/backup/mybackup_r5a16.img /mnt/backup

This will mount the backup image read only to the mount point /mnt/backup. (You will need to create this mount point first: mkdir /mnt/backup).

Step two: Prepare KnoppMyth for upgrade

This step is even simpler. Just use the the MythTV menu "KnoppMyth" and there "Backup KnoppMyth". This creates archives of important directories and your mysql database and puts them in /mythtv/backup. The upgrade routine of KnoppMyth will use some of this to restore your configuration. This includes e.g. your channel settings and schedule.

Step three: Upgrade KnoppMyth

Now shut down your system and boot from a new KnoppMyth R5A22 CD. Remember to choose the correct language at the lilo-prompt. E.g. "knoppmyth lang=de" for a German keyboard. When the installation menu appears choose "Auto upgrade". If you are sure that you backed up your data you may proceed. Wait till you have to reboot again, remove the disc and reboot from harddisk.

Step four: First boot after upgrading

One thing I noticed was that the screen resolution had changed. This seems to be because of the bootsplash which is now activated by default (see below). The new resolution makes your fonts appear bigger (not in MythTV but everywhere else) which is not so bad, even though I never bothered to change it before.

After the first boot I expected to have to go through the installation process and having to restore my settings by hand. Surprise, surprise, I did not have to. KnoppMyth obviously comes with an upgrade script which works nicely. It prompts you for the root password and then proceeds to restore your settings (the mysql database) and install some stuff as usual. This version also asks for the remote control you are using. I have a MCE-type remote that came with my TV card. It uses the lirc_mceusb2 driver. This one wasn't listed (I thought) but it turns out that choosing the (original) mceusb driver makes the script ask you whether you are using an old or a new version of the remote. Choosing "new" here corresponds to installing the lirc_mceusb2 driver. So I did all this but the script complains that it should be able to autodetect the remote at this point, which it could not. Thus first thing I checked after completing the install was the remote (using "irw", which should output something on the console if you press a button on the remote). But it doesn't work. -- But I'm jumping ahead of myself. Follow the instructions of the upgrade script and reboot your computer one more time. If you chose to install bootsplash (like I did) you will see an image (a version of the KnoppMyth X background) during the boot process instead of the boot messages. Pressing ESCAPE will show the boot messages though.

Step four: Assessing the upgraded system

Instead of checking dmesg to see if there were any error messages I checked to things: Does the remote work (after all the upgrade script had complained) and do my tuners work?

I had already said that my remote did not work. But the tuners do, both of them. This is nice because last time I had to compile ivtv myself. So KnoppMyth obviously now supports the Hauppauge PVR 500 out of the box. The first time I tried the picture seemed to be too big for the screen though. When I tried again this was gone (strange!). All I did in between was call "ivtv -U" which only outputs the available TV norm on the console.

Anyway, next thing I did was changing KnoppMyths settings for the ivtv-cards in /etc/sysconfig/ivtv/cfg-0 and cfg-1. Because I'm in a PAL country I enabled
IVTV_TYPE=PAL

in both files (i.e. for both tuners of my PVR 500). If you use NTSC then you don't have to change anything as this defaults to NTSC. KnoppMyth uses these configuration files in the script /etc/init.d/set_ivtv_params. [I rebooted after this to see its effects. You don't have to do this here.]

Looking at the LiveTV doesn't look as good as it did before, so I checked the output of "dmesg" for any inconsistencies. While doing that I also disabled (using "modconf") some modules that I'm sure I won't need:
  • under kernel/drivers/media/dvb/bt8xx (do it in this order or it may not work!):
    • dvb-bt8xx (this will also remove bt878, dst_ca, dst, and bttv and possibly more)

Of course, this did not fix the picture quality. I still have to figure out what's wrong with that.

New MythTV setting

Switching to watching Live TV the first time I had also noticed that the program displayed some weird "Signal %" stuff instead of the show's description. Maybe this is related to the new setting in MythTV (mythfrontend) that can be found under Configuration / TV / General / Local settings. There are two new settings called "Guide language #1" and "Guide language #2". Instead of figuring out it's meaning I simply changed if "Arfa" to "German". Of course, you will want to choose your own language. Note that they do not seem to be strictly in alphabetical order, so keep on looking if you can't find the right language right away.

ndiswrapper

I have a WLAN USB adaper (Linksys WUSB54G) which I run with the ndiswrapper modules. There are other ways of doing this (not using ndiswrapper) but I have no time fiddling around with this so I stick to ndiswrapper.

Because I don't have an Internet connection without this card, I had to use the deb-package on my backup image instead of apt-getting the newest one. I created a mount point for my backup image ("mkdir /mnt/loop") and mounted it there:
mount -r -o lo /mythtv/backup/mybackupr5a22.img /mnt/loop
After doing this I was able to access (read only) all my configuration files and everything else via /mnt/loop. First thing I did was update my locate database so the locate command knows about /mnt/loop.
updatedb

Depending on the number of files and speed of your disks this may take a couple of minutes. Afterwards you can use
locate [part_of_name]

to find any files containing [part_of_name]. If used that to locate the driver files for my wlan card (wusb54g). I found them to be at /mnt/loop/etc/ndiswrapper/wusb54g. Using ndiswrapper I installed them with
ndiswrapper -i /mnt/loop/etc/ndiswrapper/wusb54g/wusb54g.inf

If you have a different card then you will need to supply the driver's .inf-file here. Check with "ndiswrapper -l" afterwards if the drivers were correctly installed.

Because I use WPA to protect my WLAN (you should, too!) I also had to install wpa_supplicant. Again, not yet being able to access the internet I had to use my backup image. This time I looked for wpa ("locate wpa") and found the .deb-package at /mnt/loop/var/cache/wpasupplicant_x_i386.deb" where x is a version string, depending on the version you installed. Use "ls /mnt/loop/var/cache/wpa*" to find the correct one. Mine was wpasupplicant_0.4.4-1_i386.deb so I will use that here. Install the package using
dpkg -i /mnt/loop/var/cache/wpasupplicant_0.4.4-1_i386.deb

You will also want to copy the following configuration files (which pertain to the wlan and network in gerneral):
cp /mnt/loop/etc/wpa_supplicant.conf /etc/wpa_supplicant.conf

cp /mnt/loop/etc/default/wpasupplicant /etc/default/wpasupplicant

cp /mnt/loop/etc/network/interfaces /etc/network/interfaces


After that there are a couple of things left to do:
  1. Enable the ndiswrapper-module using modconf (the module is found under "misc", all the way down).
  2. Remove all "linux-wlan-ng" modules using modconf (the modules have their own group right above "misc"). You should disable all of them.
  3. Enalbe wpasupplicant to be started at boot time using
    update-rd.d wpasupplicant defaults

    This will add the script /etc/init.d/wpasupplicant to your default run-levels (2, 3, and 4).
  4. Start wpasupplicant using
    /etc/init.d/wpasupplicant start
  5. Bring up your wlan interface. Mine is called "wlan0" so I do "ifup wlan0". Now you should be able to ping other NICs on you network.


If you used hotplug to bring up your card then you will also want to copy the necessary files. In my case /mnt/loop/etc/hotplug/usb/wlan0 and wlan0.usermap.

Getting the remote to work again

The new upgrade script asks for the type of remote but mine did not work right away. The script installed the correct driver (lirc_mceusb2 in my case) but irw did not show any output. This point to an incorrect /etc/lircd.conf file, and indeed this is the culprit. The upgrade script did not replace it with a correct version (or which would have been even better: with my original one). So I had to do it myself:
cp /mnt/loop/etc/lircd.conf /etc/lircd.conf

After restarting lircd ("/etc/init.d/lirc restart") and quitting and restarting mythfrontend, my remote works like a charm again.

At this point my MythTV box is working as before. I will check out the new features later.

Mittwoch, Oktober 26, 2005

KnoppMyth: Enabling password protection of MythWeb

You created a htpasswd-file and changed the .htaccess-file but MythWeb still does not prompt for password? The reason could be that .htaccess files are being ignored by apache. This can be configured in /etc/apache/httpd.conf.

Look for lines reading
ALLOW OVERRIDE = NONE

This means that apache will ignore your .htaccess files altogether. Note that they usually is more then one line of this kind. If you are on an intranet and you just want to keep certain users from accessing your mythweb, then all you need to do is change the appropriate line to:
ALLOW OVERRIDE = ALL

"The appropriate line" is the one that pertains to the /var/www directory. If you are not sure about this then you should consider reading the documentation at www.apache.org. Don't forget to restart apache afterwards (/etc/init.d/apache restart).

Problem when upgrading to new version of glibc?

Here is an annoyning little problem that I kept running into when I wanted to upgrade to a newer version of glibc:

dpkg kept complaining that there is another version listed in /etc/ld.so.conf. Too bad it didn't say which line it was complaining about or which folder the offending files were in. So I commented out one line after another and ran ldconfig each time. Then I tried to upgrade again, but without any success.

Turn out that comments don't do the trick. You need to acutally delete the lines from /etc/ld.so.conf. (Why does nobody ever tell you these things?)

Dienstag, Oktober 25, 2005

Hints for wpa_supplicant and ndiswrapper on Debian (Sarge)

If you have installed both wpa_supplicant and ndiswrapper and have managed to manually start them from a terminal, then will probably want them to start after the next reboot automatically.

Here is what you need to do:

1) Make sure that you entered the correct options for wpa_supplicant in /etc/default/wpasupplicant. Specifically, you should set "ENALBE=1" and insert a line similar to
OPTIONS="-i wlan0 -D ndiswrapper -c /etc/wpa_supplicant.conf

where "wlan0" is the name that you used in /etc/network/interfaces to identify your card. Speaking of which:
2) Insert a line in /etc/network/interfaces similar to
iface wlan0 inet dhcp

and also don't forget to enalbe the autmatic startup of the interface by adding it to the line starting with "auto", e.g.
auto lo wlan0

3) Now all you have todo is tell Debian to start the wpa_supplicant at boot-time which is done by adding it to the default runlevel like this:
update-rc.d wpasupplicant defaults

(Note the missing underscore "_" here. If this does not work, then try it with "wpa_supplicant".) If you don't have the update-rc.d command on your system then you will most likely have a file called /etc/runlevel.conf. Check this page for more info: http://debiananwenderhandbuch.de/init.html

Freitag, Oktober 21, 2005

Updating tv_grab_de_tvtoday on a KnoppMyth installation

So I decided to go ahead and buy the Hauppauge PVR 500. To make it fit in the AOpen case I removed the built-in card-readers which occupy the 3.5" slot. This is not the nicest solution but it serves my purpose for the time being (i.e. not having a spare 2.5" harddisk).

After installing KnoppMyth (and the latest ivtv 0.4.0, because the one that comes with KnoppMyth is way too old), I wanted to grab the TV listing from TV-Today (I'm in Germany). The version that comes with KnoppMyth is not working due to changes on the TV-Today website, so I had to install an update. There seems to be no doc (at least I could not find one), so here is what I did:


1.) Download http://cvs.sourceforge.net/viewcvs.py/*checkout*/xmltv/xmltv/grab/de_tvtoday/tv_grab_de_tvtoday.in
2.) Replace your current tv_grab_de_tvtoday with this file (renaming it, i.e. removing the ".in"). In KnoppMyth it's in /usr/bin
3.) Make the file executable (chmod 755 tv_grab_de_tvtoday)
4.) Open the file using your favorite text-editor, e.g. nano -w tv_grab_de_tvtoday, and locate the line starting my $SHARE_DIR=undef; and replace the undef by "/usr/share/xmltv" (including the quotes!). Of course, if xmltv is installed in a different dir on your system you should change this line to the appropriate path.
5.) Download http://cvs.sourceforge.net/viewcvs.py/*checkout*/xmltv/xmltv/grab/de_tvtoday/channel_ids
6.) Copy the file to the correct xmltv-sub-directory. Again, on KnoppMyth this is /usr/share/xmltv/tv_grab_de_tvtoday/.
7.) Run mythfilldatabase --manual. This time, it should start grabbing (which, by the way, can take a very long time). After a while (10-60 minutes), it should prompt you with some info it needs from you. You should know what to do from here on.