'Unable to install rabbitmq due to incorrect versions of erlang dependencies

I have erlang 21.3 installed:

$ erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell
"21"

But the rabbitmq installer does not think so:

sudo apt-get install -y rabbitmq-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 rabbitmq-server : Depends: erlang-base (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            erlang-base-hipe (>= 1:21.3) but it is not going to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-crypto (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-eldap (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-inets (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-mnesia (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-os-mon (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-parsetools (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-public-key (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-runtime-tools (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-ssl (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-syntax-tools (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-tools (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
                   Depends: erlang-xmerl (>= 1:21.3) but 1:20.2.2+dfsg-1ubuntu2 is to be installed or
                            esl-erlang (>= 1:21.3) but it is not installable
E: Unable to correct problems, you have held broken packages.

Note: the following question is similar - but for RedHat and the yum install instructions are not directly applicable for apt-get Installing RabbitMQ on Red Hat - wrong Erlang version

What needs to be done to fix this installation process? I am on ubuntu 18.0.4.



Solution 1:[1]

The following sequence of commands will install Erlang and RabbitMQ on Ubuntu 18, as documented here:

export DEBIAN_FRONTEND=noninteractive

apt-get update -y

apt-get install curl gnupg -y

curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | apt-key add -

apt-get install apt-transport-https

tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF
deb https://dl.bintray.com/rabbitmq-erlang/debian bionic erlang
deb https://dl.bintray.com/rabbitmq/debian bionic main
EOF

apt-get update -y

apt-get install rabbitmq-server -y --fix-missing

until lsof -i:5672; do echo "Waiting for RabbitMQ to start..."; sleep 1; done
rabbitmq-plugins enable rabbitmq_management

If you choose to install Erlang from source you're on your own and I suggest using the generic-unix RabbitMQ package.


NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Solution 2:[2]

I experienced similar issue while installing elixir. I believe the reason is an existing installation of erlang is blocking the installation of required versions of erlang offered by two different packages.

For me, installing esl-erlang along with elixir solved the issue, e.g., sudo apt-get install elixir esl-erlang. So, you might want to explicitly install the required version of erlang-base or esl-erlang.

Solution 3:[3]

Encountered similar scenario recently while installing rabbitmq. Installing erlang using PPA

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb

sudo apt-get update
sudo apt-get install erlang
sudo apt-get install esl-erlang

as described here worked for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luke Bakken
Solution 2 Venkatesh-Prasad Ranganath
Solution 3 dc7