Errors with RabbitMQ on FreeBSD
I’ve run into the following error(s) intermittently while starting or stopping RabbitMQ on my FreeBSD machine. It was rather perplexing as it seemed inconsistent.
The messages have been abbreviated for brevity.
$ sudo /usr/local/etc/rc.d/rabbitmq start
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: .. Function: read_file_info. Process: code_server."}
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: ./standard_error.beam. Function: get_file. Process: code_server."}
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: ./supervisor_bridge.beam. Function: get_file. Process: code_server."}
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: ./user_sup.beam. Function: get_file. Process: code_server."}
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: ./user.beam. Function: get_file. Process: code_server."}
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: ./kernel_config.beam. Function: get_file. Process: code_server."}
{error_logger,{{2009,10,14},{9,8,46}},std_error,"File operation error: eacces. Target: ./queue.beam. Function: get_file. Process: code_server."}
...
=ERROR REPORT==== 14-Oct-2009::09:08:46 ===
file:path_eval([".","/var/db/rabbitmq"],".erlang"): permission denied
Starting all nodes...
Starting node rabbit@localhost...
=ERROR REPORT==== 14-Oct-2009::09:08:46 ===
File operation error: eacces. Target: ./inet_gethost_native.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 14-Oct-2009::09:08:46 ===
File operation error: eacces. Target: ./dist_util.beam. Function: get_file. Process: code_server.
=ERROR REPORT==== 14-Oct-2009::09:08:46 ===
File operation error: eacces. Target: ./proplists.beam. Function: get_file. Process: code_server.
({"init terminating in do_boot",{badarg,[{erl_prim_loader,check_file_result,3},{erl_prim_loader,check_file_result,3},{init,get_boot,1},{init,get_boot,2},{init,do_boot,3}]}}
no error logger present) error: "Error in process <0.1.0> with exit value: {badarg,[{erl_prim_loader,check_file_result,3},{erl_prim_loader,check_file_result,3},{init,get_boot,1},{init,get_boot,2},{init,do_boot,3}]}\n"
=ERROR REPORT==== 14-Oct-2009::09:08:47 ===
File operation error: eacces. Target: ./erl_scan.beam. Function: get_file. Process: code_server.
init terminating in do_boot ()
Error: {node_start_failed,normal}
Not being familiar with Erlang, or RabbitMQ for that matter, these messages seemed meaningless. Following various links on Google suggested privilege issues, others suggested running strace to help pin point the problem.
Finally, after the umpteenth time reviewing the error log, this popped out at me.
file:path_eval([".","/var/db/rabbitmq"],".erlang"): permission denied
RabbitMQ’s rc.d script runs the following
env HOME=/var/db/rabbitmq su -m rabbitmq -c 'sh -c \"/usr/local/sbin/rabbitmq-multi start_all 1
Notice, via su -m, it runs the command as rabbitmq.
The error file:path_eval([".","/var/db/rabbitmq"],”.erlang”): permission denied, reveals a permission issue. Assuming you installed via ports and haven’t mucked with the rabbitmq directory, the permissions on /var/db/rabbitmq are probably okay. But what about “.”.
In my case I was running it as a non-root user, but that user’s umask is 027 and the home directory permissions are 750. Likewise if you’re running it as root, root’s home directory may not (and should not) have permissions for rabbitmq to read it.
Let’s try it again
$ pwd / $ sudo /usr/local/etc/rc.d/rabbitmq start Starting all nodes... Starting node rabbit@localhost... +---+ +---+ | | | | | | | | | | | | | +---+ +-------+ | | | RabbitMQ +---+ | | | | | | v1.7.0 +---+ | | | +-------------------+ AMQP 8-0 Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. Licensed under the MPL. See http://www.rabbitmq.com/
Success!
Posted: October 14th, 2009 under Answers, FreeBSD.
Comments: none

Write a comment