jed

jed

Hey all
I have a small elixir program compiled using Distillery 2.0 that I want to run whenever my computer boots up.
I figured it would be straight forward because it would just be running “./bin/app start” in a service, however I get the following error(s):

sudo journalctl -xe
>-- Subject: Unit zofi.service has finished start-up
>-- Defined-By: systemd
>-- Support: http://www.ubuntu.com/support
>-- 
>-- Unit zofi.service has finished starting up.
>-- 
>-- The start-up result is RESULT.
> Nov 28 15:51:51 jed-nuc7i3-04 zofi[900]: erlexec: HOME must be set
> Nov 28 15:51:51 jed-nuc7i3-04 zofi[900]: Unusable Erlang runtime system! This is likely due to being compiled for another system than the host is running
> Nov 28 15:51:51 jed-nuc7i3-04 systemd[1]: zofi.service: Main process exited, code=exited, status=1/FAILURE
> Nov 28 15:51:51 jed-nuc7i3-04 systemd[1]: zofi.service: Failed with result 'exit-code'.

-erlexec: HOME must be set
Not sure where to begin here since I haven’t seen references to ‘erlexec’ in the Distillery docs thus far.

-Unusable Erlang runtime system! This is likely due to being compiled for another system than the host is running

This is also a strange one because I’m deploying it on the same computer it was made.

Maybe I’m missing something obvious here. Any ideas?

Other Info:
OS: Ubuntu 18.04.1 LTS
Elixir 1.7.4 (compiled with Erlang/OTP 20)
Distillery version 2.0.12
rel/config.exs - Using defaults.
The service: https://pastebin.com/ZJHEikFt

Showing Posts 1 to 6

NobbZ

NobbZ

How are you as a developer managing your erlang and elixir version? Are you using those provided by apt or are you using kiex, kerl, asdf, or something similar?

If the latter, make sure you use the apt installed version when building the release or create an environment using the tools which is usable by systemd.

I’m not sure about HOME and erlexec though…

alco

alco

Make sure you have set include_erts: true in your release config, this may fix the second warning.

erlexec is Erlang’s underlying binary, it starts the whole system up when you run erl. Distillery’s docs recommend using foreground instead of start here, I’d try that.

UPDATE: Just to elaborate a bit on erlexec, for posterity:

$ which erl
/usr/bin/erl

$ ls -l /usr/bin/erl
lrwxrwxrwx 1 root root 22 Sep 28 19:37 /usr/bin/erl -> ../lib/erlang//bin/erl*

$ cat /usr/lib/erlang/bin/erl
#!/bin/sh

<snip>

ROOTDIR="/usr/lib/erlang"
BINDIR=$ROOTDIR/erts-10.1/bin

<snip>

exec "$BINDIR/erlexec" ${1+"$@"}
# This is the actual executable file that starts the Erlang system up
$ file /usr/lib/erlang/erts-10.1/bin/erlexec
/usr/lib/erlang/erts-10.1/bin/erlexec: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=870fd3e2d6d8ace6d2c09044bd3545659c0691a0, stripped
OvermindDL1

OvermindDL1

You should look at my PidFile - create and manage a PID file from the BEAM process thread, I have a systemd service description there that works well and I’ve been using for over a year now. You don’t need pid_file itself now as I think Distillery 2 baked in it’s functionality now, but check it’s docs to make sure (and to get the path to use). pid_file still works fine otherwise (I’m still using it). :slight_smile:

jed

jed OP

Thanks everyone.
Turns out I just needed to run mix release with MIX_ENV=prod to compile to a proper production version with set_include_erts set to true. When previously I was just including the flag --env=prod, thinking it was sufficient.

jed

jed OP

Cool project. I might check this out if my little project grows into into something non-trivial :slightly_smiling_face:

sahilpaudel

sahilpaudel

I did the same but still getting

/var/app/_build/prod/rel/afterglow/erts-10.3/bin/erlexec: 1: /var/app/_build/prod/rel/afterglow/erts-10.3/bin/erlexec: Syntax error: "(" unexpected
Unusable Erlang runtime system! This is likely due to being compiled for another system than the host is running
/var/app/_build/prod/rel/afterglow/erts-10.3/bin/erlexec: 1: /var/app/_build/prod/rel/afterglow/erts-10.3/bin/erlexec: Syntax error: "(" unexpected
Unusable Erlang runtime system! This is likely due to being compiled for another system than the host is running
/var/app/_build/prod/rel/afterglow/erts-10.3/bin/erlexec: 1: /var/app/_build/prod/rel/afterglow/erts-10.3/bin/erlexec: Syntax error: "(" unexpected
Unusable Erlang runtime system! This is likely due to being compiled for another system than the host is running
— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews