Installing MythFrontend on an AppleTV
Status: The guide is now complete, but I've not yet re-verified the procedure by restoring back to factory defaults and running through it again. If anyone else follows this procedure then please leave feedback
This document describes the process of installing MythFrontend on an AppleTV. Most of the information required to do this was gleaned from other websites, and I've tried to link to the source of the information. The only step in this procedure that I didn't find anywhere else was copying the fonts from another Mac to the AppleTV, someone on the dev mailing list suggested that it could be a missing font.
I haven't had time to take apart my AppleTV again and verify the procedure, so it would probably be a good idea if someone who has already voided their AppleTV warranty tried it first and adds some feedback if necessary.
- 1 Warning/Disclaimer
- 2 Requirements
- 3 Document Conventions
- 4 Backup your AppleTV and install SSH
- 5 Preparing the AppleTV
- 6 Build MythFrontend
- 7 Copy MythFrontend
- 8 Fonts
- 9 Run MythFrontend again
- 10 Replace the Finder with MythFrontend
- 11 Tidyup
- 12 External links
- An Apple TV
- An OSX build of MythFrontend. I used 0.20-fixes from http://padilla.net/mythtv-osx, or you can build your own. NOTE that the recent pre-built binaries (anything build on 10.5.6 and above) will NOT run on a 10.4 box. You will need to build your own version
- An Intel Mac to connect the harddrive to
- A 2.5" IDE drive to firewire converter
- Torx T8 and T10 screwdrivers
Some commands in this HOWTO need to be run on your Mac, and some on the AppleTV. I've tried to make this clearer by specifiying the user and host as the command prompt. E.g. this should be run as a normal user on the Mac:
y@mac# ls -l /
whereas this should be run as root on the AppleTV:
root@appletv# ls -l /
Backup your AppleTV and install SSH
I followed the instructions here http://www.engadget.com/2007/03/23/how-to-upgrade-the-drive-in-your-apple-tv/
Basically, you need to open the AppleTV and remove the hard drive. Connect it to your Intel Mac (do not use a PPC Mac or you'll risk damaging the GUID partition) using the 2.5" IDE to firewire adaptor.
Use the diskutil command to determine which is the AppleTV disk. You'll see something like this:
y@mac# diskutil list /dev/disk0 #: type name size identifier 0: GUID_partition_scheme *149.1 GB disk0 1: EFI 200.0 MB disk0s1 2: Apple_HFS Macintosh HD 148.7 GB disk0s2 /dev/disk1 0: GUID_partition_scheme *37.3 GB disk1 1: EFI 34.0 MB disk1s1 2: Apple_Recovery 400.0 MB disk1s2 3: Apple_HFS OSBoot 900.0 MB disk1s3 4: Apple_HFS Media 35.8 GB disk1s4
In this case the AppleTV drive is /dev/disk1 (look for the OSBoot and Media partitions). Make a backup of the drive using the following command:
y@mac# dd if=/dev/disk1 of=AppleTV.img bs=1024k
I followed the instructions here http://wiki.awkwardtv.org/wiki/Install_SSH
Copy ssh from /usr/sbin to the AppleTV drive and make sure it's executable:
y@mac# cp /usr/sbin/sshd /Volumes/OSBoot/usr/sbin/ y@mac# chmod +x /Volumes/OSBoot/usr/sbin/sshd
Ensure /Volumes/OSBoot/System/Library/LaunchDaemons/ssh.plist contains the following:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <false/> <key>Label</key> <string>com.openssh.sshd</string> <key>Program</key> <string>/usr/libexec/sshd-keygen-wrapper</string> <key>ProgramArguments</key> <array> <string>/usr/sbin/sshd</string> <string>-i</string> </array> <key>SessionCreate</key> <true/> <key>Sockets</key> <dict> <key>Listeners</key> <dict> <key>Bonjour</key> <array> <string>ssh</string> <string>sftp-ssh</string> </array> <key>SockServiceName</key> <string>ssh</string> </dict> </dict> <key>StandardErrorPath</key> <string>/dev/null</string> <key>inetdCompatibility</key> <dict> <key>Wait</key> <false/> </dict> </dict> </plist>
Test SSH access
Return the drive to the AppleTV and start it up. Rather than start up normally it may bring up a menu asking if you want to do a restore. If this happens, run the diagnostics, this should be fine, and then select restart. Choosing restore will wipe out the work done in the previous steps.
Once it's started up, try and connect using ssh:
y@mac# ssh -1 frontrow@<appletv ip address>
the password is also frontrow
Preparing the AppleTV
The next few steps go through setting up a few things that make it easier to get Myth working on the AppleTV.
Mount drive as read/write
By default the OSBoot partition is read only. To mount it as read/write run the following (from http://www.engadget.com/2007/04/10/how-to-play-divx-and-xvid-on-your-apple-tv/):
root@appletv# mount -o remount,rw /dev/disk0s3 /
To make it mount read/write on boot in future:
root@appletv# touch /.readwrite
Install vi and su
Copy vim and su to the AppleTV:
y@mac# scp -1 /usr/bin/vim frontrow@<appletv ip address>:~ y@mac# scp -1 /usr/bin/su frontrow@<appletv ip address>:~
Then on the AppleTV:
root@appletv# mv ~/vim /usr/bin/ root@appletv# mv ~/su /usr/bin/ root@appletv# ln -s /usr/bin/vim /usr/bin/vi
Instructions are from http://wiki.awkwardtv.org/wiki/Watchdog
Disable ripstop (as root):
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
This will unload the watchdog on startup.
root@appletv# shutdown -r now
Fix the timezone
My AppleTV thought it was in Rome. If the timezone is wrong problems occur when scheduling recordings. To fix this add the following to /etc/rc.local (adjust as necessary for you location):
/bin/ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
Either run the file or reboot for this to take effect.
You will currently need a OS X Tiger (10.4) Intel machine to build the binaries for the AppleTV, as cross-compiling has not been sucessful yet. Build instructions are here: Building_MythTV_on_Mac_OS_X
Tar up MythFrontend and copy it to the AppleTV. This assumes that MythFrontend is installed in /Applications on your Mac:
y@mac# tar cf ~/MythFE.tar -C /Applications/ MythFrontend.app y@mac# scp -1 ~/MythFE.tar frontrow@<appletv ip address>:~
Untar MythFrontend on the AppleTV:
root@appletv# tar xf MythFE.tar -C /Applications/
Now that MythFrontend.app is on the AppleTV we can try running it.
This will probably fail, and an crash dump will be generated in ~/Library/Logs/CrashReporter/CrashReporter.log. It will probably mention something about fonts. When this happened to me the first time I wasn't sure what to do, but someone on the mythtv-dev list suggested checking the fonts and it turned out that there were (unsurprisingly) lots more fonts on the Macbook than on the AppleTV, so I decided to try copying all the fonts across. I used the following commands (there are 3 mains locations for font storage - I copied everything but this is probably not necessary).
On the Mac:
y@mac# tar cf SystemLibraryFonts.tar -C /System/Library/Fonts/ * y@mac# tar cf LibraryFonts.tar -C /Library/Fonts/ * y@mac# tar cf HomeLibraryFonts.tar -C ~/Library/Fonts/ *
y@mac# scp -1 SystemLibraryFonts.tar frontrow@<appletv ip address>:~ y@mac# scp -1 LibraryFonts.tar frontrow@<appletv ip address>:~ y@mac# scp -1 HomeLibraryFonts.tar frontrow@<appletv ip address>:~
On the AppleTV:
root@appletv# rm -fr /System/Library/Fonts/* root@appletv# rm -fr /Library/Fonts/* root@appletv# rm -fr ~/Library/Fonts/* (this may not exist, I can't remember. if not you'll need to create it)
root@appletv# tar xf SystemLibraryFonts.tar -C /System/Library/Fonts/ root@appletv# tar xf LibraryFonts.tar -C /Library/Fonts/ root@appletv# tar xf HomeLibraryFonts.tar -C ~/Library/Fonts/
Restart the AppleTV
root@appletv# shutdown -r now
When it comes back up it may go into safe/diagnostic mode. If it does this then select Run Diagnostics and then Restart. Don't select Restore as it will restore the whole OS from a backup partition and you'll have to start all over again. The next time it should start up normally.
Run MythFrontend again
Hopefully this time it will stay up and you won't get a crash report. You won't be able to see anything yet because the Finder (the AppleTV application) always makes itself the frontmost window. We'll sort that out in a bit. In another terminal try killing the Finder. Find the pid using:
frontrow@appletv# ps ax | grep Finder
and kill this process. You should briefly see MythFrontend before the Finder restarts. You may notice that it's asking for database connection parameters.
Quit MythFrontend (ctrl+C in the first session) and edit the database connection parameters file:
frontrow@appletv# vi ~/.mythtv/mysql.txt
adding the correct hostname, username and password (usually only the hostname needs changing).
Start MythFrontend again, check the output the ensure it starts correctly and try killing the Finder again. This time you should find that you see the main MythFrontend menu briefly before the Finder restarts.
Replace the Finder with MythFrontend
The following command updates the preferences for the loginwindow process so that it runs MythFrontend rather than Finder
root@appletv# defaults write /Library/Preferences/com.apple.loginwindow Finder /Applications/MythFrontend.app
if you need to undo this you can do
root@appletv# defaults delete /Library/Preferences/com.apple.loginwindow Finder
Restart the AppleTV again and you should find that MythFrontend starts rather than the AppleTV interface.
Another Option is to install the Apploader aka "Applications Menu plugin" and launch Mythfrontend from the menu (see: http://wiki.awkwardtv.org/wiki/MythTV)
The next step is to configure MythFrontend. It is possible but tedious to do this using the remote - an easier solution is to enable VNC using the instructions here http://wiki.awkwardtv.org/wiki/Enable_Remote_Desktop_(VNC), and install a VNC client such as Chicken of the VNC on your Mac. You can then use the mouse and keyboard to do the configuration.