Installing erlang via asdf on Ubuntu fails after "Downloading kerl"

Background

I have a Ubuntu and I am trying to install erlang 22.2.8 via the asdf-erlang plugin.

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal

Problem

In fact, I want to install any version of erlang, but none works.

$ asdf install erlang 22.2.8
Downloading kerl...
$

It stops after “Downloading kerl” and then nothing happens. Its like it fnished.
I have followed the steps before-asdf-install also before installing the plugin, but non the less this does not prevent the error.

How can I fix this?

How much RAM do you have available? Sometime ago I had a similar problem when on 2GB VPS, needed to add a swapfile and it was resolved.

About 8 GB, give or take:

$ free -h
              total        used        free      shared  buff/cache   available
Mem:          7,8Gi       775Mi       6,2Gi        11Mi       796Mi       6,8Gi
Swap:         923Mi          0B       923Mi

I see, that shouldn’t be the issue then.
Does asdf list-all erlang work?
Does it try to download kerl each time you try to install a new version?

You can try to manually install it, it seems the kerl_path is .asdf/plugins/erlang/kerl

Maybe You can update asdf itself… it is just a guess :slight_smile:

I guess it works? Not sure what to make of the result though.

$ asdf list-all erlang
Downloading kerl...
chmod: cannot access '/home/user/.asdf/plugins/erlang/kerl': No such file or directory
/home/user/.asdf/plugins/erlang/bin/utils.sh: line 44: /home/user/.asdf/plugins/erlang/kerl: No such file or directory
/home/user/.asdf/plugins/erlang/bin/list-all: line 8: /home/user/.asdf/plugins/erlang/kerl: No such file or directory
$ 

To be clear, this is a fresh machine, with a fresh asdf installation and a fresh erlang-plugin install. No erlang versions are installed, all is fresh new.

yes.

I don’t know the values of kerl_paht nor $KERL_VERSION being passed to the script :S

Fresh install with the latest version of asdf 0.8.0

Please check exit code after you ran the asdf install command using echo $?.

Also you might try to use --verbose and similar flags, depending on what asdf actually provides and is supported by the plugin.

Same output:

$ echo $(asdf install erlang 22.2.8)
Downloading kerl...

$

Unfortunately, asdf does not have a verbose mode one can use …

Sorry, I do not see where you ran echo $? to print the last exit code…

Also check if the erlang plugin provides some environment variables that you could set to enable debugging output.

If everything else fails though, you might need to run in a bash with ex enabled…

My bad, here it is:

$ asdf install erlang 22.2.8
Downloading kerl...
$ echo $?
1

So it errors out (I think). Would be really helpful to see the actual error… but unfortunately I can’t find a way of doing it …

Exit code 1 is done by a lot of programs for any kind of failure. While at the same time, POSIX asks to use it only if there was a permission problem.

So please check permissions and ownership of /home/user/.asdf/plugins/erlang/kerl and parents.

That file does not exist:

$ ls /home/user/.asdf/plugins/erlang/
bin  kerl-home  LICENSE  README.md

What does this mean? The plugin was not installed correctly?
I have already removed and re-added the plugin, this error keeps happening.

kerl_path is /home/user/.asdf/plugins/erlang/kerl. I have ubuntu machine too and that’s the path I have it installed in. KERL_VERSION is 2.0.2

Try to manually install kerl 2.0.2 anywhere, I guess this is the culprit.
Try this:

curl -Lso ~/.asdf/plugins/erlang/kerl https://raw.githubusercontent.com/kerl/kerl/2.0.2/kerl
chmod +x ~/.asdf/plugins/erlang/kerl
~/.asdf/plugins/erlang/kerl version

If manually installing kerl as suggested by Adam does not work, please check ownership of the folder mentionend and its parents.

1 Like

When I execute the first command :smiley:

curl -Lso ~/.asdf/plugins/erlang/kerl https://raw.githubusercontent.com/kerl/kerl/2.0.2/kerl

Nothing happens.

If I try to access it on my browser, I get this:

I am assuming this does not happen to you?
I did install Ubuntu with the “minimal installation option”. Maybe I am missing some library or certificates?

Not sure what the browser has to do with this?

Do this and retry the installation command after:

chmod -R u+rwx ~/.asdf/

I am not sure if I messed up the asdf installation, or if this is now showing the real problem:

$ chmod -R u+rwx ~/.asdf/
$ asdf install erlang 22.2.8
/home/user/.asdf/lib/commands/command-install.bash: line 111: get_plugin_path: command not found
/home/user/.asdf/lib/commands/command-install.bash: line 112: check_if_plugin_exists: command not found
/home/user/.asdf/lib/commands/command-install.bash: line 147: get_install_path: command not found
/home/user/.asdf/lib/commands/command-install.bash: line 149: get_download_path: command not found
mkdir: cannot create directory ‘’: No such file or directory
/home/user/.asdf/lib/commands/command-install.bash: line 188: asdf_run_hook: command not found
/bin/install: /bin/install: cannot execute binary file

Add -v (verbose) to curl -Lsov and see why it fails. I guess you have a problem with certs. At least, it would explain why your browser complaints.
Could you run sudo apt-get install -y ca-certificates?

1 Like

There seems to be a certificate problem:

$ curl -v -Lso ~/.asdf/plugins/erlang/kerl https://raw.githubusercontent.com/kerl/kerl/2.0.2/kerl
*   Trying 151.101.16.133:443...
* TCP_NODELAY set
* Connected to raw.githubusercontent.com (151.101.16.133) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [6 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [3400 bytes data]
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
} [2 bytes data]
* SSL certificate problem: self signed certificate in certificate chain
* Closing connection 0

A missing library perhaps?

My system reports the chain as beeing valid and it downloads the installer…

Are you perhaps behind a proxy or otherwise in a network that you can not fully trust?

Also depending on your system, you might need to install additional packages to get the most recent CAs. For Ubuntu it is ca-certificates IIRC.