Time Machine Backup with Ubuntu 15.x and OSX 10.7+

In the Older versions of this how-to, you will see people use the method shown just below.  Obviously that no longer works.  I will walk you through setting up TimeMachine via AFP over your LAN.  This is using an Ubuntu 15.04 machine; but since all the packages are common and in the base repos; I don’t see there being a problem getting it to work on any distro.

 OLD METHOD:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
NOTE: Any OSX after 10.6 Lion, will have to use the method demonstrated here.

 

Step 1: Install Netatalk

Install the following packages:

sudo apt-get install netatalk libc6-dev avahi-daemon libnss-mdns

Step 2: Configure /etc/nsswitch.conf

Once those packages are installed, we have to adjust 4 configuration files:

sudo nano /etc/nsswitch.conf

Locate the following:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

Add mdns  as below:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns

Step 3: /etc/avahi/services/afpd.service

sudo nano /etc/avahi/services/afpd.service

Paste the following:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
    <name replace-wildcards="yes">%h</name>
    <service>
        <type>_afpovertcp._tcp</type>
        <port>548</port>
    </service>
    <service>
        <type>_device-info._tcp</type>
        <port>0</port>
        <txt-record>model=TimeCapsule</txt-record>
    </service>
</service-group>

Step 4: /etc/netatalk/AppleVolumes.default

Now we setup the share:

sudo nano /etc/netatalk/AppleVolumes.default

At the bottom the section that reads:

# The line below sets some DEFAULT, starting with Netatalk 2.1.
:DEFAULT: options:upriv,usedots

# By default all users have access to their home directories.
~/                      "Home Directory"

# End of File

Change the path “~/”  to your share directory.

IMPORTANT:  Don’t forget to add ‘tm’ to options:upriv,usedots
As seen below:

# The line below sets some DEFAULT, starting with Netatalk 2.1.
:DEFAULT: cnidscheme:dbd options:upriv,usedots,tm

# By default all users have access to their home directories.
/path/to/share                       "Time Capsule"

# End of File

Step 5: /etc/default/netatalk

Now, we need to adjust netatalk settings.

sudo nano /etc/default/netatalk

Locate the following section:

#### Set which legacy daemons to run.
#### If you need AppleTalk, run atalkd.
#### papd, timelord and a2boot are dependent upon atalkd.
ATALKD_RUN=no
PAPD_RUN=no
TIMELORD_RUN=no
A2BOOT_RUN=no

Update it to reflect the following:

#### Set which legacy daemons to run.
#### If you need AppleTalk, run atalkd.
#### papd, timelord and a2boot are dependent upon atalkd.
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no

Once all is completed, and all the services have been restarted on the Ubuntu server.  The drive should show up under “Select Disk” under “Time Machine Preferences”.  If you have an old one, you may have to remove it.  Once selected you can use it as if it were physically plugged in.

 

*TIP – Use a wired connection only, and a gigE network will help immensely.  I do not recommend WiFi .