32

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 !

themefield
  • 3,847
  • 30
  • 32
user636525
  • 3,180
  • 9
  • 38
  • 51
  • 1
    you could cheat and copy the cookie file over to your home dir. Just the content is relevant ;) – ZeissS Aug 30 '13 at 12:51
  • Thanks ! will try that .for now the H:drive is not accessible to me, not sure why some corporate policies give us inaccessible home drives :) – user636525 Aug 31 '13 at 13:38

7 Answers7

46

Set the home drive to some dir in the dos shell before executing the cli.

E.g start-rabbit.bat

set HOMEDRIVE=C:/conf/rabbitmq :: Or your favorite dir 

rabbitmq-plugins.bat enable rabbitmq_management

E.g Use a folder in C drive c:/conf/rabbitmq. The rabbitmq system will write the cookie file there.

Espresso
  • 5,378
  • 4
  • 35
  • 66
10

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

francisco gomes
  • 381
  • 1
  • 3
  • 8
7

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
Nhan Phan
  • 1,262
  • 1
  • 14
  • 32
5

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!

Dave
  • 10,748
  • 3
  • 43
  • 54
Coderbit
  • 701
  • 3
  • 9
  • 31
2

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

seancon
  • 63
  • 1
  • 8
0

We had the same issue where group policies have set HOMEDRIVE to h: and HOMEPATH to /.

None of the other solutions here worked (even though we have seen that modifying the sys vars did work for us in a different environment).

Today we solved this by creating a new local Administrator account and installing from there.

spryce
  • 616
  • 7
  • 14
0

I got the same error for Z:/ drive which didn't exist on my system. On checking %HOMEDRIVE%, it was mapped to Z:/.

The solution that worked for me was to execute below commands in CMD/Powershell(Admin mode).

  1. mkdir c:/home
  2. net use z: /delete <<--- This might fail as drive z:/ doesn't exist. Just ignore it.
  3. subst z: c:/home
Praveen Raghuvanshi
  • 709
  • 1
  • 5
  • 11