How to permanently set "HOME" without changing HOMEDRIVE environment variable

1,139 views
Skip to first unread message

Matt O

unread,
Sep 13, 2019, 11:11:18 AM9/13/19
to rabbitmq-users
Hi,


The issue is that rabbitmq (or apparently erlang uses HOMEDRIVE for purposes unbeknownst to the end user).

Is there an erlang config file somewhere I can set to make it stop using HOMEDRIVE environment variable?

Thanks!

Matt O

unread,
Sep 13, 2019, 11:13:09 AM9/13/19
to rabbitmq-users
Ideally there should be "ERLANGHOME" variable I can set and it will use that instead if it exists?

Matt O

unread,
Sep 13, 2019, 11:37:23 AM9/13/19
to rabbitmq-users
They locked the original github posting so I can no longer make a comment. Here is what I was going to comment:

HOMEDRIVE is reasonable to use if they have no other choice (AppData would probably have been a better choice however).

What should happen is it should follow this:

IF (ERLANGHOME exists) then 
   use ERLANGHOME variable
else 
  use HOMEDRIVE variable as fallback
end if

Does using a different variable if it exists available?

You must remember, in corporate environments HOMEDRIVE is often set via group policy and is set upon login to the work station. So it's not a safe one to use.

Look at the OneDrive application, it also uses it's own environment variables (OneDrive=C:\somewhere)

Matt O

unread,
Sep 13, 2019, 11:57:53 AM9/13/19
to rabbitm...@googlegroups.com
Looks like a simple fix could be made by making the get_home function a bit smarter to use it's own variable FIRST, and home drive second:


This would stop all the crazy work arounds in corporate environments that you see on stackoverflow. 

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/b4fa2338-12c1-4947-bb57-159146b1382a%40googlegroups.com.

Luke Bakken

unread,
Sep 13, 2019, 12:06:20 PM9/13/19
to rabbitmq-users
Hi Matt,

I locked the GitHub issue because it is the policy of our team to not clutter up GitHub with discussions. That's why this mailing list exists.

When you install RabbitMQ, it will run as the SYSTEM account. By default, the home directory for this account is:

C:\Windows\System32\config\systemprofile

If you look there after installing RabbitMQ, you will see a .erlang.cookie file. This is the cookie file that RabbitMQ will use. This is what you need to copy to the home directory of any user that needs to run rabbitmqctl.bat or other commands that communicate with RabbitMQ.

If you'd like to use a different home location for this file, you can set HOMEDRIVE / HOMEPATH in the shell process that you will use to run rabbitmqctl.bat, and the other location will be used to find the cookie file.

RabbitMQ will always use the Erlang cookie file from the SYSTEM account's home directory that I mention above.

Again, this is due to how Erlang works on Windows. If you'd like to suggest changes to how Erlang behaves on win32, these are the appropriate channels:

* Start a discussion on the erlang-questions mailing list - http://erlang.org/mailman/listinfo/erlang-questions

* Open a pull request implementing your changes - https://github.com/erlang/otp

Thanks,
Luke

Matt Olson

unread,
Sep 13, 2019, 12:44:40 PM9/13/19
to rabbitm...@googlegroups.com
Thanks!

I have already posted a suggest enhancement to the erlang forum

Matt
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

Luke Bakken

unread,
Sep 13, 2019, 1:33:01 PM9/13/19
to rabbitmq-users
Hi Matt,

Yep, I saw that.

In addition to overriding HOMEDRIVE / HOMEPATH in the current cmd.exe environment, you can set your own cookie via environment variables, bypassing the file entirely. Log in using the same administrative account you used to install RabbitMQ , and create the %AppData%\RabbitMQ\rabbitmq-env-conf.bat file with the following contents:

set SERVER_ADDITIONAL_ERL_ARGS=-setcookie TEST12345678
set CTL_ERL_ARGS=-setcookie TEST12345678

Then, open the "RabbitMQ Command Prompt (sbin dir)" start menu item and run these commands:

.\rabbitmq-service.bat stop
.\rabbitmq-service.bat remove
.\rabbitmq-service.bat install
.\rabbitmq-service.bat start

If you check the arguments to erl.exe via task manager, you should see -setcookie TEST12345678 among them. If you change the values in rabbitmq-env-conf.bat you must remove and re-install the RabbitMQ windows service using the steps above.

If you log in using the same account to run rabbitmqctl.bat, it will also "source" the rabbitmq-env-conf.bat file and pick up those environment variables, and will connect without using the .erlang.cookie file. You can test it by running .\rabbitmqctl.bat status

I realize this is all a bit convoluted. We have begun a project to simplify the startup scripts for RabbitMQ on Unix and Windows, which may lead to simplification of how you configure RabbitMQ.

Thanks,
Luke

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.

Matt O

unread,
Sep 13, 2019, 1:34:41 PM9/13/19
to rabbitm...@googlegroups.com
Awesome! Thanks for your help

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/bd0b101f-7b83-44f5-9998-4303ec92ba55%40googlegroups.com.

Luke Bakken

unread,
Sep 13, 2019, 1:35:03 PM9/13/19
to rabbitmq-users
Hmm now that I think of it, the order of operations isn't quite correct.

Run the first two rabbitmq-service.bat commands to stop and remove the service, then create the rabbitmq-env-conf.bat file, then run the next two rabbitmq-service.bat commands.

Thanks,
Luke
Reply all
Reply to author
Forward
0 new messages