Montag, 1. August 2011

Netatalk 2.2 configurations

Here is how I got my netatalk/afpd running with Apple's Time Machine service. After installing netatalk 2.2 (and its dependency libdb and libgcrypt - see previous post) there should be configuration files in /opt/etc/netatalk/

afpd.conf: (updated August 3rd)

- -transall -nouservol -setuplog "default log_info /var/log/afpd.log" -defaultvol /opt/etc/netatalk/AppleVolumes.default -systemvol /opt/etc/netatalk/AppleVolumes.system -passwdfile /opt/etc/netatalk/afppasswd -uamlist uams_clrtxt.so,uams_guest.so,uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh

AppleVolumes.default:

/path/to/Volume "TimeMachine" cnidscheme:cdb options:tm


netatalk.conf:


# Appletalk configuration
# Change this to increase the maximum number of clients that can connect:
AFPD_MAX_CLIENTS=50


# Change this to set the machine's atalk name and zone, the latter containing
# the '@' sign as first character -- compare with nbp_name(3) if in doubt
#
# NOTE: If Netatalk should register AppleTalk services in the standard zone
#       then you need not to specify a zone name here.
#
#       If your zone has spaces in it, you're better off specifying
#       it in afpd.conf if you realize that your distribution doesn't
#       handle spaces correctly in the startup script. Remember to use
#       quotes here if the zone name contains spaces.
#
#ATALK_ZONE="@some zone"
ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1`


# specify the Mac and unix charsets to be used
ATALK_MAC_CHARSET='MAC_ROMAN'
ATALK_UNIX_CHARSET='LOCALE'


# specify this if you don't want dhx and dhx2
# available options: uams_guest.so, uams_clrtxt.so,
#                    uams_dhx.so, uams_dhx2.so,
#                    uams_randnum.so
#AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"


# Change this to set the id of the guest user
AFPD_GUEST=nobody


# Set which daemons to run (papd is dependent upon atalkd):
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no


# Control whether the daemons are started in the background
ATALK_BGROUND=no


# export the charsets, read form ENV by apps


export ATALK_MAC_CHARSET
export ATALK_UNIX_CHARSET


Also if you want to get the netatalk service to be advertised you need install the avahi-daemon and edit its settings. The settings reside in /opt/etc/avahi/


avahi-daemon.conf:

[server]
host-name=TimeMachine
use-ipv4=yes
use-ipv6=no
allow-interfaces=br0
enable-dbus=no


Also create a file in /opt/etc/avahi/services 


Mine is called afpd.service:



<?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=Xserve</txt-record>
</service>
</service-group>


Last but not least issue the command 'adduser avahi' then 'avahi-daemon &'. Now you are set to start the service by typing 'afpd'. You should now be able to see 'TimeMachine' in the shared section of your Finder window. After mounting it is available in the Time Machine preferences.


Thanks to myopenrouter - their tutorial initially got me started fiddling around with Time Machine and dd-wrt afpd/netatalk half a year ago. I found some more settings using www.google.com. My configurations are most certainly not the best there is but for me they worked. I hope they do the same for you.

20 Kommentare:

  1. what do you exactly mean with /path/to/volume
    which path sould i enter here?

    AntwortenLöschen
  2. The /path/to/volume points to the directory you would like to share. In my case it points to /mnt/BackupHD where my Backup partition is mounted in.

    AntwortenLöschen
  3. @nGotme

    I installed the netatalk 2.2.2 from your latest post. But I always got this error when I connect the afp from my mac.

    "Something wrong with the volume's CNID DB, using temporary CNID DB instead.Check server messages for details!"

    Here is my log:

    If I set cnidscheme:bdb I got:
    Aug 02 21:23:12.643222 afpd[3201] {cnid_dbd.c:88} (E:Default): tsock_getfd: getaddrinfo: CNID server localhost:4700 : Bad value for ai_flags

    If I set cnidscheme:cdb I got:
    Aug 02 21:17:45.664637 afpd[3106] {cnid.c:110} (E:AFPDaemon): Cannot find module named [cbd] in registered module list!

    Can you help me?
    Thanks!
    Hao

    AntwortenLöschen
    Antworten
    1. Hey Hao,

      did you try to use dbd instead? Also did you add uams_dhx2.so in the list of modules in afpd.conf?

      Löschen
    2. YES! I follow the steps as same as this post. So I have uams_dhx2.so in my afpd.conf

      I got these errors when I use cdb/dbd --- https://gist.github.com/3247901 (this snippet included both cdb/dbd logs)

      Löschen
    3. Looks like your cdb module has been registered but is not in the module directory.
      1) Did you try did instead?
      2) Where does your configuration reside (absolute path)?
      3) What are the directory attributes?
      4) Are you starting the client as root?

      Löschen
    4. Answers:
      1. What is "did"?
      2. I am using optware. So all my stuff is in /opt. (/opt/etc/netatalk/*)
      3. My Time Machine dir's attributes is 777.
      4. start which client? afpd? or cnid server?

      OK. I always got this error:

      tsock_getfd: getaddrinfo: CNID server localhost:4700 : Bad value for ai_flags

      Seems the afpd server need to request localhost:4700 (cnid server). Can you tell me how can I launch this server on 4700port.

      Thanks,
      Hao.

      Löschen
    5. 1) dbd instead of cdb was meant
      2) ok
      3) ok - what are the privilges on the /opt/etc/netatalk/uams directory?
      4) the afpd server (not client of course) - I do not start the cnid server manually

      Löschen
    6. Hmm. How about this. I am using the same router as yours.(3500L). Can you share me your firmware. So I can reinstall all these. Thanks

      Löschen
    7. No problem. I use the recommended firmware 14929 mini-usb-ftp, which can be found here: ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2010/08-12-10-r14929/broadcom_K26/

      Löschen
    8. Fantastic! It works! I reinstall the DD-WRT firmware. And reinstall netatalk-2.2.1(I am not using the latest one). And everything works.

      Thanks for your help!!!

      Löschen
    9. Congratulations and good to know that it works with the reinstall!

      Löschen
  4. Hello, I'm trying to set up my NAS as a time machine volume for my Macbook Pro running OS X 10.8.0. So far I'm having no luck, I used the configurations given in this post with netatalk-2.2.2. I can see the volume on my MBP but cannot connect using what should be guest access. (U::nobody" P:"") It appears to time out but I don't know how to troubleshoot this. My MDD G4 running Mac OS X 10.4.11 doesn't see it, but I can punch in the path to the volume manually and it'll run into the same problem. Any ideas?

    AntwortenLöschen
    Antworten
    1. Hey Parker,

      what system are you using for the NAS? Also I do not have OS X 10.8 installed I can only give you advice based on 10.7 and the DD-WRT setup I described in this blog. Are avahi and afpd running on the NAS or do they exit? Did you have a look at the log files?

      Löschen
    2. It's an external hard drive attached to an ASUS router running DD-WRT. Avahi and afpd are both running. I just found the log file for afpd, I don't know where the other log files are. I'm basically running the network attached file systems via an optware installation on the external hard drive, which has partitions for optware, swap, and a larger partition for sharing files on the network.

      Here's afpd.log.

      Löschen
    3. Did you set a password in /etc/passwd? Is the nobody account and group present also?

      Löschen
  5. This is the entry for nobody in /etc/passwd;

    nobody:*:65534:65534:nobody:/var:/bin/false

    I don't know enough about this format to know if a password has been set or not.

    As for a nobody account and group, how would I go about doing that? Is it the same as using adduser for avahi or is there a different process involved?

    AntwortenLöschen
    Antworten
    1. That looks good. The group can be defined using the same way it was done for avahi - addgroup should do the trick when the nobody user is already present.

      Löschen
    2. Added a group for nobody and confirmed that there is a nobody user, still no dice.

      Löschen
  6. I can see the volume in my Osx 10.6.8 but it is read only....log-in as Guest as per written in Finder.....any idea why? Do I need to config the netatalk to add the user and password of the Osx user?

    AntwortenLöschen