- Boot into Arch Linux, e. g. from a USB flash installation media.
- Follow the installation instructions at https://archlinuxarm.org/platforms/armv6/raspberry-pi.
- Log in as
alarm
with default passwordalarm
(can be an ssh session, i. e.ssh alarm@<ip>
). - Switch to super user (default password
root
) and maybe change the password.
su
passwd
- Optional: Create a wifi profile using
wifi-menu
and then set it to auto-connect on boot withnetctl enable <profile-name>
(list profiles withls /etc/netctl
). - Change the hostname.
echo rpi-airprint > /etc/hostname
- Set timezone.
timedatectl set-timezone Europe/Berlin
- Init
pacman-key
and populate.
pacman-key --init
pacman-key --populate archlinuxarm
- Do a full system upgrade.
pacman -Syu
- Install some packages.
pacman -S ntp \ # network time protocol
avahi \ # "Bonjour", see https://www.avahi.org/
nss-mdns \ # resolve `.local` host names, see http://0pointer.de/lennart/projects/nss-mdns/#overview
usb-utils \ # for `lsusb`
cups \ # obviously
splix \ # this has drivers for a lot of printers, like the Samsung SCX series
ghostscript \ # tbh not sure whether this is required
gsfonts # maybe also not required
- Enable some services so that they auto-launch on boot.
systemctl enable dhcpcd
systemctl enable ntpd
systemctl enable avahi-daemon
systemctl enable cups.service
- Update current time.
ntpd -gq
- Configure
nss-mdns
by opening/etc/nsswitch.conf
and changing thehosts:
line to includemdns_minimal [NOTFOUND=return]
beforeresolve
anddns
(see https://wiki.archlinux.org/index.php/avahi#Hostname_resolution). - Reboot.
reboot now
- Now you can use the hostname to
ssh
into the Raspberry (at least if you're on macOS).
ssh [email protected]
- Connect the printer via USB and turn it on. You can check whether it's connected with
lsusb
. - Configure CUPS so that the web interface is accessible on the network (i. e. http://rpi-airprint.local:631) and all printers are shared.
cupsctl --remote-admin --remote-any --share-printers
- Add the printer to CUPS (see https://wiki.archlinux.org/index.php/CUPS).
lpinfo -v # list the devices => find the uri
lpinfo -m # list the models => find the driver
# create a new queue
lpadmin -p Samsung_SCX-4300 \ # queue name
-E \ # enable
-v usb://Samsung/SCX-4300%20Series?serial=1457BFGQ605469H.&interface=1 \ # uri
-m drv:///splix-samsung.drv/scx4300.ppd # model
- Optional: set as default printer and print test page.
lpoptions -d Samsung_SCX-4300
lpr /usr/share/cups/data/testprint
- Determine the printer type (enum) as hex.
ipptool -tv ipp://localhost:631/printers/Samsung_SCX-4300 get-printer-attributes.test \
| grep printer-type \ # gets us sth like `printer-type (enum) = 12356`
| tr -dc '0-9' \ # only take the digits
| xargs printf '0x%x\n' # convert to hex
- Create an Avahi service file, e. g.
/etc/avahi/services/samsung-scx-4300-airprint.service
with the following content.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Samsung SCX-4300 @ %h</name> <!-- replace with your printer name -->
<service>
<type>_ipp._tcp</type>
<subtype>_universal._sub._ipp._tcp</subtype>
<port>631</port>
<txt-record>txtvers=1</txt-record>
<txt-record>qtotal=1</txt-record>
<txt-record>Transparent=T</txt-record>
<txt-record>URF=none</txt-record>
<txt-record>rp=printers/Samsung_SCX-4300</txt-record> <!-- replace with your queue name -->
<txt-record>note=Office</txt-record> <!-- this shows up as "Location" -->
<txt-record>product=(GPL Ghostscript)</txt-record>
<txt-record>printer-state=3</txt-record> <!-- I think 3 means "idle" but not sure -->
<txt-record>printer-type=0x3044</txt-record> <!-- Whatever hex value the previous step printed -->
<txt-record>pdl=application/octet-stream,application/pdf,application/postscript,application/vnd.cups-raster,image/gif,image/jpeg,image/png,image/tiff,image/urf,text/html,text/plain,application/vnd.adobe-reader-postscript,application/vnd.cups-pdf</txt-record>
</service>
</service-group>
- Might need to
systemctl restart cups.service
oravahi-daemon
but it should all work now.
- https://wiki.archlinux.org/index.php/USB_flash_installation_media#In_macOS
- https://archlinuxarm.org/platforms/armv6/raspberry-pi
- https://wiki.archlinux.org/index.php/pacman
- https://wiki.archlinux.org/index.php/CUPS
- https://wiki.archlinux.org/index.php/avahi#Hostname_resolution
- https://www.avahi.org/
- http://0pointer.de/lennart/projects/nss-mdns/#overview
- https://raw.githubusercontent.com/tjfontaine/airprint-generate/master/airprint-generate.py
- https://www.cups.org/doc/man-ipptool.html
- https://askubuntu.com/a/532123