Failed to Create Cookie file RabbitMQ in Windows

24,510

Solution 1

Had the same H: problem. Set the home drive to some dir in the dos shell before executing the cli.

set HOMEDRIVE=C:/conf/rabbitmq :: Or your favorite dir 
rabbitmq-plugins.bat enable rabbitmq_management

Use a folder in C drive. The rabbitmq system will write the cookie file there.

Solution 2

Find location of ".erlang.cookie" in your PC and run the commands bellow:

set HOMEDRIVE=[location of ".erlang.cookie"]
rabbitmq-plugins.bat enable rabbitmq_management

Solution 3

There are cases when your HOMEDRIVE and HOMEPATH get overridden by group policy (active directory user) and than you'll need to set your HOMEDRIVE variable each time you want to start RabbitMQ service. In this case what you can do is:

  1. rabbitmq-service remove service

  2. edit rabbitmq-service.bat file:

    "!ERLANG_HOME!\bin\erl.exe" ^
        -pa "!RABBITMQ_EBIN_ROOT!" ^
        -boot !CLEAN_BOOT_FILE! ^
        -noinput -hidden ^
        -s rabbit_prelaunch ^
        -setcookie "C:\Users\userName\" ^ <<< this is a place of your cookie
        !RABBITMQ_NAME_TYPE! rabbitmqprelaunch!RANDOM!!TIME:~9!@localhost ^
        -conf_advanced "!RABBITMQ_ADVANCED_CONFIG_FILE!" ^
        ..."
    
  3. save the script

  4. set HOMEDRIVE=C:\Users\userName change homedrive before installing service

  5. rabbitmq-service install reinstall the service

now each time your reboot your service starts automatically and all paths are OK!

Solution 4

I solved the problem by following the steps below:

  1. Open the file: "Program Files/RabbitMQ Server/rabbitmq_server-/sbin/rabbitmq-env"

  2. At the end of the file, append the line:

    REM Environment cleanup
    set BOOT_MODULE=
    set CONFIG_FILE=
    set FEATURE_FLAGS_FILE=
    set ENABLED_PLUGINS_FILE=
    set LOG_BASE=
    set MNESIA_BASE=
    set PLUGINS_DIR=
    set SCRIPT_DIR=
    set SCRIPT_NAME=
    set TDP0=
    set HOMEDRIVE=C: <<< the new path of the .erlang.cookie
    
    
  3. Open the RabbitMQ console

  4. write:

    4.1. rabbitmq-service stop
    4.2. rabbitmq-service remove
    4.3. rabbitmq-service install
    4.4. rabbitmq-service start

Solution 5

While this may seem totally obvious, you do need to run cmd "as administrator" - I was getting the above error until I remedied that. :-)

Share:
24,510
user636525
Author by

user636525

Updated on October 13, 2021

Comments

  • user636525
    user636525 over 2 years

    I am trying to run the following command

    rabbitmq-plugins.bat enable rabbitmq_management  
    

    and its giving me an error like this:

    11:36:55.464 [error] Failed to create cookie file 'h:/.erlang.cookie': enoent

    I am using windows 7, Erlang Version R16B01 and RabbitMQ-Server version 3.1.5

    I am using my work PC and our Corporate policy sets the HOMEDRIVE to h: and HOMEPATH to / and i dont think they will let me change this.

    I can see the .erlang.cookie file under C:\Windows.

    Could someone let me know of a workaround for this ?

    Thanks in advance !