'RabbitMQ error on startup - erlexec: HOME must be set

For some reason I cannot start RabbitMQ anymore after it crashed.

I am getting the following error: erlexec: HOME must be set

I've tried to export my home to /home/ubuntu but still getting the same error.

Any ideas?



Solution 1:[1]

I'm assuming that you are trying to start rabbitmq with something like service start rabbitmq-server. If so, the service command strips out environment variables. So you will need to either define it in your start up script or in a config file for your startup script (see https://unix.stackexchange.com/a/44378).

Additionally, I believe the rabbitmq home directory is actually /var/lib/rabbitmq/.

Solution 2:[2]

I have found suitable solution for myself. You can run epmd service before RabbitMQ server. This is fixing issue with HOME variable and others.

Solution 3:[3]

erlexec needs the environment variable HOME to be set in order to place a cookie (that contains a string). If HOME was for some reason unset in the environment that you are running rabbitmq (or rabbitmqctl) in, then you will get this error.

Try to check if HOME is defined by typing:

$ env

to get the list of defined environments. If it was not defined try to define it with

$ export HOME=/var/lib/rabbitmq

If you are using python3 and tox, note that tox by default does not pass current environment variable to the test environment. You will have to add the following to tox.ini

setdev = 
    HOME=/var/lib/rabbitmq

Just wanted to mention it because it gave me a headache the entire day today and I finally understood what was the issue and I though I should share this hint.

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 Community
Solution 2 Yevgen Taradayko
Solution 3 Ouss