Problems with mobilizon installation on Ubuntu 22.04

I tried to install a precompiled mobilizon release on Ubuntu 22.04 (i.e. Jellyfish) LTS, but it failed:

chriger@server:/opt/mobilizon$ sudo -u mobilizon ./bin/mobilizon_ctl instance gen --output /etc/mobilizon/config.exs --output-psql /tmp/setup_db.psql
!!! /etc/mobilizon/config.exs not found! Please ensure it exists and that MOBILIZON_CONFIG_PATH is unset or points to an existing file
What domain will your instance use? (e.g mobilizon.org) [] 192.168.0.204
What is the name of your instance? (e.g. Mobilizon) [] Mobilizon
What’s the address email will be send with? [noreply@192.168.0.204] webmaster@gerstenmayer.net
What is the hostname of your database? [localhost] localhost
What is the name of your database? [mobilizon_prod] mobilizon_prod
What is the user used to connect to your database? [mobilizon] mobilizon
12:39:34.434 [error] Unable to load crypto library. Failed with error:
« :load_failed, Failed to load NIF library /opt/mobilizon/lib/crypto-5.0.6/priv/lib/crypto: ‹ libcrypto.so.1.1: cannot open shared object file: No such file or directory › »
OpenSSL might not be installed on this system.

12:39:34.482 [warning] The on_load function for module crypto returned:
{:error,
{:load_failed,
‹ Failed to load NIF library /opt/mobilizon/lib/crypto-5.0.6/priv/lib/crypto: ‹ libcrypto.so.1.1: cannot open shared object file: No such file or directory › ›}}

** (UndefinedFunctionError) function :crypto.strong_rand_bytes/1 is undefined (module :crypto is not available)
:crypto.strong_rand_bytes(64)
(mobilizon 2.1.0) lib/mix/tasks/mobilizon/instance.ex:124: Mix.Tasks.Mobilizon.Instance.run/1
(stdlib 3.17.1) erl_eval.erl:685: :erl_eval.do_apply/6
(elixir 1.13.4) lib/code.ex:404: Code.validated_eval_string/3

Ubuntu Jellyfish is adding OpenSSL 3.0.2 by default on installation. It is located on /usr/lib/ssl.

I also tried to remove OpenSSL 3.0.2 and installed 1.1.1m, but then I get errors when installing postgresql.

Is there a way to install mobilizon with OpenSSL 3.0.2?

Please help.
Kind regards
Christine Gerstenmayer
Computer Cat e.U.

Hi,

Indeed, there’s issues with the openssl version Mobilizon is compiled against and the openssl version on your system really differ.

I had written a few thoughts here a while ago (a similar issue happens when the host system’s openssl version doesn’t have the same features as the one Mobilizon is build against):

However the solution mentionned isn’t really easily doable (would need a lot of toolchain compiling).

Ubuntu 22.04 doesn’t seem to support installing both openssl 3.0 and openssl 1.1 at the same time, so you’re blocked here, apart from building openssl yourself.
Otherwise, the simplest way would be to build Mobilizon from source:
https://docs.joinmobilizon.org/administration/install/source/

We tried to have a look to build specific packages for all the systems we wanted to support for Mobilizon version 2.1, but it’s not really worth it until we can build proper packages (.deb, .rpm, …) instead of just binaries.

Installing Mobilizon through Docker is of course another possibility.

Hi,
Ok, I tried to install from Source, but installation of NodeSource already failed:

Fehl:6 Index of debian jammy Release
** 404 Not Found [IP: 13.32.110.6 80]**
Reading package lists… Done
E: The repository xxxx does not have a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting
chriger@server:~$

I googled this error message and found that this problem occurred first with Ubuntu 21.04 and still is not solved by erlang-solutions. So install from source also is not possible on Ubuntu 22.04.

But I think there also is an error in release install procedure:

First there is this error message:

!!! /etc/mobilizon/config.exs not found! Please ensure it exists and that MOBILIZON_CONFIG_PATH is unset or points to an existing file

I searched this file over all directories - it is not present.

I found a file name libcrypto.so.1.1. in 2 snap-directories :
chriger@server:/opt/mobilizon/lib$ sudo find / -iname ‹ libcrypto* ›
/snap/core20/1494/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
/snap/core20/1405/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
/usr/lib/x86_64-linux-gnu/libcrypto.so.3

I added one of these directories both to PATH and to environment, but still no success, the same error occurs:
chriger@server:/opt/mobilizon/lib$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
chriger@server:/opt/mobilizon/lib$ export PATH=$PATH:/snap/core20/1494/usr/lib/x86_64-linux-gnu
chriger@server:/opt/mobilizon$ sudo vi /etc/environment
chriger@server:/opt/mobilizon$ source /etc/environment

Finally I will try to install Docker and install your Docker image but I am afraid that there will be problems too.

I will report my results.
Kind regards
Christine

Hi,
I decided to leave Ubuntu installation, it seems that mobilizon is not installable on Ubuntu Jellyfish.
Now I tried to install precompiled version to Debian Bullseye.
Seems to be the better solution, because there is a pre-installed OpenSSL 1.1.1n.
PostgreSQL and Postgis installations were successful without errors.

At migration step I had some errors:
12:40:57.639 [error] Task #PID<0.673.0> started from Mobilizon.Supervisor terminating
** (Postgrex.Error) FEHLER 42P01 (undefined_table) Relation »admin_settings« does not exist

query: SELECT a0."id", a0."group", a0."name", a0."value", a0."inserted_at", a0."updated_at" FROM "admin_settings" AS a0 WHERE ((a0."group" = $1) AND (a0."name" = $2))
(ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:847: Ecto.Adapters.SQL.execute/6
(ecto 3.8.3) lib/ecto/repo/queryable.ex:221: Ecto.Repo.Queryable.execute/4
(ecto 3.8.3) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
(ecto 3.8.3) lib/ecto/repo/queryable.ex:147: Ecto.Repo.Queryable.one/3
(mobilizon 2.1.0) lib/mobilizon/admin/admin.ex:85: Mobilizon.Admin.get_admin_setting_value/3
(mobilizon 2.1.0) lib/web/views/error_view.ex:69: Mobilizon.Web.ErrorView.render/2
(phoenix_view 1.1.2) lib/phoenix/view.ex:475: Phoenix.View.render_to_iodata/3

Function: &Mobilizon.Service.ErrorPage.init/0
Args: []
12:41:02.329 [error] Task #PID<0.671.0> started from Mobilizon.Supervisor terminating
** (Postgrex.Error) FEHLER 42P01 (undefined_table) Relation »actors« does not exist

query: SELECT a0."id", a0."url", a0."outbox_url", a0."inbox_url", a0."following_url", a0."followers_url", a0."shared_inbox_url", a0."members_url", a0."resources_url", a0."posts_url", a0."events_url", a0."todos_url", a0."discussions_url", a0."type", a0."name", a0."domain", a0."summary", a0."preferred_username", a0."keys", a0."manually_approves_followers", a0."openness", a0."visibility", a0."suspended", a0."last_refreshed_at", a0."avatar", a0."banner", a0."user_id", a0."physical_address_id", a0."inserted_at", a0."updated_at" FROM "actors" AS a0 WHERE (a0."url" = $1)
(ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:847: Ecto.Adapters.SQL.execute/6
(ecto 3.8.3) lib/ecto/repo/queryable.ex:221: Ecto.Repo.Queryable.execute/4
(ecto 3.8.3) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
(ecto 3.8.3) lib/ecto/repo/queryable.ex:147: Ecto.Repo.Queryable.one/3
(mobilizon 2.1.0) lib/mobilizon/actors/actors.ex:115: Mobilizon.Actors.get_actor_by_url/2
(mobilizon 2.1.0) lib/mobilizon/actors/actors.ex:979: Mobilizon.Actors.get_or_create_internal_actor/1
(mobilizon 2.1.0) lib/federation/activity_pub/relay.ex:31: Mobilizon.Federation.ActivityPub.Relay.get_actor/0

Function: &Mobilizon.Federation.ActivityPub.Relay.init/0
Args: []

And I got this error when doing this instruction:

sudo journalctl -fu mobilizon.service

ai 26 12:42:35 server mobilizon[10845]: 12:42:35.682 [info] Source for database :city not found: « /var/lib/mobilizon/geo/GeoLite2-City.mmdb »

Mai 26 12:42:35 server mobilizon[10845]: 12:42:35.781 [info] Running Mobilizon.Web.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
Mai 26 12:42:35 server mobilizon[10845]: 12:42:35.805 [info] Access Mobilizon.Web.Endpoint at https://192.168.0.204

I think this will lead to errors with Geo functions!

And the last question:
I am trying this on a server at home with no domain and certificate. I want to call Mobilizon with 192.168.0.xxx:a.
Is it possible to do so? If yes, what do I have to configure in mobilizon.conf?

Pleas help.
Thanks in advance.
Kind regards
Christine

Thanks for reporting these issues !

It seems the server is incorrectly started during migrations. Not an issue, but generates lots of output. Tracking this in the following issue :

Currently this is not being used but it will be in the future, yes. See the docs to install such a database.

It should, yes, if you edit the Mobilizon config file like this:

config :mobilizon, Mobilizon.Web.Endpoint,
  http: [
    port: 8080 # Server will run on this port
  ],
  url: [
    host: "192.168.0.xxx:a",
    port: 8080,
    scheme: "http" # Make sure URLs are generated without https
  ]

If you’re started the server already with previous settings, you need to TRUNCATE the actors table in the database as it may have been populated with internal actors needed for Mobilizon federation to work, but with wrong domain information.

So, I had some troubles in June and July and in August I was on holiday. Now I am back and tried it again with Ubuntu focal.
Worked better, but here also I had some errors:

chriger@server:/opt/mobilizon$ sudo -u mobilizon ./bin/mobilizon_ctl migrate
18:41:17.872 [error] Task #PID<0.672.0> started from Mobilizon.Supervisor terminating
** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "admin_settings" does not exist

    query: SELECT a0."id", a0."group", a0."name", a0."value", a0."inserted_at", a0."updated_at" FROM "admin_settings" AS a0 WHERE ((a0."group" = $1) AND (a0."name" = $2))
    (ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:847: Ecto.Adapters.SQL.execute/6
    (ecto 3.8.3) lib/ecto/repo/queryable.ex:221: Ecto.Repo.Queryable.execute/4
    (ecto 3.8.3) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
    (ecto 3.8.3) lib/ecto/repo/queryable.ex:147: Ecto.Repo.Queryable.one/3
    (mobilizon 2.1.0) lib/mobilizon/admin/admin.ex:85: Mobilizon.Admin.get_admin_setting_value/3
    (mobilizon 2.1.0) lib/web/views/error_view.ex:69: Mobilizon.Web.ErrorView.render/2
    (phoenix_view 1.1.2) lib/phoenix/view.ex:475: Phoenix.View.render_to_iodata/3
Function: &Mobilizon.Service.ErrorPage.init/0
    Args: []
18:41:22.668 [error] Task #PID<0.670.0> started from Mobilizon.Supervisor terminating
** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "actors" does not exist

    query: SELECT a0."id", a0."url", a0."outbox_url", a0."inbox_url", a0."following_url", a0."followers_url", a0."shared_inbox_url", a0."members_url", a0."resources_url", a0."posts_url", a0."events_url", a0."todos_url", a0."discussions_url", a0."type", a0."name", a0."domain", a0."summary", a0."preferred_username", a0."keys", a0."manually_approves_followers", a0."openness", a0."visibility", a0."suspended", a0."last_refreshed_at", a0."avatar", a0."banner", a0."user_id", a0."physical_address_id", a0."inserted_at", a0."updated_at" FROM "actors" AS a0 WHERE (a0."url" = $1)
    (ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto_sql 3.8.1) lib/ecto/adapters/sql.ex:847: Ecto.Adapters.SQL.execute/6
    (ecto 3.8.3) lib/ecto/repo/queryable.ex:221: Ecto.Repo.Queryable.execute/4
    (ecto 3.8.3) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
    (ecto 3.8.3) lib/ecto/repo/queryable.ex:147: Ecto.Repo.Queryable.one/3
    (mobilizon 2.1.0) lib/mobilizon/actors/actors.ex:115: Mobilizon.Actors.get_actor_by_url/2
    (mobilizon 2.1.0) lib/mobilizon/actors/actors.ex:979: Mobilizon.Actors.get_or_create_internal_actor/1
    (mobilizon 2.1.0) lib/federation/activity_pub/relay.ex:31: Mobilizon.Federation.ActivityPub.Relay.get_actor/0
Function: &Mobilizon.Federation.ActivityPub.Relay.init/0
    Args: []

I ignored it and continued installation.
On mobilizon.conf in /etc/nginx/available-sites I deleted all https settings and only set http settings since this is only a test server and I did not want to create certificates etc:

# default nginx site config for Mobilizon
#
# Simple installation instructions:
# 1. Install your TLS certificate, possibly using Let's Encrypt.
# 2. Replace 'example.tld' with your instance's domain wherever it appears.
# 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it
#    in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx.

server {
    server_name    192.168.0.204;

    listen         80;
    listen         [::]:80;

    # Remove once HTTPS is setup
    location ^~ '/.well-known/acme-challenge' {
        root /var/www/certbot;
        default_type "text/plain";
    }

    # Uncomment once HTTPS is setup
    # return         301 https://$server_name$request_uri;
}

Then nginx could be started correctly.

chriger@server:/opt/mobilizon$ sudo systemctl enable --now mobilizon.service
Created symlink /etc/systemd/system/multi-user.target.wants/mobilizon.service → /etc/systemd/system/mobilizon.service.
chriger@server:/opt/mobilizon$ sudo journalctl -fu mobilizon.service
-- Logs begin at Sun 2022-07-10 18:51:05 UTC. --
Aug 15 18:42:20 server systemd[1]: Started Mobilizon Service.
Aug 15 18:42:26 server mobilizon[31937]: 18:42:26.840 [info] Source for database :city not found: "/var/lib/mobilizon/geo/GeoLite2-City.mmdb"
Aug 15 18:42:26 server mobilizon[31937]: 18:42:26.907 [info] Running Mobilizon.Web.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
Aug 15 18:42:26 server mobilizon[31937]: 18:42:26.908 [info] Access Mobilizon.Web.Endpoint at https://192.168.0.204
^C
chriger@server:/opt/mobilizon$ sudo cp support/nginx/mobilizon-release.conf /etc/nginx/sites-available/mobilizon.conf
chriger@server:/opt/mobilizon$ sudo ln -s /etc/nginx/sites-available/mobilizon.conf /etc/nginx/sites-enabled/
chriger@server:/opt/mobilizon$ cd /etc/nginx/sites-available/
chriger@server:/etc/nginx/sites-available$ vi mobilizon.conf
chriger@server:/etc/nginx/sites-available$ sudo vi mobilizon.conf
chriger@server:/etc/nginx/sites-available$ sudo nginx -t
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/mobilizon.conf:25
nginx: configuration file /etc/nginx/nginx.conf test failed
chriger@server:/etc/nginx/sites-available$ sudo vi mobilizon.conf
chriger@server:/etc/nginx/sites-available$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
chriger@server:/etc/nginx/sites-available$ sudo systemctl reload nginx

When I am calling mobilizon with http://192.168.0.204/Mobilzon I get a HTTP error 404. When testing http://192.168.0.204:4000/Mobilizon (nginx) I get a connection error.

Starting mobilizon service produced this log:

Aug 15 18:42:20 server systemd[1]: Started Mobilizon Service.
Aug 15 18:42:26 server mobilizon[31937]: 18:42:26.840 [info] Source for database :city not found: "/var/lib/mobilizon/geo/GeoLite2-City.mmdb"
Aug 15 18:42:26 server mobilizon[31937]: 18:42:26.907 [info] Running Mobilizon.Web.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
Aug 15 18:42:26 server mobilizon[31937]: 18:42:26.908 [info] Access Mobilizon.Web.Endpoint at https://192.168.0.204

How I am able to configure mobilizon to run on http only?

Please help.
Thanks in advance.
Christine Gerstenmayer
Computer Cat e.U.