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

4 comments:

Alexandru Luputi said...

Hello!

I completed your tutorial and the share works fine. I can access is through afp:// but I can't make Time Machine see it.

I'm using Mac OS 10.7.4 and Debian 6.0, as a virtual machine in OpenVZ.

Any help would be appreciated!

Dieter Adriaenssens said...

You might have to execute this instruction in a terminal window: Defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

What worked for me : make a connection to the time machine share through afp;// and then open the Time Machine configuration and open the select drive dialog. In my case, the Time Machine share became visible.

I didn't write about setting up the Bonjour service, because I'm not using it in my setup, but if not correctly setup your Mac might not autodiscover your server and it's shares.

More info on setup in this blog post : http://www.ubuntugeek.com/getting-timemachine-to-work-under-ubuntu-10-04-lts-os-x-lion.html

Bastian said...

Hi, this seems designed to work on a local network. Any idea if it would work over the internet, on a remote server?

Dieter Adriaenssens said...

I don't see why it wouldn't work on a remote server. You only have to make sure that traffic between the client (your Mac) and the remote server is allowed on TCP port 548.