Getting TimeMachine to work under Ubuntu 10.04 LTS & OS-X Lion

Sponsored Link
This post is for all Ubuntu Geeks who got frustrated that their time machine didn't run anymore after intallation of OS-X Lion or for those out there trying to get it running for the first time.

OS-X Lion requires netatalk > 2.2.1, however there seems to be no package for that available on the regular sources, but you can also build it yourself!

That is the strategy we will follow in this post. As with many things once you know the recipe the procedure is straightforward, but I've found many posts our there of people who tried but didn't succeed. Follow the path below and you will become a happy time traveller!

 

Prepare for installation

Before doing so make sure you have a compiler installed. if not

sudo aptitude install build-essential

You will also need checkinstall:

sudo apt-get install checkinstall

 

Install Netatalk

Download netatalk sources

Now download the latest version of netatalk. In this post we will use 2.2.1  as an example but change the lines below accordingly to the latest version number:

sudo apt-get install libdb4.8-dev libcrack2-dev libssl-dev libgcrypt11-dev
wget http://sourceforge.net/projects/netatalk/files/netatalk/2.2/netatalk-2.2.1.tar.gz
tar xvf netatalk-2.2.1.tar.gz
cd netatalk-2.2.1
./configure -enable-debian --enable-zerconf
make

Install the package properly using checkinstall:

sudo checkinstall --pkgname=netatalk --pkgversion="$(date +%Y%m%d%H%M)" --backup=no --deldoc=yes --default

Note that you netatalk config files are now in a different location in case you upgrade from a previously installed package:

/usr/local/etc/netatalk/……

In that case we don't want to use /etc/netatalk. So if this directory still exists remove it:

rm /etc/netatalk

 

Configure Netatalk

Adjust your AppleVolumes.default config:

sudo nano /usr/local/etc/netatalk/AppleVolumes.default

Add tm to the default options to AppleVolumes.default:

DEFAULT: options:tm,upriv,usedots

and comment out  ~/ home directory entry in the last lines of the file

And add the following line, below:

/data/backup/TimeMachine "TimeMachine" cnidscheme:dbd allow:timemachineuser

 

Activate cnid_metad

Now make sure that the cnid_metad demon is running, you activate it in

sudo nano -w /etc/default/netatalk

somewhere half way you will find the following section:

ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no

 

Install Avahi

Now you will need to install avahi

sudo apt-get install avahi-daemon

 

Configure Avahi

Now you will need adjust the config file as indicated below:

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

 

## Add this to new file:
<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=Xserve</txt-record>
</service>
</service-group>

 

Add the timemachine user:

sudo adduser timemachine

 

create the required backup folder:

sudo mkdir /data/backup
sudo mkdir /data/backup/TimeMachine
sudo chown timemachine /backup/TimeMachine

 

Now you can start netatalk and avahi:

sudo /etc/init.d/netatalk restart && service avahi-daemon reload

You’re Ubutu machine is now ready for action!

The Lion setup:

First you will need to enable unsupported drives in time machine. To do this open a terminal window and execute:

Defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

 

Connect your TimeMachine network Volume:

Open Finder, from the menu bar choose go -> connect to server, and enter in the server address:

afp://timemachineuser@youripaddress

Click connect and enter the right password.

Things should work now and you can open your Time Machine, and click “Select Disk…” Choose the mounted drive that you just opened. If prompted for credentials, reenter them. Enable Time Machine and the first backup should fire up.

Your done! Happy timetravelling!

 

A few notes:

-- If things are all right you won’t need to prepare a sparsebudle file on your Lion machine and copy it to your TimeMachine Volume. Your Lion machine should be able to create one by itself.

-- it could be that I’ve also installed before setting up netatalk:

apt-get install libavahi-client-dev

Sponsored Link

You may also like...

16 Responses

  1. Simon says:

    Hi there, thanks for the tutorial. I seemed to get most of it working, but when trying to connect via afp I’m always told there is either no share available or I’m not allowed to access them.
    Network drive even shows up in TM, just username/password issue (OSStatus error 2).
    Even tried chmod 777 to the /mnt/disk3/Backups/Timemachine directory but no go 🙁
    Any suggestions?

  2. Maarten van Ingen says:

    There are some typos here.
    e.g.
    ./configure -enable-debian -enable-zerconf

    this must be:
    ./configure –enable-debian –enable-zeroconf

    And
    sudo checkinstall –pkgname=netatalk –pkgversion=”$(date +%Y%m%d%H%M)” –backup=no –deldoc=yes –default –deldoc=yes

    there is one –deldoc=yes too many.

    Cheers.

  3. Bo says:

    Thnx for the comments Maarten, I’ve corrected the text.

  4. Chuck says:

    In the above the user added was “timemachine” and
    then there was “allow timemachineuser”. Is this just
    a typo or is “timemachineuser” special.

  5. Simon says:

    Thanks Maarten, using your suggested changes I got it to work (well, at least start a backup. I assume it finishes ok hours later!)
    I also used “–enable-debian” in step 1, not “-enable-debian” as you suggested.

    Wrt Chuck, I believe “timemachineuser” is just a placeholder for the user you created, in this case “timemachine”.
    So “…allow:timemachine” and “afp://timemachine@…” worked for me.

    Thanks all!

  6. peter says:

    Hi, I have to make just timemachine drop the user everywhere

    also had to drop the appletalk zonename?? just comment out

    One issue I have is when on my site I am using a 192. address for server, when offsite i go through a static ip address so my mac seems to see the time machine disk as a different unit telling me no backup been done before…

    is there any way I can tell my mac that they are the same share in an alias table ???

    cheers – awesome software I own someone a few beers

    I used 2.2.2 no .1

    P

  7. kacee says:

    When using Ubuntu 12.04. Install netatalk from apt-get.

    sudo apt-get install netatalk

  8. outspoken says:

    The guide doesn’t work for me, using Ubuntu 12.04 and OSX 10.7.3 with Netatalk 2.2.1-1 from apt.

    I can connect with afp just fine but when starting time machine I get this error:

    An unexpected error occurred (error code -6584).

  9. outspoken says:

    Nevermind, as a time machine noob I completely overlooked “Turning On” time machine in system prefs.

  10. Andrew Reynolds says:

    Hey Fellow Geek,

    Enjoy your posts but got stuck on this one. After everything I try to connect to the drive using “aft://@” and I get stuck with a error message that states, “…this server version is not supported”.

    Using Ubuntu server 10.04 and OSX Lion. Any hints on where to start looking?

    -AR

  11. Andrew Reynolds says:

    **forgot to mention that I downloaded and used netatalk-2.2.3, not sure if that matters.

  12. Jochem says:

    I’ve just installed 2.2.3 as well and it gives me the same error: “The version of the server you are trying to connect to is not supported. Please contact your system administrator to resolve the problem.” When trying to mount the filesystem over the command line (using mount_afp) I get “mount_afp: AFPMountURL returned error -1069, errno is -1069”. After digging a bit further, this must mean “aspNoServers: No servers at that address”

    Tried quite a few things I found while googleing. And although it changed some things, it never got rid of the error OS X threw out. So I decided to downgrade to the version used in this tutorial (first run dpkg -r netatalk), but 2.2.1 exits ‘make’ with an error. So I went with 2.2.2 and that worked perfectly (just go through the tutorial again, starting from the wget command and skipping the avahi stuff – but don’t forget to restart netatalk!). It’s running its backup right now :).

    Now lets hope that Mountain Lion doesn’t change too much…

  13. Barry says:

    Thanks Jochem! I was stuck on the same issue. This worked.

  14. Roger says:

    Hi Guys – I could use some help:
    Ubuntu 10.04, Mountain Lion 10.7.3
    netatalk-2.2.2

    The good news – I can see my share and drop a jpeg file one it and see it with ‘display’ on the server side.

    The bad news: TimeMachine Error The network backup disk does not support the required AFP features.

    The share is: /media/teri2/TimeMachine
    because I saved a file in it, it contains the following files:

    drwxrwxrwx 7 timemachine timemachine 4096 2012-07-09 16:31 .
    drwxr-xr-x 9 root root 4096 2012-07-08 11:03 ..
    drwxr-xr-x 2 root root 4096 2012-07-09 16:10 .AppleDB
    drwxrwxrwx 2 root timemachine 4096 2012-07-09 16:10 .AppleDesktop
    drwxrwxrwx 2 timemachine timemachine 4096 2012-07-09 16:31 .AppleDouble
    -rw-r–r– 1 timemachine timemachine 6148 2012-07-09 16:23 .DS_Store
    -r-xr-xr-x 1 timemachine timemachine 1518484 2011-08-27 16:45 IMG_0028.JPG
    drwxrwxrwx 3 root timemachine 4096 2012-07-09 16:10 Network Trash Folder
    drwxrwxrwx 3 root timemachine 4096 2012-07-09 16:10 Temporary Items
    r

    status: 1.65 TB of 1.87 TB

    Can anyone help me with this one?

    Thanks,

    Roger

  15. Sigh says:

    With 2.2.1 or newer..you don’t need to use

    Defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

    I installed/compiled netatalk 2.2.4 on debian wheezy and afpd, and cnid_metad started automatically.

    The only changes I did were:
    1) Using ‘TimeCapsule’ instead of ‘Xserve’ in /etc/avahi/services/ afpd.service

    2) I did an old fashioned
    sudo apt-get build-dep netatalk
    ./configure –enable-debian –enable-zeroconf
    make
    sudo make install

  16. Ranjan S says:

    When i tried to access the share via AFP through Mountain lion using a registered user, it throws an error staing “Unable to connect to the server,this amy be due to incorrect ip, please contact your Administrator if the problem persists” and i got some error messages of this sort.

    Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: =============================================================== Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: INTERNAL ERROR: Signal 11 in pid 23169 (2.2.2) Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: =============================================================== Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: BACKTRACE: 27 stack frames: Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #0 /usr/sbin/afpd(netatalk_panic+0x23) [0x4609b4] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #1 /usr/sbin/afpd [0x460b87] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #2 /usr/sbin/afpd [0x460bd9] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #3 /lib/libc.so.6 [0x7fe83bbcef60] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #4 /usr/lib/libtdb.so.1 [0x7fe838de1d80] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #5 /usr/lib/libtdb.so.1(tdb_have_extra_locks+0x45) [0x7fe838de2f89] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #6 /usr/lib/libtdb.so.1 [0x7fe838ddd242] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #7 /usr/lib/libtdb.so.1(tdb_transaction_start+0x1a) [0x7fe838ddd626] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #8 /lib/security/pam_smbpass.so [0x7fe83842e122] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #9 /lib/security/pam_smbpass.so(get_global_sam_sid+0x4e) [0x7fe8384e9af9] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #10 /lib/security/pam_smbpass.so(pdb_set_user_sid_from_rid+0x27) [0x7fe838498e71] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #11 /lib/security/pam_smbpass.so [0x7fe83848e3be] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #12 /lib/security/pam_smbpass.so(samu_set_unix+0x22) [0x7fe83848e411] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #13 /lib/security/pam_smbpass.so [0x7fe8384ba35d] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #14 /lib/security/pam_smbpass.so [0x7fe8384ba65c] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #15 /lib/security/pam_smbpass.so(pdb_getsampwnam+0x2f) [0x7fe8384944c8] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #16 /lib/security/pam_smbpass.so(pam_sm_authenticate+0x2a2) [0x7fe8383e447e] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #17 /lib/libpam.so.0 [0x7fe83cb8dc42] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #18 /lib/libpam.so.0(pam_authenticate+0x43) [0x7fe83cb8d523] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #19 /usr/lib/netatalk/uams_dhx2.so [0x7fe83a65cdba] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #20 /usr/lib/netatalk/uams_dhx2.so [0x7fe83a65d10f] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #21 /usr/sbin/afpd(afp_logincont+0xa9) [0x41608d] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #22 /usr/sbin/afpd(afp_over_dsi+0xa6b) [0x40fe68] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #23 /usr/sbin/afpd [0x40dd91] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #24 /usr/sbin/afpd(main+0xa85) [0x4323ce] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #25 /lib/libc.so.6(__libc_start_main+0xe6) [0x7fe83bbbb1a6] Oct 17 23:41:44 px6-300d-KZLWIS afpd[23169]: #26 /usr/sbin/afpd [0x40db59]

    My afpd.conf file is

    default

    -noddp -uamlist uams_guest.so,uams_dhx.so,uams_dhx2.so -unixcodepage utf8 -maccodepage UTF8-MAC -guestname “operator”
    But when i tried to Access as a Guest, i was able to access the share. Please help me out in fixing this issue.

    hi this is my AppleVolumes.default file .

    “/mnt/pools/A/A0/s” “s” options:tm,usedots,upriv cnidscheme:dbd perm:0777 “/mnt/pools/A/A0/ss” “ss” options:tm,usedots,upriv cnidscheme:dbd perm:0777 “/mnt/pools/A/A0/sss” “sss” options:tm,usedots,upriv cnidscheme:dbd perm:0777

Leave a Reply

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