Monday, August 27, 2012

Lion Time Machine on Debian

After an upgrade to Lion (Mac OS X 10.7) Time Machine didn't work anymore.
It had been configured to store the Time Machine files on a Debian file server, using samba. But from Lion on, AFP 3 is required by Time Machine.

Solution : install netatalk on the Debian server.
According to a blogpost, at least version of netatalk 2.2.0 is required. The version of the available Debian package is older (2.1.2), so this means compiling from source code.

Use netatalk 2.2.3, get it here, copy it your server and extract :

$ tar -jxpvf netatalk-2.2.3.tar.bz2
$ cd netatalk-2.2.3

To enable DHX2 authentication (which is required), Debian packages libgcrypt11 and libgcrypt11-dev need to be installed. The libgcrypt11-dev package is required otherwise the library will not be detected by the configure script and the DHX2 (UAMS) module will not be compiled in.

$ sudo apt-get install libgcrypt11 libgcrypt11-dev

Default settings would put netatalk in /usr/local/*, so use the settings below to put the files in /usr/bin/, /usr/sbin/, and /etc/

$ ./configure --enable-debian --prefix=/usr --sysconfdir=/etc
$ make
$ sudo make install

Check if installation was successful by running

$ afpd -v

It should show netatalk-2.2.3 on the first line.

Here you can find more information about the config files, but to make the Time Machine work add this line to the end of file /etc/netatalk/AppleVolumes.default

~/timemachine "TimeMachine" options:upriv,usedots,tm

This makes folder timemachine in the homedir of the user (which you need to create) available on AFP as volume TimeMachine.
Note that option tm needs to be added to support Time Machine on this volume.

When all is set, netatalk can be started and your Mac should be able to use volume TimeMachine for backups :

$ sudo /etc/init.d/netatalk start
 
On your Mac, you will have to execute this instruction in a terminal window to make it recognise the afp share as a timemachine :

Defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 

Update (12Nov2012) : added section about allowing linux timemachine volumes on a Mac