Wednesday, April 2, 2008

AFP

Wednesday, April 2, 2008

AFP-

AFP
Some Patchstick-Instructions were replacing the Kerberos.framework file of the AppleTV. This is causing some problems. In particular, mount_afp fails with "Illegal instruction".

So be sure to have the following Directory-Structure on your ATV:

Code: Select all
/System/Library/Frameworks/
/System/Library/Frameworks/Kerberos.framework/
/System/Library/Frameworks/Kerberos.framework/Versions/
/System/Library/Frameworks/Kerberos.framework/Versions/A/
/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos

/System/Library/Frameworks/OSXFrames/
/System/Library/Frameworks/OSXFrames/Kerberos.framework/
/System/Library/Frameworks/OSXFrames/Kerberos.framework/Kerberos
/System/Library/Frameworks/OSXFrames/Kerberos.framework/Resources/
/System/Library/Frameworks/OSXFrames/Kerberos.framework/Versions/


1st Kerberos is 40408 / md5 5a2805de06aea5a4b52be9fbd95c65e6
2nd Kerberos is 2322540 / md5 e110e4e8c1d6ea881ced60c996836487


Check also the /usr/libexec/sshd-keygen-wrapper. The wrapper should contain the following line at the end:

Code: Select all
DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec /usr/sbin/sshd $@



...if not, run:

Code: Select all
sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' /usr/libexec/sshd-keygen-wrapper


This works on my ATV just perfect and I can mount the Time Capsule HD through AFP! Of course SSH v1 and v2 works too 8)

Cheers

========================================================

Ok, finally got afp working according to the instructions in this post.

viewtopic.php?f=2&t=1338&st=0&sk=t&sd=a&start=20#p8283

To summarize these are the steps I took to solve the "illegal operation" error.

Please note that you are working with two different versions of Kerberos.framework, one from the MacOSX update package, and the other from the AppleTV restore partition. These are not interchangeable and are the cause of all the "illegal operation" errors

1) Copy /System/Library/Frameworks/Kerberos.framework from the MacOSXCombo10.4.8Intel.pkg to your AppleTV home directory. (10.4.9 would probably work as well, but I haven't tried it)

2) create the /System/Library/Frameworks/OSXFrames directory
Code: Select all
sudo mount -uw /
sudo mkdir /System/Library/Frameworks/OSXFrames

3) Copy Kerberos.framework from your AppleTV home directory to the OSXFrames directory
Code: Select all
sudo cp -pr ~/Kerberos.framework /System/Library/Frameworks/OSXFrames/

3) On the AppleTV run the sed command.
Code: Select all
sudo sed -i"" -e 's;^exec;DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec;' /usr/libexec/sshd-keygen-wrapper

4) mount the recovery partition
Code: Select all
cd ~
sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m
sudo hdiutil mount recovery.dmg
sudo hdiutil mount /Volumes/Recovery/OS.dmg

5) copy the Kerberos.framework from your recovery image to the proper directory (Note: I have a 1.0 recovery partition, a 1.1 may not work)
Code: Select all
sudo cp -pr /Volumes/OSBoot\ 1/System/Library/Frameworks/Kerberos.framework /System/Library/Frameworks/

at this point I lost my ssh connection, you may have to log back in using sshV1 (ssh -1 frontrow@appletv.local). Thank-you sugarola.

6) repair permissions
Code: Select all
sudo /usr/sbin/diskutil repairPermissions /

7) Mount the shared drive
Code: Select all
mount_afp afp://username:password@myMac.local/SharedDrive ~/MountPoint


You should now have both ssh2 and working afp.

Once again I would like to thank everyone on this board for helping out.

===============================================================

@jayfehr

Nice tutorial :mrgreen:

But you should add something (above 4.) If you don't run "afpinstall.sh" the file recovery.dmg is missing. You can obtain the file running:

Code: Select all
sudo mount -uw /
cd ~
sudo dd if=/dev/disk0s2 of=recovery.dmg bs=1m


Cheers
================================================================
@The stig

One other thing I had not mentioned in the tutorial was that when installing afp I did NOT use the afpinstall.sh script, I used the manual install process from the Take 2 Full Update wiki (http://wiki.awkwardtv.org/wiki/Take_2_Full_Update) This method copies over many, many more files then the script, some of which may be relevant. Also these may only work on a 1.0 AppleTV, if you are running a different version these instructions may not help. Also after running the manual process be sure to run:
Code: Select all
sudo /usr/sbin/diskutil repairPermissions /

As mentioned in one of the comments below the manual instructions (those comments do not include the "sudo" or final "/" which are very important

Anyway here is the info you asked for:

From the MacOSXUpdCombo10.4.8Intel (now installed in the OSXFrames dir on the AppleTV)
-rwxr-xr-x 1 frontrow frontrow 2322540 Sep 8 2006 /System/Library/Frameworks/OSXFrames/Kerberos.framework/Versions/A/Kerberos
MD5 (/System/Library/Frameworks/OSXFrames/Kerberos.framework/Versions/A/Kerberos) = 2b7df04894c3dca1704c095bf3f3e1fc

From the AppleTV Restore partition (now installed in the Frameworks dir on AppleTV)
-rwxr-xr-x 1 frontrow frontrow 40408 Mar 14 2007 /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos
MD5 (/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos) = d1da821aab78143be38f9a58471cc99c

No comments: