Netatalk Gateway - Sharing a folder on your fileserver to an Apple IIGS via a Raspberry Pi.
This blog is my way of documenting a process I went through to build a gateway that would allow my Apple IIGS to have access to an area of my fileserver (an old 2008 Mac Pro running macOS El-Capitan) using AppleTalk.
I used to have all this working on an uBuntu file server but I recently seized the opportunity to swap it for the silent running Mac Pro that has been collecting dust in my office.
Sadly, some time in the distant past, Apple chose to remove support for AppleTalk from macOS, so you can’t just hook up your Apple IIGS to the network (via the wonderful Uthernet II) and ask GS/OS to connect (using AFPBridge these days) to the Mac like we used to back in the day.
When I was using the uBuntu box, I’d used a package called A2Server to install a version of Netatalk that would allow the fileserver to pretend to be an old Mac supporting AppleTalk over TCP. This worked very well.
There are other flavours of A2Server however they tend to rely on sharing contents of a filesystem (or part thereof) on the local machine. I tried several without much success.
What I wanted was to share the contents of a folder on the Mac Pro to the IIGS. Since I couldn’t do this directly, with some suggestions from the community, I decided to use a Raspberry Pi as a gateway. The Apple IIGS would connect to the Raspberry Pi, and that in turn would connect to the Mac Pro. For the Apple IIGS, it would look like it was seeing files on the Mac Pro.
Connecting the Apple IIGS to the Raspberry Pi
I couldn’t get A2Server to work in this way. A2Server won’t install on the latest version of Raspian because the version of Netatalk it brings in, no longer compiles under the latest Raspian. During my fiddling, I did get A2Server working, but only by finding an oldstable version of Raspian (which right now is Jesse, but that will change) and installing that on the SDCARD first.
Another option was to use a docker image on the Raspberry Pi, kindly provided by fluxo-gs. That worked in so far as the IIGS could see files on the local machine (the Raspberry Pi), but they were read-only. That wasn’t going to be good enough.
What I really wanted was a current version of Raspian with Netatalk 2.2.6 running (you can’t use Netatalk 3.x because the bright sparks that bring us Netatalk decided that the Apple II (and others) community didn’t need to be included anymore; π€·ββοΈ) that would let the Apple IIGS see the files it’s supposed to.
So, after a bunch of attempts with various versions of Raspian, and toolchains that worked in some part, I settled on finding a version of Netatalk 2.2.6 that would compile on the latest Raspian. I found this via the Netatalk forums where the compilation issues I’d seen with A2Server had been addressed. I grabbed a ZIP of that updated code, and called it netatalk-code.zip.
Connecting the Raspberry Pi to the Mac Pro
The other half of this setup is to get the files on the Mac Pro visible to the Raspberry Pi and placed within the volume being shared with the Apple IIGS by Netatalk.
To do the mount from the Mac Pro, I had two options:
- Use SAMBA, the windows file sharing protocol.
- Use AFP, the Apple file sharing protocol.
Obviously, my preference was to use AFP, so I spent a lot of time hunting down a version of afpfs-ng
that compiles cleanly on the latest Raspian without any issues, like dependencies, etc. afpfs-ng
is an AFP client. It also integrates with FUSE so you can setup a mount point with it via the mount_afp
command. Don’t try to add a mount point using it in /etc/fstab
, as that will just put your Raspberry Pi into emergency mode.
Getting afpfs-ng
to compile on the older Raspian versions was way too hard, which was part of why I fixated on using the latest Raspian. That said, it does depend on a bunch of things like FUSE.
Although I got AFP working via afpfs-ng
, sadly there are some issues with how it integrates with FUSE that prevents me from mounting the AFP volume at a mount point inside the Netatalk volume. FUSE issues a warning and says to use the “nonempty” option, however afpfs-ng
, via the mount_afp
tool it provides does not support this option. You can’t just delete all the files within that mount point though because Netatalk is creating stuff in there dynamically as part of it’s AppleTalk implementation.
So I had to settle on using SAMBA. π
SAMBA works; it just meant that I had to share the folder from the Mac Pro using SAMBA as well as AFP which is, to my mind, messy. I might have been able to use NFS instead but that would have meant setting up stuff on the Mac Pro that was only achievable via bash scripts (as far as I know) and I was trying to keep the Mac Pro “clean”.
Conclusion
Below are the steps I took to build up my Raspian image. It now boots, starts Netatalk, and after booting, kicks off a @reboot
cron job to establish the SAMBA mount point inside the Netatalk volume. The steps marked with an π are not needed I believe, unless you want to get the AFP via afpfs-ng
thing working.
My Apple IIGS is happy; it can see, read, and write files on my Mac Pro, and life goes on.
Steps
- Install Raspian Lite (in my case bullseye)
- Update
config.txt
on the SDCARD to enforce HDMI support.
You can use this file if you want. Just copy it onto the SDCARD. - Booting the Raspberry Pi should prompt you to:
- Set the keyboard layout.
- Set your username to
pi
- Set your password to
apple2
sudo raspi-config
; and- If you’re using WIFI instead of Wired network, then configure the WIFI.
- Change the name of the server to whatever you want. I used
AppleIIBridge
- Enable SSH
- Set the timezone
- Set the locale
- Reboot and login to the pi.
mkdir Downloads; cd Downloads
- π Download
afpfs-ng-master.zip
from https://github.com/pkclsoft/afpfs-ng (or you can grab this snapshot I used) - π
tar -xzvf afpfs-ng-master.
tgz - Download
netatalk-code
from https://sourceforge.net/p/netatalk/code/ci/d8f1cfbce1cd83d44b147ab09ce99484c906deee/ (or you can grab this snapshot I used) tar -xzvf netatalk-code.
tgzsudo mkdir -p /mnt/A2Host
(this will be your mount point)sudo mkdir /mnt/A2Host/A2Files
(this will be where SAMBA mounts the shared volume from the Mac Pro)sudo chown -R pi:pi /mnt
- π
sudo apt-get install raspberrypi-kernel-headers
- π
sudo apt-get install ncurses-dev libreadline-dev
- π
sudo apt-get install lib fuse-dev
sudo apt-get install autotools-dev
sudo apt-get install libdb-dev
sudo apt-get install automake
sudo apt-get install libtool
- π Within
afpfs-ng-master/
./configure
β (No errors should be reported)make
sudo make install
- Within
netatalk-code/
./bootstrap
./configure --enable-ddp --enable-debian --enable-a2boot
make
sudo make install
- Modify
/etc/init.d/netatalk
- Add β
$network
β to the line starting with βRequired-Start
β.
- Add β
- Configure the files within
/usr/local/etc/netatalk
:- At the end of
afpd.conf
, replace the last line with:- -ddp -tcp -uamlist uams_guest.so,uams_clrtxt.so,uams_randnum.so,uams_dhx2.so -mimicmodel MacPro -nosavepassword -advertise_ssh
(note, you may not need so many uams specified)
- At the end of
AppleVolumes.default
, add the line:/mnt/A2Host A2Host allow:pi options:prodos ea:ad
where the first argument is the location of your mount point (see step 10), the second is the name of the share for the Apple IIGS to refer to, the third specifies what user to allow access, and the fourth and fifth are options relevant to this type of shared volume.
Then comment the line with the single “
~
” with a hash:#~
- I also updated the line beginning with
:DEFAULT
to::DEFAULT: options:upriv,invisibledots
though this may not be needed.
- At the end of
- At the end of
atalkd.conf
, add this line:eth0 -router -phase 2 -net 1 -addr 1.171 -zone "AppleIIBridge"
where that last argument is the name you have given to your Raspberry Pi.
- Within
/etc/default/netatalk
:- Change the line starting with
AFPD_GUEST
to:AFPD_GUEST=pi
- Make sure the following lines are as shown:
ATALKD_RUN=yes
#PAPD_RUN=no
#TIMELORD_RUN=no
A2BOOT_RUN=yes
- Change the line starting with
- Finally, if you want to automate the mounting of the SAMBA share, you can use this script, and place it within the file
/home/pi/Documents/connectToMacPro.sh
.Remember to make it executable. Note that you need to replace
<IPADDRESS>
with the actual address of your Mac Pro (or equivalent).Note also that the uid and gid are for the “pi” user. I got those by looking inside
/etc/passwd
and/etc/group
.
#!/bin/bash MOUNT_POINT=/mnt/A2Host/A2Files MACPRO=<ipaddress> function connect() { echo "Trying to mount ${MOUNT_POINT}" sudo mount -t smb3 //${MACPRO}/A2Files /mnt/A2Host/A2Files -o user=pi,pass=apple2,uid=1000,gid=1000 } numfiles=`sudo ls -1 ${MOUNT_POINT} | wc -l` for (( ; ${numfiles} == 0; )) do connect numfiles=`sudo ls -1 ${MOUNT_POINT} | wc -l` if [ ${numfiles} == 0 ]; then echo "Unable to establish A2Files connection on Mac Pro, trying again in 5 seconds" sleep 5 fi done echo "A2Files mounted successfully."
- To get this script to execute after the system is up and running, add the following line to the
sudo crontab
using the commandsudo crontab -e
:- @reboot /home/pi/Documents/connectToMacPro.sh
sudo systemctl enable netatalk
sudo reboot