OS X Lion Time Machine backup to Debian

When OS X Lion was released I was eager to try out the updated FileVault and Time Machine features. Moving from an encrypted home directory to true full-disk encryption was a dream. I was also quite excited to find out if the new implementation of FileVault would work well with Time Machine.

I’d previously set up a Time Machine volume on my Debian file-server by installing netatalk and avahi.

Unfortunately, it seems OS 10.7 (Lion) requires netatalk 2.2, which is currently in beta. However, it’s quite simple to install the beta version of the package and it seems to run just fine.

To install netatalk 2.2~beta4-1 you’ll need to add the following line to your /etc/apt/sources.list file:

deb http://debian.oregonstate.edu/debian sid main

You can also use any of the mirrors listed here if they’re closer.

Then run the following commands to install or upgrade netatalk:

$ sudo apt-get update
$ sudo apt-get install netatalk

If you had a previous install of netatalk it may detect changes to your local configuration files. By default the installer will keep the local copies of your files. This behavior is fine in this case.

After the install has finished run $ dpkg -s netatalk | grep -i version to ensure it was successful.

The netatalk service will be restarted by the installer after it completes. You may need to give it a few seconds to spin back up before trying to connect to it.

Your Time Machine backups in OS X Lion should now work correctly!

At this point you may want to comment out or remove the line you added to /etc/apt/sources.list so that you don’t inadvertently upgrade other packages to an unstable branch. After removing the line simply run $ sudo apt-get update one more time.

Update: Found the official Netatalk documentation.

Update 2: Here is the contents of both my afpd.conf and AppleVolumes.default files.

Update 3: Unfortunately, I can’t really provide support for any issues you might have with this. However, please keep your comments coming if you think they’ll be useful for other users attempting to get this working for themselves.

48 thoughts on “OS X Lion Time Machine backup to Debian

  1. Thanks for the instructions. I was able to successfully upgrade netatalk to 2.2 beta4-1, but Lion still gives me the same error “The network backup disk does not support the required AFP features.” Any idea what else I might need to check?

  2. Unfortunately, this didn’t work with the Lion GM or the released version. I could mount the shares I need, but whenever I tried to run Time Machine I get the following error:

    \The network backup disk does not support the required AFP features.\

    What I ended up having to do was add \options:tm\ to the Time Machine share line in AppleVolumes.default *and* deleting /etc/avahi/services/afpd.service, since Netatalk 2.2 now advertises itself.

    • Thanks. Deleting deleting /etc/avahi/services/afpd.service worked for me. I had Yum’ed Netatalk 2.2, and the older recipes for setting up afpd were apparently written prior to this change.

  3. Thank you. It worked a treat on my Ubuntu server. Presumably a full stable release of netatalk 2.2 will be available soon.

  4. Hi,

    I am using Ubuntu 10.4 and I have done what you explain and now the time machine backups work as before installing Lion on my mbp ;)

    The only thing is to remove the /etc/avahi/services/afpd.service file so the afpd is announced by netatalk directly.

    I have 2 disks exported that keep working fine and a backup disk that is displayed in the mbp as a time capsule.

    Thanks a lot for the instructions.

    Best regards.

    • Thanks for the tip Javier! I’ll try shutting down avahi and see if my AFP mounts still work without it. If so, I’ll probably just uninstall that service.

      • I tried temporarily stopping the avahi-daemon service and my server disappeared from finder on my Mac. I guess I might need to configure the AppleTalk support in netatalk? I just restarted avahi for now.

    • Terrible news! The open source community needs to step up their game. Although I can understand how hard it must be with a fairly obscure package like netatalk.

  5. Thank you for this walkthrough, Tristan! I’d like to note that this works just fine on my Ubuntu 11.04 (64 bit) server.

    I had tried doing this same sorta process a few years ago, and while at first I was able to get time machine to back up to my Ubuntu server, after a few days or weeks, all of a sudden Time Machine would complain that the backup disk was messed up or something. I recently decided to try it again, and found a note that this can happen if the Mac goes to sleep while backing up. The recommendation was to not back up while on battery power (I already have my MBP set to never sleep when powered from the wall). Hopefully this will prevent that from happening!

    Thanks again.

  6. I followed your instructions and was able to back up OS X Lion to my server, however when i click on Enter TimeMachine to browse it i sometimes see the following:
    1) The operation can’t be completed. An unexpected error occurred (error code -6584).
    2) Connecting to server window comes up however it does not go into timemachine, literally nothing happens at all.

    • Hey Andre, I’m not familiar with that error. Did you previously have a working Time Machine server configured on your Debian server?

      • Tristan,

        Yes, it was backing up perfectly prior to Lion. I think my problem was that i was moving around the sparsebundle file and the name of my freshly installed machine with Lion on it was the same when Snow Leopard was on it. Not sure if that had anything to do with it which may have corrupted the file. Ultimately i reinstalled Lion and reverted my pool since as i’m using zfs and currently i’m in the process of transferring the users from the backed up timemachine sparsebundle.

  7. Hi,

    Once I install netatalk 2.2, from TimeMachine I get the following error:
    “The server may not exist or it is unavailable”
    If I go back to netatalk 2.1, I get the original “AFP features not supported error”

    Will be really glad if you could help.

    • Are you running Netatalk on a Debian or Ubuntu server? If you type sudo service netatalk status on your box what is the output? If the service is running and your Mac can see the server, I would imagine something is funky with your timemachine mount. It’s possible the permissions are messed up.

      • I am using ubuntu 11.04. Its working now. I tried the suggestion in the comments, to shut down avahi and it worked.

        So I went to the logs to find out the reason, and apparently it is because there is a Name Collision.

        afpd[9598]: Failed to add service: Local name collision

        Thanks for your help bud.

  8. It works! I think the crucial step for me involved the removal of the avahi afpd.service (but, for some reason, stopping avahi made the server disappear from Finder!)

    Before that I had compiled and installed 2.2b4 from source but I was still getting the missing AFP features error, annoyingly. I reinstalled as you wrote (from debian this time) and let the installer replace all my config files and then removed afpd.service and it appears to be working :)

    Thanks for the post. I was at a loss before I found it!

  9. It works also for me : Thanks!

    Short 10 step Summary about my steps
    0) Comming from 2.6.38-8-server (ubuntu)
    1) Follow this instruction earlier (with SL on my MBP) : http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/
    2) Add “deb http://debian.oregonstate.edu/debian sid main” to /etc/apt/sources.list
    3) $ sudo apt-get update
    4) $ sudo apt-get install netatalk
    5) dpkg -s netatalk | grep -i version
    6) remove “deb http://debian.oregonstate.edu/debian sid main” to /etc/apt/sources.list
    7) sudo apt-get update
    8) The install script asked me what to do with the “/etc/netatalk/afpd.conf” and “AppleVolumes.default” files. I let the script go. It saves my previous versions to “.dptg-old”. I moved them back to be active without chaining anything within them.
    9) Change “options:upriv” (coming from step 1) to “options:tm” *Important:without it does not work!
    10) deleting /etc/avahi/services/afpd.service (I renamed it)


  10. Pingback: How to build an 8 TB RAID5 encrypted time capsule for 500 Euros « funky code

  11. Great information here but can you tell me if I can update to the 2.2 N/talk whilst I am still on Ubuntu 8.04 LTS. I need it to get my Time Machine backing up as normal prior to Lion. Currently using 2.0.3

    I have as follows…..
    System hostname Media-Server.com
    Operating system Ubuntu Linux 8.04.2
    Webmin version 1.560
    Kernel and CPU Linux 2.6.24-29-server on x86_64
    Processor information Intel(R) Xeon(R) CPU 3065 @ 2.33GHz, 2 cores

    Appreciate your thoughts,
    Michael in Manchester UK

    • Hey Michael, I can’t comment on the exact requirements of Netatalk 2.2, but when you apt-get install the new version it should install and/or upgrade any required dependencies as well. After adding the new source you can run apt-get show netatalk and it should give you information on the new version and its requirements.

  12. Hi Tristan and All,

    Tristan thanks you very much. I’ve followed a few site to get this far and yours has been the most useful thus far for Lion.
    I have followed you instructions above and blended it with some others.

    I have the contents of my /etc/netatalk/AppleVolumes.default looking like below, though i have tried a few different configurations:

    # By default all users have access to their home directories.
    ~/ “Home Directory”
    “/media/Iomega HDD/TimeMachine” TimeMachine cnidscheme:dbd options:usedots,tm

    and i have placed a sparse bundle on the drive using script (makeImage.sh) I found on another site http://www.insanelymac.com/forum/index.php?showtopic=184462

    I’ve added the Avahi daemon from the site http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/

    and this has allowed my mac to think it can backup to the disk. However it seems there is nothing being copied to the TimeMachine folder. Total size is about 5.7Mb. Also it seems my machine cannot enter time machine.

    Any help would be much appreciated.


  13. Hey tristan,

    thank you so much for your tutorial. It works now really fine and now I can save my data again on the normal way!

    thx mate

  14. Hey, I was wondering is there a source for 2.2.1 yet? I just followed this guide, and I am already out of date (:, so I was wondering what you did. TM is working great now after fiddling with it for hours, so I was just wondering how to get the latest version. I tried compiling from the tarball on their website, but I get some array errors on the ldap.c file, so are there any apt sources I can use to get 2.2.1?

  15. I’ve tried this a bunch of times, and can’t make it work on my Ubuntu 11.10 server. However, it works perfectly on my Ubuntu 11.10 workstation.

    When I try to connect to the server, I get \The version of the server you are trying to connect to is not supported…\

    So, if someone knows of a difference between the server and workstation configuration, I would appreciate their insight. If not, I would appreciate some help in completely removing the setup from my server (including config files) so I can start over.

    Thanks in advance.

    • Grim2, I’m getting the exact same problem, however i’m still on 10.04 ubuntu server.

  16. Pingback: Updating to netatalk 2.2 - to support Lion clients (for those wanting to run AFP Server on ATV) ? « Stm Labs Forums

  17. Pingback: Two apples in a pod and those other guys » Blog Archive » Debian AFP server for OS X Lion

  18. this worked great until I allowed 11.10 desktop update to run, now I am getting the server does not exist or is not available error. I installed 2.2.1 and it did not change the behavior. I am still using my old config files that worked with 2.2b4, is a syntax change involved? same whether avahi is on or off. shows in sidebar fine with avahi running. :-( any ideas?

  19. Pingback: How do I back up a bunch of OS X machines via TimeMachine without buying a bunch of Time Capsules? - Admins Goodies

  20. Directions worked perfectly, and, for this particular problem, finding one set that does is near impossible. :) One additional step I had to take was `apt-get upgrade libgcrypt*`, as the version that was installed was not new enough and I was getting authentication errors from Time Machine and in `/var/log/syslog`.

    • Glad it worked for you John! Just a note for others, you should probably use apt-get install libgcrypt to upgrade that specific package. apt-get upgrade is designed to upgrade *all* packages on your system.

  21. Hi, this is a great article, thanks for posting it! I have a Linux box and am thinking of setting it up, per your suggestions, as a Time Machine server, for a few Macs we have in the SoHo. We now are running Lion 10.7.3 with Filevault 2 on our Macs. We also have a new Time Capsule but Time Machine in Lion does not yet support encrypting Time Machine backups to Time Capsules (if the source is a FileVault 2 disc). Sigh. So I’m wondering if by using a Linux box instead (with your suggestions of installing netatalk 2.2.2 and avahi) would allow for end-to-end encrypted Time Machine with FileVault2? Cheers!

    • Hey there, unfortunately the Time Machine backups are *not* encrypted. Since Filevault2 seamlessly encrypts/decrypts your data, that encryption layer is essentially transparent to all the applications running on your system. Time Machine essentially has no idea it’s backing up an encrypted volume. Since it’s backing up the decrypted data, your backups are definitely at risk!

      For me, this is not such a big deal. However, there are ways you can also encrypt your backup volume. Essentially it involves creating an encrypted volume on your Linux box, mounting that volume in OS X and finally configuring Time Machine to back up to that volume. The idea is that once you unmount the backup volume, it is encrypted and requires a password to remount and decrypt.

      I can’t provide you instructions for doing that here, but if you search Google for encrypted time machine backup you’ll find a lot of resources.

  22. Hi!

    This is a great guide, thank you very much for publishing. I have a Debian Squeezee server, that acts as a Time Machine server (thanks to your instructions :) and it works great! But I need to store several Mac’s backups on it. Would it be a problem? I’m quessing that I should create dedicated TM shares for each computers and limit the size of a share, right? Because If everybody will backup to the same share, that can cause storage problems. And also people can see the other backups to when using one share only, which I don’t want.

    What do you think?

    Thanks again!


  23. This worked for me quickly on Squeeze, setting up a dockstar with debian and netatalk.

  24. Hey Tristan

    Thanks for the write up. With your config I can only log in as guest, not a normal user. Any ideas?


  25. Hi what am I doing wrong?

    i have done the same thing and trying to get it working on my Debian Squeeze Raspberry Pi but although i can see the disk in TM, when I select it, it wants a username and password but wont accept the ones i use to log into the pi (pi, raspberry)

    Any ideas??

  26. Pingback: Ubuntu 11.10 network shares to Os X lion with netatalk | devNoo

Comments are closed.