'Failed to Create Cookie file RabbitMQ in Windows
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 !
Solution 1:[1]
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 2:[2]
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:
rabbitmq-service removeserviceedit 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!" ^ ..."save the script
set HOMEDRIVE=C:\Users\userNamechange homedrive before installing servicerabbitmq-service installreinstall the service
now each time your reboot your service starts automatically and all paths are OK!
Solution 3:[3]
I solved the problem by following the steps below:
Open the file: "Program Files/RabbitMQ Server/rabbitmq_server-/sbin/rabbitmq-env"
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.cookieOpen the RabbitMQ console
write:
4.1.
rabbitmq-service stop
4.2.rabbitmq-service remove
4.3.rabbitmq-service install
4.4.rabbitmq-service start
Solution 4:[4]
While this may seem totally obvious, you do need to run cmd "as administrator" - I was getting the above error until I remedied that. :-)
Solution 5:[5]
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.
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 | |
| Solution 2 | Dave |
| Solution 3 | |
| Solution 4 | seancon |
| Solution 5 | spryce |
