Getting Netatalk to Play Nice With OS X 10.7 Lion

I recently upgraded to OS X Lion and, although over all I like the changes, I found one annoying issue – my NAS, which held my TimeMachine backups, no longer worked with TM! The reason, it turns out, is that TimeMachine now expects support for Lock Stealing, which Netatalk only started supporting in the 2.2 release (which is still in beta as of this post time).

The solution is to install the beta, but it may need some config changes to work properly. Here’s how to do it in Ubuntu:
1. Open a terminal shell.
2. You need to find what architecture you have to determine what build you need. You can get the CPU info by typing:

less /proc/cpuinfo

I’ll assume you’re using the Intel i386 build. If not, you’ll have to change the target that you download.
3. In the terminal type

wget https://launchpad.net/~stefanor/+archive/ppa/+build/2455196/+files/netatalk_2.2~beta4-0~ppa1_i386.deb

Assuming, as mentioned, that you want the i386 build. If not, go to launchpad.net and search for netatalk to find the proper package
4. In the terminal window type:

sudo dpkg -i netatalk_2.2~beta4-0~ppa1_i386.deb

When prompted enter your password.
5. When prompted, enter N to keep your existing config files. Otherwise you’ll have to set your shares up again.
6. Reboot the server.
7. Reboot the Mac. OS X Lion apparently caches the settings for connected servers and may report that it still doesn’t support the necessary “lock stealing” protocol. Rebooting resets the cache

POTENTIAL ISSUES
a) If you get an error on connection reporting “Something wrong with the volume’s CNID DB, using temporary CNID DB instead.Check server messages for details!” check your AppleVolumes.default file (locate which one is being used by running sudo afpd -V). In particular make sure the cnidscheme is set to dbd.

b) If you still get the error edit AppleVolumes.default and make sure that you have tm in the options list for your TimeMachine backup mount point, ie:
/mnt/Terry TerryTM allow:terrytm cnidscheme:dbd options:usedots,upriv,tm

Edit your /etc/netatalk/afpd.conf to have the following default options:
– -udp -noddp -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword

c) If you tried doing a backup prior to these changes make sure the disk isn’t still mounted & hidden by opening Terminal on OS X and typing:
ls /Volumes
If you see the backup disk listed there you can unmount with
sudo diskutil unmountDisk /Volumes/WHATEVERTHEDISKISCALLED

d) Make sure you don’t have a share set up that overrides the defaults for your timemachine backup, eg. if you have a user account with the home directory set to the timemachine backup directory and also have a AppleVolumes.default general user entry that precedes your backup entry and doesn’t include tm in the options then it will supercede your preferred settings and won’t work. (Ask me how I know…)

Kudos to trollop.org’s excellent guide which helped with the config.

UPDATE

Netatalk 2.2.0 has been released, but no binaries are available yet for Ubuntu. ¬†So I built one for i386 architecture. ¬†Hopefully it’ll help someone out. Install with

 sudo dpkg -i netatalk_2.2.0-1_i386.deb

Another thing I’ve noted with this setup is that you no longer seem to need to create a sparsebundle to export. Sweet!
netatalk 2.2