Raspberry Pi: Install Netatalk 3 with Spotlight support
I recently upgraded from Netatalk 2.2 to Netatalk 3.1 on my Raspberry Pi. Since Netatalk 3 isn’t in the repositories, I built it from source. Netatalk 3 also allows for Spotlight searching on network volumes.
Backup configuration files
Netatalk 3 uses a different arrangement of configuration files, but I backed up my current ones for reference:
cp -R /etc/netatalk/ ~/confbackup
Remove Netatalk 2
Start by uninstalling netatalk 2:
sudo apt-get remove netatalk
This is a somewhat exhaustive list (you probably have most of these installed already):
sudo apt-get install avahi-daemon bison build-essential checkinstall cracklib-runtime db-util db5.1-util groff libacl1 libacl1-dev libattr1 libavahi-client-dev libavahi-client3 libavahi-common3 libc6 libcomerr2 libcrack2 libcrack2-dev libcups2 libdb-dev libdb5.1 libdbus-1-dev libdbus-glib-1-dev libevent-dev libgcc1 libgcrypt11-dev libgcrypt11 libglib2.0-dev libgnutls26 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5-dev libldap-2.4-2 libldap2-dev libpam-cracklib libpam-modules libpam0g libpam0g-dev libssl-dev libtool libtracker-extract-0.14-0 libtracker-extract-0.14-dev libtracker-miner-0.14-0 libtracker-miner-0.14-dev libtracker-sparql-0.14-0 libtracker-sparql-0.14-dev libwrap0 libwrap0-dev lsof netbase perl procps quota rc systemtap-sdt-dev tracker tracker-explorer tracker-extract tracker-gui tracker-miner-fs tracker-utils zlib1g
Download and unpack Netatalk 3 source
Go to the Netatalk homepage and download the latest source code. For me this was 3.1.7. Once downloaded, unpack it, e.g.
tar -xf netatalk-3.1.7.tar.bz2
Configure and build Netatalk
You’ll need to specify the version of Gnome Tracker (Spotlight backend) that you’ve installed. The version in the repositories is 0.14, so the configure line looks like this:
./configure --with-init-style=debian-sysv --with-tracker-pkgconfig-version=0.14
If it configures successfully, then
sudo make install
In my case the build failed when building the Spotlight support. I hadn’t installed bison before starting and rather than fail during configure, netatalk failed to build. I ended up installing bison from source as well, though I expect the version in the repositories will work fine too.
Configure Netatalk 3
The new configuration file (only one) is /usr/local/etc/afp.conf. Mine looks like this:
hostname = raspberrypi
zeroconf = yes
log file = /var/log/netatalk.log
cnid scheme = dbd
uam list = uams_dhx2.so
save password = yes
spotlight = yes
dbus daemon = /usr/bin/dbus-daemon
basedir regex = /home
path = /media/backup/Backups/TimeMachine
time machine = yes
Important lines are the ‘spotlight = yes’ to enable Spotlight indexing, and the ‘dbus daemon’ line which needs an accurate path to the dbus-daemon command in order to connect to the indexer. More information can be found on the Netatalk website.
I struggled for a while to get tracker to start indexing my shares. What finally worked was actually just restarting — running top confirmed that tracker-extract and tracker-miner processes were working hard. After a fair while indexing Spotlight searches from the Finder of my shares worked as expected.