Installing Debianized Netatalk 3.0 on Ubuntu 10.04 [edited]

2014年7月16日netatalk

Netatalk 3.0 has just released.

Please check changing netatalk 3.0 from netatalk 2.X.

I tried to install it by below steps.

    1. Debianize Netatalk 3.0 (to make .deb package)
    2. Build it
    3. Install it

I am not a Debian developer, so this Debinaizing process may not exact. But the .deb package works well. If you have any comments, please leave it.

I will start to describe these steps, I add a prompt where I am. If there is not any directory, it can take any where.

  • [work dir]$ … working directory, such as “~/work/netatalk/netatalk_3.0-dpkg
  • [pkg dir]$ … source netatalk package directory. In this time, it is “~/work/netatalk/netatalk_3.0-dpkg/netatalk-3.0"

My test environment is below:

  • Server
    • PowerMac G4/MDD
    • Ubuntu 10.04 (EA, ACL, LDAP are installed)
  • Client A
    • iMac (mid 2007)
    • OS X 10.6.8 Snow Leopard (LDAP is setuped)
  • Client B
    • Macbook Pro (early 2011)
    • OS X 10.7.4 Lion

0. Preparing

If you installed old netatalk, you should uninstall it. It may cause some troubles.

To uninstall netatalk, you have some way.

If you have installed netatalk by Synapic or apt-get install, you can choose below:

  • Synaptic package manager
  • apt-get remove / purge

If you have installed netatalk from original source package, you can uninstall below:

$ cd ~/src/netatalk-*/
$ sudo make uninstall

1. Debianize Netatalk 3.0 (to make .deb package)

  1. Install packages to build Debian package
  2. Download and extract Netatalk tar ball
  3. Download and extract debian package of netatalk 2.2.2
  4. Make a Debian package
  5. Edit files in the package
  6. Install related packages

1.1 Install packages to build Debian package

Install below packages to build and make a Debian package.

  • dpkg-dev
  • fakeroot
  • dh-make
$ sudo apt-get install dpkg-dev fakeroot
$ sudo apt-get install build-essential
$ sudo apt-get install dh-make

1.2 Download and extract Netatalk tar ball

Download the original Netatalk source tar ball.

[work dir]$ wget http://sourceforge.net/projects/netatalk/files/netatalk/3.0/netatalk-3.0.tar.bz2
[work dir]$ tar xvjf netatalk-3.0.tar.bz2

1.3 Download and extract debian package of netatalk 2.2.2

Click a triangle sign at 2.2.2-1, then download netatalk_2.2.2-1.debian.tar.gz.

[work dir]$ wget https://launchpad.net/ubuntu/+archive/primary/+files/netatalk_2.2.2-1.debian.tar.gz
[work dir]$ tar xvzf netatalk_2.2.2-1.debian.tar.gz

1.4 Make a Debian package

This step is main part of this article.

  1. Make “debian" directry by dh_make
  2. Overwrite files by 2.2.2-1 files
1.4.1 Make “debian" directry by dh_make
[work dir]$ ls
debian  netatalk-3.0  netatalk-3.0.tar.bz2  netatalk_2.2.2-1.debian.tar.gz
[work dir]$ cd netatalk-3.0
[pkg dir]$ dh_make --createorig --single
ldap_sasl_interactive_bind_s: Local error (-2)
    additional info: SASL(0): successful result: 
Maintainer name : Foo Bar
Email-Address   : foo@example.com 
Date            : Mon, 09 Jul 2012 21:54:11 +0900
Package Name    : netatalk
Version         : 3.0
License         : blank
Using dpatch    : no
Using quilt     : no
Type of Package : Single
Hit <enter> to confirm: 
Done. Please edit the files in the debian/ subdirectory now. netatalk
uses a configure script, so you probably don't have to edit the Makefiles.

1.5 Edit the package

This is the most important step.

  1. Edit [pkg dir]/debian/rules (configure option)
  2. Edit [pkg dir]/debian/shlibs.local (library dependency)
  3. Edit [pkg dir]/debian/rules (cheats)
  4. Edit [pkg dir]/debian/rules (other changes)
1.5.1 Edit [pkg dir]/debian/rules (configure option)

configure option is changed on Netatalk 3.0, so you have to change rules file.

DEB_CONFIGURE_EXTRA_FLAGS := \
        --with-shadow --enable-fhs              \
        --enable-overwrite      \
        --enable-krbV-uam       \
        --with-libgcrypt-dir                    \
        --with-cracklib=/var/cache/cracklib/cracklib_dict       \
        --enable-zeroconf       \
        --with-init-style=debian
1.5.2 Edit [pkg dir]/debian/shlibs.local (library dependency)

This file is written about library dependencies. If there is not this file, you will occur below error.

dpkg-shlibdeps: error: no dependency information found for /usr/lib/libatalk.so.0 (used by debian/netatalk/usr/sbin/cnid_dbd).

To resolve this, I add a file “debian/shlibs.local".

libatalk 0 libdb-dev

This may not exact dependency, but it is enough to build this package.

1.5.3 Edit [pkg dir]/debian/rules (a cheat)

The standard Ubuntu 10.04 cannot satisfy a package “cdbs (>= 0.4.72~)" defined in debian/control.

You have two way to resolve this problem.

If you choose “Ignoring requirement", you have to edit debian/rules. (not debian/control) Add “#" at the top of line.

#include /usr/share/cdbs/1/rules/upstream-tarball.mk

And add a build option when build.

This article this way.

1.5.4 Edit [pkg dir]/debian/rules (other changes)

There are other some changes.

You can download the patch files for debian/rules from here.

[pkg dir]$ gzip -dc debian-rules-3.0_20121004.patch_.gz | patch debian/rules

1.6 Install related packages

Install other packages described in debian/control.

$ sudo apt-get install\
cdbs\
autotools-dev\
devscripts\
debhelper\
dh-buildinfo\
libdb-dev\
libwrap0-dev\
libpam0g-dev\
libcups2-dev\
libkrb5-dev\
libltdl3-dev\
libgcrypt11-dev\
libcrack2-dev\
libavahi-client-dev\
d-shlibs\
hardening-includes

2. Build it

You can start to build by this command.

[pkg dir]$ dpkg-buildpackage -us -uc -rfakeroot -d

It takes time for a while.

-us -uc" option is for no sign, so you are prohibited to upload this package.

“-d" option is for ignoring dependency.

Then you can find .deb packages in the [work dir].

[work dir]$ ls
netatalk-3.0                    netatalk_3.0-1.dsc
netatalk-3.0.tar.bz2            netatalk_3.0-1_powerpc.changes
netatalk_2.2.2-1.debian.tar.gz  netatalk_3.0-1_powerpc.deb
netatalk_3.0-1.diff.gz
netatalk_3.0.orig.tar.gz

3. Install it

If you have not run avahi-daemon yet, start it.

$ sudo service avahi-daemon start
avahi-daemon start/running, process 17177

Finally you can install Netatalk 3.0. And check the configuration.

[work dir]$ sudo dpkg -i netatalk_3.0-1_powerpc.deb
$ sudo service netatalk stop
$ /sbin/afpd -V
afpd 3.0 - Apple Filing Protocol (AFP) daemon of Netatalk

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. Please see the file COPYING for further information and details.

afpd has been compiled with support for these features:

          AFP versions:    2.2 3.0 3.1 3.2 3.3 
         CNID backends:    dbd last tdb 
      Zeroconf support:    Avahi
  TCP wrappers support:    Yes
         Quota support:    Yes
   Admin group support:    Yes
    Valid shell checks:    Yes
      cracklib support:    Yes
            EA support:    ad | sys
           ACL support:    Yes
          LDAP support:    Yes

              afp.conf:    /etc/afp.conf
       state directory:    /var/netatalk/
    afp_signature.conf:    /var/netatalk/afp_signature.conf
      afp_voluuid.conf:    /var/netatalk/afp_voluuid.conf
       UAM search path:    /lib/netatalk/
  Server messages path:    /var/netatalk/msg/

After that change the “/etc/afp.conf”. Below is an example.

;
; Netatalk 3.x configuration file
;

[Global]
    vol preset = default_for_all_volumes
    log file = /var/log/netatalk.log

[default_for_all_volumes]
    file perm = 0600
    directory perm = 0700

[Homes]
    basedir regex = /home

[MY_TIMEMACHINE]
    path = /afp/time_capsule
    time machine = yes
    vol size limit = 1024

[Shared]
    path = /afp/shared
    file perm = 0666
    directory perm = 0777

Finally you can start netatalk service.

$ sudo service netatalk start
Starting Netatalk services:  netatalk.

Then check behavior the netatalk.

Mac OS X 10.6.8 OS X 10.7.4
To find the server from finder OK OK
To make a folder OK OK
To copy a file from Mac to Ubuntu OK OK
To copy a file from Ubuntu to Mac OK OK
Permission of the copied file OK OK
Time stamp of the copied file OK OK
File extended attributes OK OK
Special characters such as “:" OK OK
Long file name OK OK
Backup by TimeMachine OK OK

File extended attributes are different between Mac and Ubuntu.

Mac

$ xattr ScreenShot.png
com.apple.FinderInfo
com.apple.metadata:kMDItemIsScreenCapture
com.apple.metadata:kMDItemScreenCaptureType

Ubuntu

$ getfattr ScreenShot.png
# file: Screen Shot 2012-06-02 at 0.46.46.png
user.com.apple.metadata:kMDItemIsScreenCapture
user.com.apple.metadata:kMDItemScreenCaptureType
user.org.netatalk.Metadata

The name of the file extended attributes are different between Mac and Ubuntu. But they have same contents.

HAT taught me its meaning by comments.

OS X netatalk
File Extended Attribute com.apple.FinderInfo user.org.netatalk.Metadata

“user.org.netatalk.Metadata" contains “com.apple.FinderInfo" as an AppleDouble format. This is implemented from netatalk 3.0.

“com.apple.FinderInfo" was stored in the “.AppleDouble/FILE" until netatalk 2.x.

You can check the contents of “user.org.netatalk.Metadata" by “apple_dump" command on netatalk. It dumps AppleSingle/AppleDouble format data.

If you want to uninstall netatalk, you can use following way.

$ sudo dpkg --purge netatalk

Don’t forget to backup /etc/netatalk/afp.conf, if necessary.

(edited 2012-09-26 22:42)

This article has some errors. This package will fail to install at first and to purge netatalk.

I have resolved this problem, but I don’t have time to revise.

Below steps are needed.

  • Revise debian/rules
  • Revise debian/control
  • Add debian/postrm

(edited 2012-10-04 21:07)

I updated the patch file for debin/rules. It has a minimum changing to fix fatal installing error.

HAT told me this problem, and this problem founded in blow article. Thank you!

(edited 2014-07-16 06:23)

There is a new article. Please refer it.

 

 

[References]

[Related Articles]

Posted by お市のかた