Emaculation.com

This is an old revision of the document!


Setting up an AppleTalk file- and printserver for Classic Mac OS and OS X

This is a guide intended for beginners, written by a beginner – at least when it comes to Linux and compiling. Therefore it might appear somewhat overdone to you if you are an experienced user.

Introduction

A Mac file can have data fork, resource fork and some meta data. It needs to be stored on a system able to handle these. Therefore Apple invented the HFS/HFS+ filesystem.

On a non-HFS volume, the only way for Classic Mac OS and Mac OS X to have their files stored in the same way and keep them interchangeable with preserved resource fork and meta data, is to connect to an AFP file server that handles the storing onto that volume. Otherwise the result might be unusable files for either of the Mac OS systems.

Firstly I wanted to be able to have a simple NAS serving both, Classic Mac OS and OS X at once. So an AFP file server was indispensable. Preferably one that, next to AppleTalk over IP (a.k.a. AFP over IP, nowadays), would offer AppleTalk over DDP as well.

Secondly I was still looking for an inexpensive and practical way to share my old LocalTalk printer to the network (while I already owned a LocalTalk-to-Ethernet bridge).

On my search for a suitable solution I found A2SERVER by Ivan Drucker which provides the core for the former part (you can even connect an Apple ][ to it). At the same time it forms a perfect base for the latter part: With relatively little effort (well, I know little to nothing about Linux and inquired in forums and searched for the right commands on the net, etc. – but it was doable) A2SERVER can serve as print server as well – even for my old LaserWriter 4/600 PS.

A2SERVER also provides an IP gateway. But as far as I know A2CLOUD is required in order to allow any old Mac to access the Internet via AppleTalk. There are some sort of release notes for A2SERVER over here, but they're not up-to-date. And here is a feature overview, but I don't think it sums up all the functionality A2SERVER offers.

You can find the complete A2SERVER system at http://ivanx.com/a2server/. There you can choose whether you want the Raspberry Pi version, a virtual machine image or an installer for Ubuntu or Debian. Find more information on the website, it is very detailed. Please note that some information on the A2SERVER website is outdated. At the time of writing this (April 2017), version 1.5 is installed when running the installer script for Ubuntu or Debian. The website refers to version 1.2.5 (which wasn't able to run on Debian 8 Jessie).

In this guide A2SERVER is installed onto a system built around a Banana Pi running Debian (Armbian). If you download the virtual machine or run A2SERVER on a Raspberry Pi, some things will work differently than described here and most of this guide is not for you – mainly because you don't need to compile anything for that.1) I chose for the Banana Pi as I wanted a stand-alone system with a hard disk connected to it via SATA.

This guide is written for Terminal on OS X connected to the A2SERVER via SSH. If you use a keyboard layout other than American English, it is strongly recommended to log on from Terminal via SSH rather than working directly on the A2SERVER system. This is what I do in this guide.

Entries to be performed in Terminal (which you can find under Utilities in the Applications folder in OS X) look like this:

This is an entry.

Except for a few cases when you are asked to substitute parts of an entry, just select all text within the box and copy-paste it into Terminal.

A dark blue box does not represent an entry, but output to be expected from Terminal.

Prerequesites

Required hardware

Based on this blog – read for detailed information on which parts to buy.2)

The Banana Pi has two Micro USB ports. When assembling the system make sure to plug the power supply into the one next to the SATA port (not the one next to the SD card slot).8)

Required software

For the build system
For your local computer
  • Next to OS X, it is also possible to use the printer with, e.g., Windows. But I have not covered that in this guide.9) 10)
  • If you want to print to an AppleTalk PostScript printer shared by the Banana Pi, you need the appropriate PPD file for it. If you do not have that you can obtain it from Adobe: Mac | Win. Scroll down to “PPD Files” and choose the one for your printer manufacturer. Under OS X, extract the .sit archive using ”The Unarchiver“.11)

1) Compilation of Armbian for Banana Pi

Based on this guide.

There are ready-to-use images you can burn on an SD card and start your Banana Pi with. However, as we need AppleTalk in the kernel (the real thing – so via DDP instead of IP), those images are of no use to us. But thanks to Armbian, there is a quite easy way to obtain the SD card image we need. First we need a virtual machine running a Linux system, then we compile Armbian on it.

Prepare the virtual machine

Install the “VirtualBox platform package” on your Mac. Also the “Oracle VM VirtualBox Extension Pack” if your SD card reader is connected via USB. The latter is required for USB 2.0 and 3.0 support. Connect your USB SD card reader to your computer now. Start VirtualBox and create a virtual machine by clicking on “New”. Give it an appropriate name (if it contains “Xenial” and “x64”, VirtualBox will set type and version automatically).

Click on “Continue”. As you go through the setup steps, for most of them just leave the default settings. Except for “Hard disk file type” choose “VMDK” and for “File location and size” enter “32.00 GB”. Click “Create” in the last step.

Now choose “Settings” at the top of the window and then click on “Storage”. Under “Controller: IDE” click on “empty” and then on the disk symbol to the very right of the window. There select “Choose Virtual Optical Disk File…” and choose the Xenial Live CD image you have downloaded (it should be called “mini.iso”). Click on “Open”.

Next click on “Network”. At “Attached to:” select “Bridged Adapter”. Click “OK”.

Then click on “Ports” and on “USB”. Click the radio button in front of “USB 3.0 (xHCI) Controller”. Now, to the right of the window, click on the symbol with the blue plug and green ”+“. Select your SD card reader from the menu (in my case “USB Device USB Mass Storage Device [0001]”). It will be added to the USB Device Filters list.

Click on “Start” in VirtualBox. Once the VM has started up confirm “Install” by pressing enter.

Most of the following menus and options are self-explaining.

The chosen computer name and user name will later on appear, e.g., in Terminal as USER_NAME@COMPUTER_NAME:

When you are asked about partitioning of your hard disk, simply confirm the pre-selected options and finally confirm the partitioning with ”yes“. Also for other questions keep the pre-selected settings. Except when asked to select software, choose “Samba file server” and “OpenSSH server”12) (select by pressing space). When finished confirm with enter.

Before confirming to restart the machine, go back to the VirtualBox Manager. Go to the settings to remove the disk image with “Remove Disk from Virtual Drive”. Click “OK”.

Go back to the virtual machine and click “Continue”. After the VM has started up, login with the user name and password you have chosen.

Enter ”ip addr show“ and write down the IP address behind ”inet“ (under ”link/ether“) in a TextEdit file or on a piece of paper.

Compile Armbian (Debian 8 Jessie) with AppleTalk for Banana Pi

Open Terminal in OS X and enter

ssh USER_NAME@IP_ADDRESS

(Substitute ”USER_NAME“ and ”IP_ADDRESS“ with the appropriate values.)

Confirm the following warning with ”yes“. When prompted, enter the password you chose when setting up the virtual machine.

Set root password:

sudo passwd root

You will first be asked for your current password and then to set the root password.

Change to superuser:

su

Now you will be prompted for the root password you just set.

Change to root directory:

cd

Update apt-get:

apt-get update
apt-get upgrade

Install git:

apt-get -y -qq install git

Clone the required repository:

git clone --depth 1 https://github.com/igorpecovnik/lib

Copy compile script to current location:

cp lib/compile.sh .

The dot is part of the entry, don't forget it.

Configure compile.sh and let it download and prepare the required repositories:13)

./compile.sh KERNEL_ONLY=no KERNEL_CONFIGURE=yes BUILD_DESKTOP=no BOARD=bananapi BRANCH=default RELEASE=jessie

After a while (depending on your Internet and machine speed – in my case about 25 min) a Kernel Configuration Menu will be displayed.

Move down to “Networking support” → enter

Move to “Networking options” → enter

Move to “Appletalk protocol support” → press ”M

Move to “Appletalk interfaces support (NEW)” → press ”M

Do NOT select the remaining AppleTalk related options.

“Double-press” esc three times and say Yes (enter) in the following menu.

From this point for me it took about one hour until compilation was done and the SD card image was ready.

Write the Armbian image to the SD card

Once compiling has finished, insert the SD card you want to prepare for the Banana Pi into your USB Card Reader. Make sure to eject the SD card from your OS X host (a dialog might pop up on OS X).

In this guide we assume you work with an SD card reader connected to your machine via USB. If your computer has a card reader built in, some of the following entries will be slightly different.14)

If your SD card is connected via a USB card reader and is the only SD card connected, it should be reachable via /dev/sdb. Check this by entering:

fdisk -l

If only disk ”/dev/sda“ is shown, but no ”sdb“, your SD card is probably not connected to the VM (or not via USB). ”/dev/sda“ is the system disk of the VM – at least it is in my case. Among other output, your SD card should be displayed as ”/dev/sdb“ in a bold line like this:

Disk /dev/sdb: 15.1 GiB, 16172187648 bytes, 31586304 sectors

You can recognize it by its size. I use a 16 GB SD card which in reality has 15.1 GB capacity. That is reflected in above line. If you use an 8 GB SD card (which is more than enough), the line above should report a bit more than 7 GB capacity. For the virtual machine we had created a hard disk image of 32 GB, so ”sdb“ must be your SD card in this case.

Be very careful here, as you could destroy your VM and would have to begin all over!

I sometimes couldn't see ”sdb“. After putting my host machine into sleep mode and recovering from sleep again, ”sdb“ was shown (that is, after repeating above entry).

Debian, and therefore also Armbian, is actively developed. As the present version number is reflected in the file name of the SD card image, we need some flexibility in the command that writes the image to the card. There should only be one file in the directory ”/root/output/images“. Run the following test entry to verify:

echo dd if=/root/output/images/$(ls /root/output/images/) of=/dev/sdb bs=1M

(If necessary, substitute ”sdb“ in this entry for the appropriate value in your system.)
This should return something like

dd if=/root/output/images/Armbian_5.27_Bananapi_Debian_jessie_default_3.4.113.img of=/dev/sdb bs=1M

If it does, write the Armbian image to your SD card (again substitute ”sdb“ if necessary):

dd if=/root/output/images/$(ls /root/output/images/) of=/dev/sdb bs=1M

The write process should take no longer than two minutes.

When finished, pull the SD card from the card reader's slot.

Backing up the SD card image

You should keep a copy of the compiled image in a safe place, in case you have to burn it onto a new SD card in the future. Therefore, the virtual machine has to be made accessible via the network first. To do so, first create the directory to be shared and set the correct permissions and owner:

mkdir -p /srv/buildshare
chmod -R 0775 /srv/buildshare
chown -R nobody:nogroup /srv/buildshare

Append your network share to the Samba settings (copy-paste all lines at once into Terminal and press enter):

(echo
echo [buildshare]
echo "    path = /srv/buildshare"
echo "    browsable = yes"
echo "    writable = yes"
echo "    guest ok = yes"
echo "    read only = no"
echo "    force user = nobody") >> /etc/samba/smb.conf

Restart Samba:

service smbd restart

Compress the SD card image into a zip file onto the shared volume:

zip /srv/buildshare/$(ls /root/output/images/).zip /root/output/images/$(ls /root/output/images/)

You can now click on your virtual machine under “SHARED” in the sidebar of an OS X window and find the zipped file in the volume “buildshare”. Copy it to a safe place.

2) Basic setup of the Banana Pi

Insert the prepared SD card into your Banana Pi. For now, connect the BPi to the Ethernet using the onboard Ethernet slot. Finally insert the power plug and the BPi will start up.

Login to your network router via the internet browser of your host computer in order to find out the IP address of the Banana Pi. Then go to Terminal and connect to it via SSH:

ssh IP_ADDRESS -l root

(Substitute ”IP_ADDRESS“ with the one you just found out.)

You will be asked to enter the root password. Enter ”1234“ (standard for a new Armbian installation). You will be forced to change the root password. Just follow the instructions in terminal.

Now the system will create a new user account and first ask you to choose a user name and then a password (not your root password). In case you encounter a warning regarding your locale settings you may ignore it. It only means that OS X, from which you are accessing the Banana Pi via Terminal, has different settings than the BPi15). A few more questions will follow. You don't have to answer them. Just press enter.

Terminal should still display ”root@bananapi:~#“, meaning you are still logged in as root. If not, change to superuser:

su

and enter the root password.

Prior to beginning with the setup: In order to prevent ”/etc/rsyslog.conf“ to “spam” ”/var/log/syslog“ with ”'action 17' suspended“ messages, xconsole logging has to be disabled 16):

sed -i '/# NOTE: adjust/ { N;N;N;N;N;N; s/^/#/gm }' /etc/rsyslog.conf

[OPTIONAL] Power-off via power button

Configure the power button of the Banana Pi to work as shutdown button as well.17)

Install acpid:

apt-get update
apt-get upgrade
apt-get install acpid

Create an acpi event and a script:

echo -e 'event=button/power\naction=/etc/acpi/shutdown.sh' >> /etc/acpi/events/button_power
echo -e '#!/bin/bash\nshutdown -h now' >> /etc/acpi/shutdown.sh

Make shutdown.sh executable:

chmod +x /etc/acpi/shutdown.sh

Restart acpid:

/etc/init.d/acpid restart

Attach a hard disk

If you have only one HDD attached to your Banana Pi, it is connected to ”/dev/sda“.18)

Partition the HDD:

fdisk /dev/sda

followed by
o“ → enter
and
n“ → enter
press enter
press enter
press enter
press enter
w“ → enter

Format the partition:

mkfs.ext4 /dev/sda1

The HDD will be mounted at ”/srv/A2SERVER“ which we create by:

mkdir /srv/A2SERVER

Now permissions for the new directory must be set to your user account and group:

chown -cR 1000:1000 /srv/A2SERVER

List your volumes in order to obtain the id of your HDD:

ls -1 /dev/disk/by-id/

There should be two entries beginning with ”ata“. The one ending on ”-part1“ represents the first partition of your HDD. It should be on the second line of the output generated by above command (if not, substitute the digit ”2“ behind ”head -n“ in the following two commands by the appropriate line number). First test the following entry:

echo $(ls -1 /dev/disk/by-id/|head -n 2|tail -n 1)

The response should contain your HDD's id preceded by ”ata-“ and appended by ”-part1“ like this:

ata-WDC_WD7500BFCX-68N6GN0_WD-WX31A761ZDF9-part1

If it does, make the HDD auto-mount at ”/srv/A2SERVER“ by appending it to ”/etc/fstab“ (if you had to substitute the digit ”2“ in the last entry, don't forget to also do it in the following one):

echo "/dev/disk/by-id/$(ls -1 /dev/disk/by-id/|head -n 2|tail -n 1) /srv/A2SERVER ext4 defaults 0 0" >> /etc/fstab

Mount the HDD:

mount -a


In order for your HDD to not permanently run while it is not accessed, configure it to spin down after a set time.19) Again list your volumes in order to obtain the id of your HDD:

ls -1 /dev/disk/by-id/

This time you need the other line beginning with ”ata“, the one NOT ending on ”-part1“. It is probably on the first line of the output generated by above command (if not, substitute the digit ”1“ behind ”head -n“ in the following command by the appropriate line number). Append the HDD to ”/etc/hdparm.conf“ (copy-paste all lines into Terminal at once):

(echo "/dev/disk/by-id/$(ls -1 /dev/disk/by-id/|head -n 1|tail -n 1) {"
echo "        spindown_time = 240"
echo "}") >> /etc/hdparm.conf

I am using the value ”240“ here, which represents 20 min. So if the HDD has not been accessed for 20 minutes it will be spun down.

Prepare networking

Add the USB-to-Ethernet adapter to the network settings:

sed -i '/allow-hotplug eth0/a allow-hotplug eth1' /etc/network/interfaces
sed -i '/iface eth0 inet dhcp/a iface eth1 inet dhcp' /etc/network/interfaces

Amend the path variable to the executables

As we're on a Debian system, only the entries referring to “bin” paths work, not the “sbin” ones. Change that by entering the following:20)

sed -i '0,/-eq 0/s/-eq 0/-ge 0/' /etc/profile

Shut down the Banana Pi:

shutdown -h now

Once it has shut down, unplug the Ethernet cable from the internal USB slot of the Banana Pi and plug it into the newly installed USB-to-Ethernet adapter.

3) Software installation and configuration on the BPi

Press the power button and wait until the Banana Pi has booted again. Again connect to it via SSH from Terminal, this time with your new user account:

ssh USER_NAME@bananapi

[OPTIONAL] Install printing system (CUPS)

If you want your file server to be able to act as print server as well, you need to install a printing system. This has to be done now as otherwise Samba might not work correctly, which comes with the A2SERVER package.

First update the package index files on your system:

sudo apt-get update
sudo apt-get upgrade

Then install the printing system (CUPS):

sudo apt-get install cups

Install A2SERVER

Now it is time to install A2SERVER:21)

sudo wget appleii.ivanx.com/a2server/setup; source setup

When asked: ”Ready to set up A2SERVER?“ and ”Continue?“, answer ”y“. I answered the question ”Do you want to change the password for user “USER_NAME” to “apple2” now?“ with ”n“ to keep it private.

The installation takes about 30 minutes. Towards the end you are asked: ”Do you want to set up A2SERVER to be able to boot Apple II computers over the network?“ and ”Should Windows computers be able to connect to A2SERVER?
I answered ”n“ to the former and ”y“ to the latter. Opt for what you need. But please consider this WARNING!

You may need to press enter for ”USER_NAME@bananapi:~$“ to appear.

If you have answered ”y“ to whether Windows machines should be able to connect as well, you are next asked to enter your workgroup name. I left the standard and pressed enter.

Turn off Samba for now:

samba-stop


The above is an A2SERVER specific command. There are more of these commands to be found over here (referring to the most recent version of A2SERVER).22) That list is also displayed in Terminal via:

cat /usr/local/etc/a2server-help.txt

Use Page up to scroll to the beginning of the list.

These commands come in quite handy. However, ”showip“ will show the ip address of ”eth0“, which is the built-in ethernet interface. But in order to get AppleTalk going, we are using the USB Gigabit Ethernet adapter which is therefore recognized as default interface. So now we fix ”showip“ to display the IP address of the default network interface:

sudo sed -i "/showip='ifconfig/c\alias showip=\"ip -o -4 addr show | sed -e 's/[0-9]*: \\\([^ ]*\\\) *inet \\\([.0-9]*\\\).*$/\\\1 \\\2/' | grep \$(ip route show | grep ^default | cut -f 5 -d ' ') | cut -f 2 -d ' '\"" /usr/local/etc/a2server-aliases

A similar fix for ”showmac“:

sudo sed -i "/showmac='ifconfig/c\alias showmac=\"ifconfig \$(ip route show | grep ^default | cut -f 5 -d ' ') | grep 'HWaddr' | cut -dH -f2 | cut -c7-23\"" /usr/local/etc/a2server-aliases

These fixes are partly taken from a discussion at github.com on how to make the four ”show…“ entries more robust. For the time being the above should do.

Configuring AFP shares (via IP and DDP)

The BPi has one shared volume called “A2FILES”. However, if you do not access from an Apple ][ you should avoid this volume as it is only meant for use with an Apple ][.23) If you do not intend to access your Banana Pi from an Apple ][, I suggest to deactivate the A2FILES volume. Go back to Terminal and enter:

a2files-unshare

This will only make it unavailable for access via AFP.

Now we need at least one shared volume to connect to from a Mac for exchanging or storing files. Create one or more directories to be used as shared volumes:

mkdir /srv/A2SERVER/SHARED_VOLUME

Substitute ”SHARED_VOLUME“ by whatever you want to call the volume (lowercase is fine as well). Repeat this for every directory you want to create and note the names of these directories e.g., in a TextEdit file.

Stop AppleTalk:

netatalk-stop

Let's say you have three directories you want to share via AFP. Change into the first one, substituting ”SHARED_VOLUME1“ for the first name of the directories you have created and noted earlier:

cd /srv/A2SERVER/SHARED_VOLUME1

Append your directory to be shared as volume to the AFP volume configuration file:

sudo sed -i "$ a\\${PWD} ${PWD##*/} ea:ad" /etc/netatalk/AppleVolumes.default

Now change into the second directory:

cd ../SHARED_VOLUME2

Again enter the above entry beginning with ”sudo sed“ into Terminal.

Change to the third directory

cd ../SHARED_VOLUME3

and repeat again.

Check whether the shares were properly appended to AppleVolumes.default by entering:

sudo cat /etc/netatalk/AppleVolumes.default

In my case the last lines of the response look like this:

/srv/A2SERVER/music music ea:ad
/srv/A2SERVER/share share ea:ad
/srv/A2SERVER/software software ea:ad

For Netatalk to properly handle the newly shared volume(s), have it create .volinfo and AppleDouble files for them:

afpsync -v


We need to set Netatalk to use the USB-to-Ethernet adapter instead of the on-board Ethernet port. Since only the USB adapter has a network cable plugged in, it is recognized as the default interface. The following command changes ”eth0“ in the AppleTalk configuration file to the default interface, in our case ”eth1“:

sudo sed -i 's/^eth0/'"$(ip route show | grep ^default | cut -f 5 -d ' ')/" /etc/netatalk/atalkd.conf

Now start Netatalk again:

netatalk-start

Once Netatalk services are available again, you can check for any AppleTalk devices by entering

nbplkup

Terminal should return something like this:

                       bananapi:ProDOS16 Image                     1.19:3
                       bananapi:Apple //e Boot                     1.19:3
                       bananapi:Apple //gs                         1.19:3
                       bananapi:AFPServer                          1.19:129
                  192.168.151.1:IPGATEWAY                          1.19:72
                       bananapi:netatalk                           1.19:4
                       bananapi:Workstation                        1.19:4
            Asant?Talk 94B88903:Asant?Talk                         1.39:252
           LaserWriter 4/600 PS:LaserWriter                        1.40:128
USER_NAME@bananapi:~$

My printer and its LocalTalk-to-Ethernet bridge are recognized as ”LaserWriter 4/600 PS“ and ”AsantéTalk“. Everything else is provided by A2SERVER.

Now you should also be able to connect to the Banana Pi via AFP by clicking on the Apple server symbol in the sidebar of a Finder window. If your Banana Pi is not displayed there, connect to it by choosing “Network” from the “Go” menu (cmnd-K) and enter ”afp://IP_ADDRESS“ (you can check for the address again by typing ”showip“ in Terminal).

[OPTIONAL] Configuring Samba shares

WARNING: Due to the way Mac OS and OS X handle Samba shares, from these systems ONLY connect to your file server via AFP/AppleTalk. Otherwise file names might get truncated and resource forks saved as separate files … quite a mess!

I strongly recommend to only configure the AFP shared folders as Samba shares as well if you have to access them from, e.g., a Windows machine not capable of AppleTalk. However, that might result in OS X/Mac OS to sometimes also connect to A2SERVER via Samba, resulting in the consequences described above.

If you really need to share volumes via Samba, I recommend to protect them with a password so you don't accidentally log on to them from OS X or Mac OS. (You probably just need to leave out the line beginning with ”guest ok“ from the third entry underneath, but I haven't tested this.)

Before actually adding shares, if you have chosen to unshare the A2FILES directory as described earlier, this has only taken effect for AFP, not for Samba. So let's unshare it for Samba as well:

sudo sed -i "/\[A2FILES\]/,/    force user = $USER/ {s/^/#/}" /etc/samba/smb.conf

Let's say you have also three directories you want to share via Samba. Change into the first one:

cd /srv/A2SERVER/SHARED_VOLUME1

Copy-paste the following lines (all at once) into Terminal and press enter:

sudo sed -i "$ a\ \\
[${PWD##*/}]\\
    path = $PWD\\
    browsable = yes\\
    guest ok = yes\\
    read only = no\\
    create mask = 0666\\
    force user = $USER" /etc/samba/smb.conf

Now change into the second directory:

cd ../SHARED_VOLUME2

Again enter the above lines beginning with ”sudo sed“ into Terminal.

Change to the third directory

cd ../SHARED_VOLUME3

and repeat again.

Verify whether your shares have been added correctly:

sudo cat /etc/samba/smb.conf

Terminal should respond with something like this:

[SHARED_VOLUME1]
    path = /srv/A2SERVER/SHARED_VOLUME1
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0666
    force user = USER_NAME
 
[SHARED_VOLUME2]
    path = /srv/A2SERVER/SHARED_VOLUME2
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0666
    force user = USER_NAME
 
[SHARED_VOLUME3]
    path = /srv/A2SERVER/SHARED_VOLUME3
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0666
    force user = USER_NAME
USER_NAME@bananapi:~$

Now start Samba:

samba-start

4) [OPTIONAL] Set up the print server

CUPS configuration and PAP backend

In order to print to an AppleTalk printer from a modern network, we install a PAP backend and have CUPS share the printer.24) This guide describes how to do that for a PostScript printer.

Change to your home folder and download the archive containing the PAP backend25) there:

cd; sudo wget http://www.emaculation.com/pap_tkaiser_v0.1.4.tgz

Extract the downloaded archive:

tar -xvzf pap_tkaiser_v0.1.4.tgz

Move the PAP backend to the CUPS backend folder:

sudo mv ~/pap_tkaiser_v0.1.4/pap /usr/lib/cups/backend

Change the owner to root:

sudo chown root:root /usr/lib/cups/backend/pap

Remove the remaining folder with the license file:

rm -r pap_tkaiser_v0.1.4

In order to configure your printer in CUPS you need to add your user name to the lpadmin group:

sudo usermod -a -G lpadmin $USER

Then you enable printer sharing and remote administration:

sudo cupsctl --share-printers --remote-admin

Now amend the CUPS config file (copy-paste all lines at once into Terminal and press enter):

sudo sed -i '/BrowseLocalProtocols/c\
BrowseOrder allow,deny\
BrowseAllow all\
BrowseRemoteProtocols CUPS dnssd pap\
BrowseAddress @LOCAL\
BrowseLocalProtocols CUPS dnssd pap' /etc/cups/cupsd.conf

To prevent the spool folder at /var/spool/cups from growing endlessly, configure CUPS to delete print jobs once they have been handled:

sudo sed -i "/MaxLogSize/a PreserveJobHistory No" /etc/cups/cupsd.conf

You could also choose to keep the job files for a certain amount of time26).

Finally restart CUPS:

sudo /etc/init.d/cups restart

Share your AppleTalk printer to the network

It is time to switch on your printer.

You should now be able to access CUPS on the print server from within the internet browser of your local computer. Copy-paste this into Terminal:27)

echo http://$(showip):631/admin

The response will be a URL for accessing CUPS printer administration, e.g.: ”http://192.168.1.82:631/admin“. Copy that URL from Terminal and open it in your Internet browser in OS X.

In the browser, click on “Add Printer” (this is only to trigger the authentication dialog – you may have to do this twice until the auth dialog appears). Login with your username and password for the Banana Pi. Click on the “back” button of your browser and then on “Find New Printers”. After a moment your AppleTalk printer should appear among the available printers. Click on “Add This Printer” next to it. On the following page, you may amend name, description and location to your needs. Click on “Share This Printer” and “Continue”.

On the next page, do not choose a PPD file (you want OS X to handle that). Choose “Make: → Raw” and click on “Continue”. Then choose “Model: → Raw Queue (en)” and click on “Add Printer”. Now you are asked to set the default options for your printer. Just click on “Set Default Options”.

Printer setup on the Banana Pi is done.

Adding the printer to OS X

Add your printer via “Printers & Scanners” in the OS X System Preferences. Click on the ”+“ and choose “Add Printer or Scanner” from the menu. (Choosing “LaserWriter 4/600 PS @ bananapi” from the menu does not work at this point as there is no PPD assigned.) In the following window, choose “LaserWriter 4/600 PS @ bananapi” and choose “Other…” from the menu behind “Print Using:” (or just “Use:” depending on your OS X version). Navigate to your printer's PPD file on OS X and click “Open”, followed by “Add” when you're back at the former window.

It is also possible to have the Banana Pi manage the PPD. But I got empty pages when trying to print that way.28)



CREDITS

To continue what I have written at the very beginning of this guide: I had never actually worked with Linux or compiled anything before. It took me a few months to find out what I would need for a simple NAS with AppleTalk and to gather the required entries. There were many search results leading to many threads of different forums helping me find my way. Too many to keep track of them. A few are referred to in links or footnotes in this guide, though.

But as far as the hardware is concerned, thanks go to Kai Müller for the Banana Pi system, to “mactjaap” for identifying on-board Ethernet of the BPi as AppleTalk barrier, and to “Andy” for very valuable info on the Ethernet-to-USB adapter.

Software-wise thanks go to Ivan Drucker for his indispensable A2SERVER forming the core of the NAS, to Thomas Kaiser for the time on updating his PAP backend, to Igor Pecovnik for the support at the Armbian forum, and at emaculation.com to adespoton for his tip on backup via rsync (not covered here) and general insight and to ClockWise, Ronald P. Regensburg and Cat_7 for running/maintaining the site and their support in hosting this guide.

I hope I haven't forgotten anyone.

SDG

1)
Or buy a C.H.I.P., a USB-to-Ethernet adapter and power supply – a minimalistic system for a few bucks – compile a kernel for that and run A2SERVER on it.
2)
In this list I have mostly linked to the parts I bought.
3)
From a renowned supplier – don't buy a cheap one!
4)
The driver for the Banana Pi's on-board Ethernet port is unable to transport AppleTalk. See this link. There seems to be a fix for this, see here. But it has to be applied manually and I'm not sure whether it works for the Banana Pi yet.
5)
A 3.5“ HDD cannot be fed by the Banana Pi and would require its own power supply.
6)
In case you don't have those yet.
7)
Possibly using a LocalTalk-to-Ethernet bridge. You could have a look on, e.g., eBay for a used one or purchase a new AsantéTalk from Asante's website.
8)
See the official product specification.
9)
Look over at Thomas Jansson's blog to see how the printer is accessed from Windows. If it's a PostScript printer and you're on XP or newer, check over at Xerox for driver software. For XP and older you could use the Adobe Universal PostScript Windows Driver. I have not tested the first two links. But I have used the Adobe driver on XP for many years.
10)
If you use CUPS and Samba and you can't see the printer in Windows, have a look at this fix (scroll to the very bottom and see the second to last paragraph titled “Starting order Samba / Cups”).
11)
For some reason Adobe does not provide the Mac PPD for the Apple LaserWriter 4/600 PS anymore. Send me a PM if you need it. Also if you need it for Windows. It never existed for that system, but I have amended the LW 12/640 PS PPD for Win to work with the LW 4/600 PS.
12)
OpenSSH is needed so you can control the virtual machine from Terminal in OS X.
13)
Explanation of the entry: “KERNEL_ONLY=no”: We need a whole system, not just the kernel – “KERNEL_CONFIGURE=yes”: We need AppleTalk and therefore have to configure the kernel – “BUILD_DESKTOP=no”: We don't want a GUI (Graphical User Interface), as this would slow down the Banana Pi – “BOARD=bananapi”: The system needs to be compiled for the Banana Pi – “BRANCH=default”: Not sure what that means – “RELEASE=jessie”: We want Debian 8 “Jessie” as system.
14)
Not sure how to access a built-in reader from VirtualBox. See http://wiki.lemaker.org/BananaPro/Pi:Setting_up_the_bootable_SD_card for more information on the entries to use in Terminal.
18)
Theoretically you could attach a second HDD via USB.
19)
Based on this blog.
21)
If you want to know more about the installation process, see the setup script here. Or an outdated but more readable version of the script via archive.org (referring to old version of A2SERVER).
22)
There is also a list at http://ivanx.com/a2server/a2server_commands.html. As of writing this, it is referring to version 1.2.5 of A2SERVER, while current version is 1.5.
24)
If you want to do it the other way around – share a non-AppleTalk printer to a classic Macintosh computer or emulator, see https://www.reddit.com/r/VintageApple/comments/63xrvc/how_i_got_my_se30_to_print_to_a_cheapo_laser/ (thanks to adespoton). Or see this forum topic on how KnuddlMac did that.
25)
There are at least three other PAP backends available on the net (Duncan Gibb [based on Rupi]: download · instructions · info · Rupi's original [info] · archive with Rupi's backend and docu [next to other stuff] | Derrik Pates: download · description · setup 1 · setup 2 | SRZ Berlin: download and description), but the one from Thomas Kaiser is the most advanced and automated one. The original can be found here. To meet the development status of today's Linux systems, emaculation.com is hosting an updated version that is downloaded and installed with the following entries.
27)
This only works if you have fixed the A2SERVER commands as described here. Else the entry is: echo http://$(ip -o -4 addr show | sed -e 's/[0-9]*: \([^ ]*\) *inet \([.0-9]*\).*$/\1 \2/' | grep $(ip route show | grep ^default | cut -f 5 -d ' ') | cut -f 2 -d ' '):631/admin
28)
Next to that this only works for printers with PostScript Level 2 and up, see here.
appletalk_printserver_macos_and_osx.1544142758.txt.gz · Last modified: 2018/12/06 16:32