MythTV


January 8, 2009: 9:34 pm: MatthewDebian, Linux Misc, MythTV, Technical, Ubuntu

So we had a power outage at our house, and I had to shut down my Myth backend server for the duration, and decided to try and fix its sometimes-spotty NIC at the same time.  Every so often I got a completely dead response so trying to scp something there was painful… so I swapped the hardware.  Unfortunately, when it came up, the machine realized the card was a new one (3c905, they’re still astoundingly reliable) and complained.  First it told me it was the wrong MAC address, then it gave up and assigned it eth1.  Unfortunately, all my settings were bound to eth0 and when I changed the /etc/network/interfaces to reference eth1 instead, some parts still didn’t work… mysql complained, and mvpboot just was unwilling to do anything.

Bad news.

I finally found a thread about replacing a NIC in (I think) Ubuntu 8 but when I tried the solution, the file they referred to (

/etc/udev/rules.d/70-persistent-net.rules

) didn’t exist.  Back to Google.

Next I found an older forum exchange about ubuntu 6.06 NIC replacement breaking the network, and I was able to find that file:

/etc/iftab

and in it was the old MAC address.  Commented the line out, restored the settings to be eth0, rebooted, and bingo I’m back in business.  Wish I had found it last night…

July 26, 2008: 12:14 pm: MatthewFamily, MythTV, Pushing the Envelope, Technical

First step was getting the MythFrontend to work on my mac… I downloaded the newest version, ran it, gave it the configurations needed, and it would repeatedly silently die. After trying to get a 0.21 build to work, I finally figured out how to run an application from the command line (no error messages! Argh!) and was able to see that there was a version mismatch. Downloaded 0.20-fixes and it worked great, first time. Three hours gone… sigh.

Moving on to the AppleTV…

Used the original appletv install documentation on the mythtv site

It went pretty well, directing me to an engadget article about upgrading appletv hard drives, showing how to dissasemble the appletv and back up the contents of the hd.

 dd if=/dev/disk1 of=/Users/mps/AppleTV.img bs=1024k

to check status, new terminal window and “kill -INFO [8636, PID of the dd process]”

then moving over various files:

cp -p /Users/mps/Downloads/Patchstick/Patchstick/atvloader/AwkwardTV.frappliance/Contents/Resources/sshd /Volumes/OSBoot/usr/sbin/
chmod +x /Volumes/OSBoot/usr/sbin/sshd
cp -p /Users/mps/Downloads/Patchstick/Patchstick/ssh/ssh.plist /Volumes/OSBoot/System/Library/LaunchDaemons/
defaults delete /Volumes/OSBoot/System/Library/LaunchDaemons/ssh Disabled
mkdir /Volumes/OSBoot/System/Library/Frameworks/OSXFrames
cp -pr /System/Library/Frameworks/Kerberos.framework /Volumes/OSBoot/System/Library/Frameworks/OSXFrames/.
cd /Volumes/OSBoot/usr/libexec/
cp /usr/bin/ssh* ../../usr/bin/
cp /usr/libexec/sshd-keygen-wrapper ../../usr/libexec/
cp /usr/libexec/sftp-server ../../usr/libexec/

when I tried to “cp /usr/libexec/ssh* ../../usr/libexec/” I got:
“cp: /usr/libexec/ssh-keysign: Permission denied”

so somehow there was a strange source permission issue… I didn’t sudo it because the docs said it wasn’t really needed.
then fixing perms:

sudo chown 0:0 sshd-keygen-wrapper
chmod 755 sshd-keygen-wrapper
sudo chown 0:0 sftp-server
chmod 755 sftp-server
cd ../../usr/bin/
sudo chown 0:0 ssh*
chmod 755 ssh*

and then it says we’re done and to test ssh. However, I don’t want to be transferring 100mb of MythFrontEnd over wireless if I don’t have to… so:

tar cf ~/MythFE.tar -C /Applications/ MythFrontend.app

(yes, there’s a space before the MythFrontend.app, and I don’t know why… I’ll read the tar man page someday) [edited: read the man page, it's to change to that directory before running the tar command. Handy.]

cp MythFE.tar /Volumes/OSBoot/

(might be lost, but then again might save me time later)

So then comes the test… connecting with SSH:

$ ssh -1 frontrow@appletv.local
Protocol major versions differ: 1 vs. 2
$ ssh  frontrow@appletv.local
Unable to negotiate a key exchange method

so, according to another page on the site this is because the ’sed’ that I used on sshd-keygen-wrapper was missing a space. However, the drive is back in the appletv so grrrrr.

Next step: build a patchstick. Gathered everything, ran the Leopard script and it says happy.

No boot. Rats. Since I had to use a USB-SD adapter instead of a regular USB stick, maybe it’s not bootable.

Borrowed a 512mb stick from a friend and re-created the patchstick. It works! OK, so I can now SSH into the appleTV. Next step, being able to do anything :)

Following the instructions, I went to make the disk read-write:

mount -o remount,rw /dev/disk0s3 /
/dev/disk0s3 on /: Operation not permitted

No dice. From the awkwardTV description:

 The user "frontrow" has complete sudo privileges. To be root, do sudo -s and put in the password again

which says to me that the original guide is probably out of date. As if we hadn’t already discovered that. So, I’m going to take the rest of the steps with a grain of salt…

root@appletv# mkdir /etc/mach_init.disabled
root@appletv# mv /etc/mach_init.d/ripstop.plist /etc/mach_init.disabled

Add the following to /etc/rc.local (create this file if it doesn’t already exist):

/sbin/kextunload -b com.apple.driver.AppleTCOWatchdog

Well, the read-write instructions worked OK, but vim and su didn’t — looks like Leopard strikes again. That means the well-intentioned line about adding to rc.local didn’t work easily since there’s no editor, and now I have to find vi somewhere else so it will work. Instead I went with the lazy method described on the watchdog detail page:

echo "/sbin/kextunload -b com.apple.driver.AppleTCOWatchdog" >> /etc/rc.local

which worked. Huzzah for Echo. Timezone time…

echo "/bin/ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime" >> /etc/rc.local

Erg. Big stopsign as my ATV is now rebooting after a few minutes. Not the 58 seconds described in the Watchdog writeup, maybe ATV2 is different… reverting…

-bash-2.05b$ sudo mv /etc/rc.local .
Password:
-bash-2.05b$ ls
Desktop         Library         Music           Pictures        Sites
Documents       Movies          MythFE.tar      Public          rc.local
-bash-2.05b$ ls /etc/mach_init.disabled/
ripstop.plist
-bash-2.05b$ sudo -s
bash-2.05b# mv /etc/mach_init.disabled/ripstop.plist /etc/mach_init.d/

so the ripstop.plist is back in place and rc.local is hidden. Waiting now to see if that stops the rebooting. It did.
OK, so moving to install nitoTV (after downloading it to my local downloads, and since there’s no unzip on the ATV) since it claims to kill the watchdog in 2.1:

mac$ tar cvf ~/nitoTV.tar -C /Users/mps/Downloads/ nitoTV.frappliance
mac$ scp nitoTV.tar frontrow@appletv.local:~
atv$ sudo -s
atv# tar xvf nitoTV.tar
atv# mv nitoTV.frappliance/ /System/Library/CoreServices/Finder.app/Contents/PlugIns
atv# ps -ax | grep Finder
atv# kill [Finder PID]

Restarting Finder takes a while… interesting. Wow. That was a long time. Then reboot, then to safe mode, then to reboot again, then long startup but it worked. Sorta. No nitoTV visible anywhere. Fail.

Back to searching for a fix. OMFG there’s a different link to the same version of nitoTV that has an installer. Deep cleansing breath. Now deep cleansing code:

ATV$ cd ~
ATV$ rm -rf nitoTV.frappliance/
ATV$ sudo rm -rf /System/Library/CoreServices/Finder.app/Contents/PlugIns/nitoTV.frappliance/

Cleaned. Now to push the new installer version out there (I changed the folder name after unzipping since I dislike dealing with spaces on the command line):

mac$ tar cvf ~/nitoTV.tar -C /Users/mps/Downloads/ nitoTV_Take_Two
mac$ scp nitoTV.tar frontrow@10.0.0.219:~
ATV$ tar xvf nitoTV.tar
ATV$ cd nitoTV_Take_Two/
ATV$ sudo ./installme
installer: Package name is nitoTV 0.4.8
installer: Installing onto volume mounted at /.
installer: The install was successful.
Restarting Finder...

And Finder did indeed restart – holy MACKEREL there’s a new entry. Reading the notes (wow, what a concept) it says it looks in /Users/frontrow/Applications for the apps… but that’s not where I put MythTV. So:

atv$ cd ~
atv$ mkdir Applications
atv$ mv /Applications/MythFrontend.app/ ./Applications/
mv: rename /Applications/MythFrontend.app/ to ./Applications/MythFrontend.app/: Read-only file system [ed: whoops, the installer tweaked my earlier settings]
atv$ sudo -s
atv# mount -o remount,rw /dev/disk0s3 /
atv# mv /Applications/MythFrontend.app/ ./Applications/

and presto! it appears in the Applications list within Nito. However, it dies fast. That’s OK, I know more about it now… having retrieved 10.4 versions of the files:

mac$ scp /Users/mps/vim frontrow@10.0.0.219:~
mac$ scp /Users/mps/nano frontrow@10.0.0.219:~
mac$ scp /Users/mps/su frontrow@10.0.0.219:~
atv# mv vim /usr/bin/
atv# mv su /usr/bin/
atv# mv nano /usr/bin/
atv# ln -s /usr/bin/vim /usr/bin/vi
atv# vi ~/.mythtv/mysql.txt
bash: /usr/bin/vi: Bad CPU type in executable
atv# nano
bash: /usr/bin/nano: Bad CPU type in executable

Well, curses! And here I thought we were going to work now… cleaning up again.

atv# rm /usr/bin/vi
atv# rm /usr/bin/vim
atv# rm /usr/bin/nano
atv# rm /usr/bin/su

So that means it’s not as easy as I thought… going back to the source disk:

mac$ sudo pax -r -p e -z -f /Volumes/Mac\ OS\ X\ Install\ Disc\ 1/System/Installation/Packages/BSD.pkg/Contents/Archive.pax.gz './usr/bin/vim'
mac$ sudo pax -r -p e -z -f /Volumes/Mac\ OS\ X\ Install\ Disc\ 1/System/Installation/Packages/BSD.pkg/Contents/Archive.pax.gz './usr/bin/nano'
mac$ sudo pax -r -p e -z -f /Volumes/Mac\ OS\ X\ Install\ Disc\ 1/System/Installation/Packages/BSD.pkg/Contents/Archive.pax.gz './usr/bin/su'
mac$ scp /Users/mps/usr/bin/vim frontrow@10.0.0.219:~
mac$ scp /Users/mps/usr/bin/nano frontrow@10.0.0.219:~
mac$ scp /Users/mps/usr/bin/su frontrow@10.0.0.219:~
atv# mv vim /usr/bin/
atv# mv su /usr/bin/
atv# mv nano /usr/bin/
atv# ln -s /usr/bin/vim /usr/bin/vi
atv# vi ~/.mythtv/mysql.txt

Ladies and Gentlemen, we have an editor! Of course, for some odd reason vi isn’t accepting my keyboard arrow mappings, so we shift to nano…

nano ~/.mythtv/mysql.txt

Update the settings. Restart the ATV. Pick the MythFrontend.app – and no joy. Found another page on AwkwardTV that references the fonts issue mentioned on the MythTV HowTo, trying those steps:

mac$ scp /Library/Fonts/Trebuchet\ MS* frontrow@10.0.0.219:~
mac$ scp /Library/Fonts/Arial* frontrow@10.0.0.219:~
mac$ scp /System/Library/Fonts/Geneva.dfont frontrow@10.0.0.219:~
atv$ sudo su
su: initgroups failed: Operation not permitted [grrrr, guess this isn't as easy as it should be]
atv$ sudo -s
atv# mv Arial* /Library/
atv# mv Trebuchet\ MS* /Library/
atv# mv Geneva.dfont /System/Library/Fonts/
atv# shutdown -r now

Wait for reboot… go to the app… we have a setup screen! Many notes say it’s easier to set it up from VNC than on the remote, so next step is setting up VNC.

atv# echo 71463E00FFDAAA95FF1C39567390ADCA > /Library/Preferences/com.apple.VNCSettings.txt
atv#  sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes
sudo: /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart: command not found

Oops, broke. OK, looking for VNC instructions for a Take2 version (scroll down on that page):

atv# cd ~
atv# sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m
atv# sudo hdiutil mount recovery.dmg
atv# sudo hdiutil mount /Volumes/Recovery/OS.dmg
atv# cp -pr /Volumes/OSBoot\ 1/System/Library/CoreServices/RemoteManagement/ /System/Library/CoreServices/RemoteManagement
atv# cp -pr /Volumes/OSBoot\ 1/System/Library/Perl/ /System/Library/Perl/
atv# cp -pr /System/Library/Perl/Extras/5.8.6/ /System/Library/Perl/5.8.6/
(already created the VNCSettings.txt file above, if you skipped that do it now)
atv# /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes
atv# /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users frontrow -privs -all -restart -agent -menu
atv# /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/MacOS/AppleVNCServer

… but it keeps running in your SSH session, so that’s not 100% ideal. Well, tradeoffs… I can afford another SSH session :)

So I downloaded Chicken of the VNC to get access. It worked pretty well, but then the screensaver took over and I couldn’t see what I was doing. Rebooted the ATV and went to the screensaver, turned it to “Never”. After all, I turn off my TV, not let it burn energy just for the heck of it.

OK, so I can’t get the remote to work now. Monkeyed around with trying to get a local keyboard working and no luck there either. I’m stymied. Time to ask on the forums.

October 28, 2007: 7:53 pm: MatthewFamily, Linux Misc, MythTV, Technical, Tips and Tricks, Ubuntu

Wow, I was putting together my MythTV machine and it was OK until I had to get my remote front-end working. Because of the WAF, I selected a small machine – the Hauppage MediaMVP. What I didn’t recognize was that the documentation for getting it running… umm… stinks. Or at least is severely misleading (http://www.mvpmc.org/ mvpmc-HOWTO-singlehtml.html, not linked so you don’t try and use it. I should have noticed when it used software 13 versions old.). Or is really hard to find. So here’s my trials and tribulations and fixes, for anyone who is doing it.

Add to Ubuntu (Feisty Fawn) to get the mvpmc code loaded:

apt-get install atftpd tftp
mkdir /tftpboot
chmod a+rwx /tftpboot
export TFTPBOOT=/tftpboot
cd /tftpboot/
wget http://downloads.sourceforge.net/mvpmc/dongle.bin.mvpmc-0.3.3?modtime=1169 586056&big_mirror=0
ln -s dongle.bin.mvpmc dongle.bin.mvpmc-0.3.3
ln -s dongle.bin.mvpmc-0.3.3 dongle.bin.mvpmc

but then I was shocked to find that while the config files for inetd were created, there was no inetd. So…

apt-get install xinetd tcpd
apt-get install nfs-common nfs-kernel-server
cd /etc
e exports
ls /media/hdb1/mythtv/recordings/
/etc/init.d/nfs-kernel-server start
/etc/init.d/nfs-common start
update-rc.d nfs-kernel-server defaults

and then it wouldn’t read the config file. Time to add the setting to have xinetd use inetd.conf…

e /etc/init.d/xinetd
add in flag: -inetd_compat

I learned that the instructions on mvpmc.org are pretty specific to the first generation of the machine, the H1. However, those aren’t made any more… and once I got into trouble, each piece turned out to be challenges with the version. I’ve got an H3. For that, you need a special service that whispers magic incantations into the ear of the MVP. It also needs a significantly different guide… and after searching and searching (has VLC notes for future) and searching (supersweet detail, enough to choke on and more, which also gave me the link to…) I finally stumbled across on http://mvpmc.wikispaces.com/ and started getting more progress on MythTV setup… well, almost…

e mvpboot.pl

and I then went spelunking into mvpboot.pl and mvprelay.c -

perl -MCPAN -e shell
install Net::Interface
apt-get install initrd-tools gcc
dd if=dongle.bin.mvpmc-0.3.3 of=dongle.bin.ver bs=1 count=40 skip=5

So once again I’m thrilled by Debian/Ubuntu and their dependencies… as well as the prompts (when you run a nonexistent program, Ubuntu now suggests packages to install that provide the command you’re trying to use… very cool). But I hate how I rely on them, because I thought once I actually installed GCC that it would work. I finally was googling and found I was still missing one big piece:

apt-get install build-essential

and now all the compilation stuff worked and Perl was happy. Argh!

I then started fighting my drive definitions… I had partitioned my three drives in a marvelous way, redundancy for the OS and big space for the media:

Mirrors on drive 1 and 2:

  • 100mb – /boot
  • 2gb – swap
  • 28gb – /

One big XFS drive (3) for media:

  • 400gb – /media

except it appears Ubuntu uses /media for its mount space, and somehow my brain didn’t register that. So when the folder was there, I thought it would have my big space… but no. Fought with fstab a while and eventually got it so the last drive moved to /mediafiles and all started working.

Now the shiny stuff. MVPMC can stream music from a central server, too…

apt-get install slimserver

and it didn’t work that well when I put it in. All I could get was a statement from Live365 that I wasn’t logged in. Shockingly, when I went to the SlimServer instructions and did some basic configuration :P it worked. Who’da thunk it?  I also had to chmod 777 to get it to read the media… I’ll clean that up later.

Other MythTV bits:

apt-get install mythweb mythmusic mythvideo mythplugins ogle mplayerapt-get install vlc videolan-doc

Followed the instructions on setting up vlc. It also said I needed mpslave to use aacPlus or Real Audio streams… right now I don’t need that bad enough to do the work. It’s not working yet, so I’ll have to poke it more later.

What remains? Glad you asked…

  • For some reason the network connection is running at 10mb Half Duplex. Since it happens with other computers on that drop I think it’s a switch or wire problem.
  • mplayer on my mvpmc only shows streaming radio successfully from live365 and the other XML is having parsing errors.
  • slimserver is cataloguing AAC files from iTunes but not playing them, even the unencrypted ones
  • I have to set up playlists and my local radio stations as m3u links so we can use them also… should be easy, just has to be done…
  • I want to get the ReplayTV and Filesystems menu items to not display, which should be doable according to the commandline argument writeup but it somehow isn’t.
  • Live TV isn’t running yet (but we almost never watch live TV so I don’t care much)
  • Get VLC working
  • Clean up the /mediafiles/music chmod 777 hack
  • Oh yeah, and getting it working with remote systems so I can drive the other two TVs. I’m going to see if I can get my hands on an AppleTV to get a richer interface for the Myth frontend and still have iTunes playback work for the stereo… that might be better for music playing. Not to mention then it will have HDMI or composite video which would be very good if we upgrade our TVs anytime in our life… sigh.
October 27, 2007: 4:17 pm: adminHome Improvement Ideas, Linux Misc, MythTV, Technical, Ubuntu

so I tried putting together a media server earlier in the year (late last year?) and never quite got it going.  Now, it’s up and running.  I fragged the previous build and installed Ubuntu Feisty Fawn (7.04) and all the issues I had previously run into pretty much were just handled naturally.  I had only one problem when I followed the community setup guide and that was that somehow I missed the significance of the Channel Frequency table selection… so when I started recording things, all I got was static and the server only recognized the VHF channels (2-13).  Thankfully, I wasn’t the first to have an issue like this so I googled and found a discussion on what to do when you only see local channels.  ‘us-cable’ is your friend!

Now, we’re recording.  Next, remote playback on a small, wife-acceptable device.