Pleroma on the PYNQ Z1

Wim Vanderbauwhede edited this page May 16, 2018 · 6 revisions

Pleroma on PYNQ-Z1

The PYNQ-Z1 is a board with a Xilinx Zynq chip, an FPGA-based System-on-Chip with a 650MHz dual-core Cortex-A9 and 512MB RAM.

PYNQ-Z1 board

This system does not have enough memory to run Mastodon but enough to run Pleroma. Please read my other guide, Mastodon and Pleroma on the Raspberry Pi 3 first for links and details on installing Pleroma.

The system runs Ubuntu 15.10 "Wily" for arm64. This is alas not an LTS release, its End of Life was July 28, 2016. Cue lots of problems ...

In the end I got what I needed by combining wily, wily-updates with jessie-backports. TIL: Ubuntu Wily and Debian Jessie are basically the same.

Accessing PYNQ over Ethernet

  • The Ethernet device of the board has a fixed IP address 192.168.2.10. There is no WiFi.

Accounts:

The default account is xilinx, password xilinx, but I disabled SSH access for that one and created a separate development account wim and an account pleroma.

Distro Problems

The problem is that the Ubuntu release shipped with the board (15.10 'Wily') is no longer in the standard apt-get repo as it is too old. I eventually figured out that the file /etc/apt/sources.list.d/multistrap-wily.list should look like the following:

deb [arch=armhf] http://old-releases.ubuntu.com/ubuntu wily universe main
deb-src http://old-releases.ubuntu.com/ubuntu wily universe main
deb [arch=armhf] http://old-releases.ubuntu.com/ubuntu wily-updates universe main
deb-src http://old-releases.ubuntu.com/ubuntu wily-updates universe main

Furthermore, as detailed below, you also need /etc/apt/sources.list.d/erlang-solutions.list:

deb http://packages.erlang-solutions.com/debian jessie contrib

And also the Jessie backports as /etc/apt/sources.list.d/postgres-jessie-backport.list:

deb http://ftp.uk.debian.org/debian jessie-backports main

Make sure to run apt-get update before installing any package. In principle, this should solve all your distro problems; if not, read on.

Git Cert problem!

Problem: missing CAcert root certificate.

Solution from here -- but DON'T DO THIS, IT'S A RED HERRING!

  • Create a directory in which to store the CAcert certificate files.
    sudo mkdir /usr/local/share/ca-certificates/cacert.org
  • Download the root certificates from the cacert website.
    sudo wget -P /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt
  • Update the certificate bundle
    sudo update-ca-certificates
    git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt

But the actual reason for the problem was ...

Date not set correctly!

  • Setting the date:

    timedatectl set-ntp false
    timedatectl set-time 14:55:00
    timedatectl set-time 2017-12-12
    timedatectl set-ntp true
    timedatectl status
  • Still not OK, could not restart the sync service. Conflict with ntpd. Solution:

    apt purge ntp
    systemctl start systemd-timesyncd
    systemctl status systemd-timesyncd
    systemctl list-unit-files | grep sync
  • Finally OK!

Elixir is too old!

apt-get install update-manager-core

=> No good!

So I tried by adding Debian Jessie packages for erlang and elixir, as /etc/apt/sources.list.d/erlang-solutions.list:

deb http://packages.erlang-solutions.com/debian jessie contrib

Onwards:

apt install elixir

=> That seems to have worked.

But then some mix build failed!

apt install erlang-dev 

=> still not OK

apt install erlang-parsetools

=> OK, all seemed well

But in the end we were still missing something:

apt install erlang-xmerl

=> And then it works!

PostgreSQL woes!

Creating the PostgreSQL database for Pleroma:

su postgres -c psql
CREATE USER pleroma;
CREATE DATABASE pleroma_dev;
ALTER user pleroma with encrypted password 'pleroma';
ALTER USER pleroma WITH SUPERUSER;
GRANT ALL ON ALL tables IN SCHEMA public TO pleroma;
GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma;
CREATE EXTENSION citext;

Then run the script generated by the build, it basically changes the password

mix ecto.migrate
mix phx.server
  • So now I get a database syntax error. So I tried a clean slate: delete user & db, fresh cloned repo. No joy. Turns out I need a more recent postgresql than the one in Wily.
  • Tried do-release-upgrade, FAIL.
  • Finally after much trouble installed postgresql-9.6 from https://packages.debian.org/jessie-backports/armhf/database/postgresql-9.6 using dpkg -i to install the .deb files. I forgot but I guess I might have needed apt-get install -f afterwards.
libpq5_9.6.5-0+deb9u1~bpo8+1_armhf.deb
postgresql-9.6_9.6.5-0+deb9u1~bpo8+1_armhf.deb
postgresql-client-9.6_9.6.5-0+deb9u1~bpo8+1_armhf.deb
postgresql-client-common_181~bpo8+1_all.deb
postgresql-common_181~bpo8+1_all.deb
postgresql-contrib-9.6_9.6.5-0+deb9u1~bpo8+1_armhf.deb
sysstat_11.0.1-1_armhf.deb

I added the Jessie backports as /etc/apt/sources.list.d/postgres-jessie-backport.list:

deb http://ftp.uk.debian.org/debian jessie-backports main
  • And now it works!

Saving memory

By default the PYNQ runs Samba for file sharing and Jupyter Notebooks. These us a lot of memory, so I killed them.

systemctl stop smb*
killall python3.6 or use kill -9 PID

As far as I can tell Pleroma uses only about 50MB, the rest is mainly PostgreSQL.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.