3
votes

This question has been asked before (RabbitMQ Failed to initialize erlang distribution), but I haven't been able to find out how to fix it from the existing answers. Following https://www.rabbitmq.com/man/rabbitmqctl.1.man.html, I'd like to run the rabbitmqctl status command to display information about the RabbitMQ broker. However, I get an error message:

kurt@kurt-ThinkPad:~$ rabbitmqctl status

Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, net_kernel, {'EXIT',nodistribution}}}, {child,undefined, net_sup_dynamic, {erl_distribution, start_link, [['rabbitmq-cli-13', shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}.

Only root or rabbitmq should run rabbitmqctl

If I run the command with sudo, I still get an error message:

kurt@kurt-ThinkPad:~$ sudo rabbitmqctl status

Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, net_kernel, {'EXIT',nodistribution}}}, {child,undefined, net_sup_dynamic, {erl_distribution, start_link, [['rabbitmq-cli-69', shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}.

How can I fix this?

2
Can you post more info! Are you working on debian or redhat based system? How can we reproduce the problem? Did you try to add rabbitmq to sudo group!!? Did you check if there is an undetached rabbitmq-server in the background?Dhia

2 Answers

8
votes

I also faced similar error when trying to enable the rabbitmq management plugin, $rabbitmq-plugins enable rabbitmq_management

Error: Failed to initialize erlang distribution: {{shutdown, {failed_to_start_child, auth, {"Error when reading ./.erlang.cookie: eacces",...}}.

It got solved when I ran with **sudo .**

6
votes

In fact I got the same error:

Only root or rabbitmq should run rabbitmqctl

when I wanted to run the following command:

rabbitmq-plugins enable rabbitmq_mqtt

I just ran it with sudo and it was resolved!

Try to restart the rabbitmq-server then try again with sudo:

sudo service rabbitmq-server restart