Ubuntu 19.10 (and 20.04): Setting Up Time Machine

Setting up an Ubuntu machine to act as an Apple Time Machine server is surprisingly simple. This example uses a directory on the boot drive (/srv/netatalk/time-machine), but it’s more likely that you want to use a directory on a large disk.
Here are the steps…

Install the needed packages:

sudo apt install netatalk avahi-daemon

Edit the netatalk config file:

sudo vi /etc/netatalk/afp.conf

Add a section for your Time Machine:

[Time Machine]
  path = /srv/netatalk/time-machine
  time machine = yes

Create a directory to act as the Time Machine drive:

sudo mkdir -p /srv/netatalk/time-machine
sudo chown nobody:nogroup /srv/netatalk/time-machine
sudo chmod 777 /srv/netatalk/time-machine

Restart netatalk:

sudo service netatalk restart

Now, on your Mac, you should be able to open the Time Machine settings in System Preferences and use Select Disk… to pick your new Time Machine backup drive.

Update for Ubuntu 20.04 and other notes

Since I first wrote this, I have updated to Ubuntu 20.04 and everything still seems to work. However, I never made it clear that you must make sure your backup drive is available and connected on your Mac before you can use it as a Time Machine backup drive.

Once your drive is set up under Ubuntu, go to your Mac and open a Finder window. Under the Network section in the sidebar, you should see your Ubuntu machine listed. Double-click on the machine name, and you should see any shared folders on the machine. You may have to click on the Connect button in the upper right of the window to login before you can use the drive.

Once you are logged in, you should then be able to use the drive with Time Machine.

47 Replies to “Ubuntu 19.10 (and 20.04): Setting Up Time Machine”

  1. Nice and simple to follow. If you are doing this on a server, how to give each user its own directory that is protected from others?

  2. A related question that you can maybe help with (I will continue researching on my own as well!) — my new computer is running xubuntu (first time on linux), and my old computer was a mac with backups all done through time machine. When I plug the backup drive into new computer, it doesn’t recognize the folders as folders, and can’t find the stuff. Any advice for how to access those backups? Thanks!

    1. Time Machine uses a proprietary backup storage format (sparse bundle) that generally cannot be accessed as normal files. From what I’ve read, it is technically possible to read TM backups on a unix system, but that’s outside the scope of this post. Maybe something for a new post, if I can figure it out…

  3. Has anyone tried this on the latest Ubuntu 20.04?

    Everything installed fine, not seeing errors, the status shows active, redacted.local name resolving fine. But Mac’s Time machine can’t see it.

    Any ideas on troubleshooting would be great.

    Thanks

    1. I have tried it, and it doesn’t seem to work, indeed. Seems broken for now, and can’t really figure out why… Did you find a fix yet?

    2. Hi Mike.
      “By default Mac OS doesn’t show “unsupported” or non-Apple Time Machine network drives, but you can easily change that with one Terminal command:

      defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

      If everything went well after all this, you should now be able to choose your server in the Time Machine preferences when selecting a disk.”

      I have time machine working with this in mojave.
      Copy&Paste from:
      https://samuelhewitt.com/blog/2015-09-12-debian-linux-server-mac-os-time-machine-backups-how-to

    3. I sure wish I read this page and your comment on May 10th. There’s not much of it that works after having upgraded from 16.04 to 18.04 and then to 20.04 to try it. What a mess. I have no idea what’s changed between then and now or if the upgrade is what’s caused all the pain.

  4. Does not work on Ubuntu 20.04. Won’t allow vi or gedit to change the config file. Says GVfs metadata is not supported. Can’t go any further.

    1. I’ve made an update to the post, since I’ve now upgraded to Ubuntu 20.04, and added some notes about making sure the drive is mounted on the Mac. Hopefully some of this helps!

  5. Hey Dana,
    I’ve got a problem with the changes to the afp.conf file?
    The secondary HD on my Ubuntu 20.04 is where I want the TM to backup.
    How do I add the location of this drive in the afp.conf file? My drive is dev/sdb1/Files HD 1tb.
    Do I add path = dev/sdb1/Files HD 1tb
    Time Machine = yes
    ?

    1. Hi Jim, is the drive mounted? You would specify the mount point in afp.conf, not the device. For example, if your backup drive (/dev/sdb1) was mounted on /backup and you had a directory on that drive where you want to store the Time Machine (perhaps /backup/netatalk/time-machine), then you would specify

      path = /backup/netatalk/time-machine

      in your afp.conf file.

  6. Hi Dana,
    I gave up trying, nothing would work. I just restored the computer to Ubuntu 14.04. I had a backup of it (I use Image for Linux program). On the Ubuntu 14 setup, I had had Time Machine backups setup and working fine. Now TM backs up to this Ubuntu 14 computer again. I don’t know why it wouldn’t work in Ubuntu 20? I had setup TM on Ubuntu 14 back a few years ago, and don’t remember what online guide I followed? Don’t get me wrong, I would love to be using Ubuntu 20, but I really need TM backups to work on it. Thanks for the help, I thought your guide was straight forward, I just couldn’t get it to work.

    1. Sorry to hear that, Jim, it sounds frustrating. I don’t know of any issues with this procedure and Ubuntu 19.10 or 20.04, but there are a lot of variables involved. Good luck, let me know if you decide to upgrade again and have any luck!

  7. I also can’t get it working, even on a fresh 20.04 installation. Symptoms similar to Mike’s – I see the server via AFP, but on the Mac I cannot connect (with or without a password) and on Mint Linux I can connect but just see a blank window instead of shared volumes/folders. Can’t check Samba version ‘cos Samba isn’t installed, but in previous attempts I DID have Samba installed (and ran into different problems…) – trying to access via both a Macbook Pro and iMac, both on Catalina.

  8. Thanks for taking the time to get back to me, Dana. I don’t think it has anything to do with DNS as I’m able to see the server easily enough, whether I use servername.local or the IP address. I suspect I’m not performing a necessary step when it comes to permissions or something, as it’s the share which isn’t showing up.
    Regardless, for now I’m going to use OpenMediaVault as an interim solution and am planning to buy a used Mac Mini. Will come back to the Ubuntu strategy if I can’t get either of those to play nicely with the other function I want the server to perform.

  9. Thanks for the excellent and straightforward guide. I wanted to share my experience with a recent upgrade, just in case anyone else runs into the same problem.

    I’ve just upgraded from ubuntu 18 to 20.04 and netatalk failed to start. It was complaining that it couldn’t find libmysqlclient.so.20.

    Ubuntu 20.04 only comes with libmysqlclient.so.21. There isn’t a libmysqlclient20 package available.

    After trying several different things, I ended up with the following solution:
    – Downloaded the generic linux MySQL 5.7.30 installation tarball from downloads.mysql.com
    – Extracted only the libmysqlclient.so.20.3.17 file
    – Copied that into /usr/lib/x86_64-linux-gnu directory
    – Linked it to libmysqlclient.so.20 (sudo ln -s libmysqlclient.so.20.3.17 libmysqlclient.so.20)

    netatalk starts and functions now!

  10. sudo chmod 777 /srv/netatalk/time-machine

    This enabled everyone on the system to read/write to your backups. Not a good idea.

    1. Hi Thomas, you are correct, that would be a risk if your machine was shared or open to the public in some way, in which case you should tighten up security. The example here is mainly for those who are running a local Time Machine backup server.

  11. Problem > MacOS: Recovery Modus > Time Machine

    Logfile: OSInstaller[262]: Mounting url ‘afp://appletalk.local./Time%20Machine’

    My Servername: appletalk
    Problem: “**lokal.**” ist not a qualified name, no connet server.

  12. For all that are having issues with Macs not seeing your Time Machine drive, you’ll need to tell your Mac to use unsupported Network Volumes…There is no need to share and connect to the volume directly. To have you new Time Machine drive show up, try setting this property on your Mac by opening a console and typing…

    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

  13. Dana,

    Great guide and easy to follow! I having trouble with the username and pass. I running this in LXC on Proxmox with 20.04, but can’t figure out what the username and password I should use. Thanks in advance.

    -Aaron

    1. Hey Aaron, thanks! The username/password would be your user on the linux box. That user will have to have permission to access the path you’ve configured in afp.conf.

  14. Another trap for young players…. if you’re using ufw you might need to open port 548.
    I did it from my network only.
    sudo ufw allow from 192.168.1.0/24 to any port 548

  15. I can see the Ubuntu computer running net app, both in Finder > Network and in System Preferences > Time Machine > Select Disk… However, when I click connect in System Preferences, I get “Time Machine can’t connect to the backup disk. There was an error authentication with the provided username or password.” When I click connect through Finder, I get “Connection Failed.” It looks like the session is authenticating just fine in auth.log, but then something else failed:
    https://paste.ubuntu.com/p/KsrwBH3K97/

    Any ideas? Oh, I should mention that I did a distro-upgrade from 18.04 to 20.04 just so I could try these instructions. I wonder if that is mucking something up. =/

  16. This looks great, and not very technical but good at following instructions i have tried the above but i get the error, i can’t see any shares and the connection failed. Any suggestions? I even tried Henrique comment afterward and no luck. I am on Ubuntu 20

Leave a Reply to Linux Revolution Cancel reply

Your email address will not be published. Required fields are marked *