Thursday, June 28, 2007

AppleTV: Recovering From the YouTube Update

On June 20th, Apple released what is now referred to as "the YouTube Patch". Being an AppleTV owner, I thought "hey - cool" and, on the evening of the 20th, told my AppleTV to run the update.

For your average user, this probably would have been the end of the story. It gets more complicated for me because I've hacked my AppleTV.

I did have the presence of mind to scp all the files from my "OSBoot" partition to my PowerMac G5 before doing the update. I, regrettably, did not have the forethought to check with the fantastic community over at AwkwardTV though. Had I done so, I probably would have held off on doing the update so immediately and ultimately used the "Safe Update" directions they churned out impressively quickly.

So, in my haste, I wound up having to spend some time getting things back in place (getting my AppleTV "re-hacked"), and, should anyone else find themselves in the same predicament, I thought I'd share what I did.

First - let me give some explanation as to what the update did compared to what I expected it would do.

With some familiarity with the various components ("plugins"; those *.frappliance directories that live in the /System/Library/CoreServices/Finder.app/Contents/PlugIns/ directory on your AppleTV), I figured the way Apple would enable YouTube-functionality was to simply beam a new "YouTube.frappliance" into my AppleTV's Finder.app/Contents/PlugIns directory and restart. Painless and clean. And not at all how they did it.

Apparently, Apple had bigger plans for their update. Their update process downloaded a 179MB .dmg disk image ("2Z694-5248-45.dmg" -- see the AwkwardTV wiki for more info). Then it becomes a little fuzzy as to what happened. Initially I thought it just over wrote the existing "OSBOOT" partition with this disk image. On closer inspection it doesn't seem to be quite that simple. Although a lot of files were replaced / removed, and a couple added, some files I had created on the AppleTV did not get blown away, including my ~frontrow/.ssh directory and a /etc/rc.local script I wrote (among perhaps others).

But, that "a lot of files were replaced / removed" part did present a problem.

Of most significant consequence, sshd got deleted. And the things I added to Finder.app/Contents/PlugIns/ had also been removed (and, some other changes would have made them no longer be loaded had the plug-ins I put in that directory not been removed).

So, step one of fixing things as the same as step one when I initially hacked my AppleTV: open up the AppleTV and copy over sshd. That all went smoothly, although the repeated "opening ups" of my AppleTV are taking a toll on the sticky-ness of the adhesive that keeps the rubber foot nice and secure on the bottom of the AppleTV.)

Following that, I was able to boot with sshd enabled and install Perian just like before as well. Where I ran into trouble though was mounting my media library from a remote server.

Previously I simply used mount_afp. Following the update, the mount_afp binary had been deleted though. I tried copying the binary from the backup I made before the update. Still - no dice. As noted on the AwkwardTV wiki, I can confirm it seems kernel support that mount_afp relies on is gone, and trying to run it on an updated AppleTV just gives errors.

I decided to change my approach and use SMB instead of APF. The mount_smbfs binary had been deleted along with mount_afp, but fortunately Sharity Light, an open source SMB implementation that runs in user space (rather than at kernel level) exists - and the AwkwardTV wiki, in usual form, had great directions on how to get it set up. (As an added geek bonus, you can "download" the compiled binary by copying the text of the binary having been base64 encoded. Good times.)

At this point, I needed to log in to my PowerMac G4, on which my media library resides, and enable SMB, or as it's called in the "Sharing" preference pane in "System Preferences", "Windows Sharing". At least - that's what I thought I needed to do. Doing that winds up only sharing user directories. My media library is on it's own separate drive in the G4, so using the built in "Windows Sharing" didn't get me what I needed.

Enter SharePoints. It's a slick little application that lets you define your own, well, share points for SMB on OS X. Install it on the G4, configure it ... finally, I can mount my media library on the AppleTV again.

And now we've finally reached the final step - installing the ATVFiles plugin. Similar steps compared to how I did it initially, although it's important to get the new version of the plug-in (the old version apparently doesn't work after the update).

Screenshot of my AppleTV, after being 're-hacked'

Wahoo! I can get to my media library from my couch again. :)

2 comments:

Me said...

Hi! Thanks for the write-up.
I have also upgraded to 1.1 and lost the hack. You mentioned that sshd is goine, so it seems that I no longer use patchstick to regain control of the ATV?

kazoolist said...

David,

Glad to provide the write-up. Thanks for reading it. :)

Although I haven't used the Patchstick approach myself, a non-hacked "1.0" AppleTV actually also lacks SSH so I believe you should be able to use the Patchstick approach to "recover" (maybe "restore" is better phrasing) from the "1.1" ("YouTube") Update as well.

I did read somewhere that following the 1.1 update the USB support on the AppleTV was further reduced, which could potentially interfere with being able to boot from a Patchstick, but I can't say if that's certain or just a rumor.

I've always just gone with the "open it up" approach because I don't have an Intel Mac to get the various drivers and such from to put together a Patchstick. I can (obviously) confirm that approach worked just fine to recover from the 1.1 update.

Happy hacking!