The ebuild creates a user and a group for the server, but the init script runs it as root. Reproducible: Always Steps to Reproduce: As root: 1. /etc/init.d/rabbitmq start 2. ps aux | grep rabbit Actual Results: rabbitmq is running as root Expected Results: rabbitmq should be running as unprivileged user "rabbitmq" The rabbitmq user needs a writeable home directory; Erlang tries to create a so-called cookie file (for ipc, I suppose) there.
Created attachment 242529 [details, diff] Diff against rabbitmq-server-1.8.0.ebuild Path will do two things: - create rabbitmq user with shell and writable home directory - install man pages
Created attachment 242531 [details, diff] Don't start rabbitmq directly; use su to drop root privileges Patch against net-misc/rabbitmq-server/files/rabbitmq-server.init
(In reply to comment #2) > Created an attachment (id=242531) [details] > Don't start rabbitmq directly; use su to drop root privileges > > Patch against net-misc/rabbitmq-server/files/rabbitmq-server.init the su approach is really ugly. can you try to make rabbitmq work with start-stop-daemon?
start-stop-daemon is a bit tricky, because only a process name of the Erlang runtime is visible. But, well, here we go... Added some more features: - Config file for rabbitmq environment variables - Empty directory /etc/rabbitmq - the default directory for holding the cluster config file - Man page installation - Proper stopping of Erlang port mapper I'll attach a diff against the 1.8.0 ebuild and second diff for the files directory (I had to create two new files).
Created attachment 242721 [details, diff] Diff against rabbitmq-server-1.8.0.ebuild Second version, see comment 4
Created attachment 242723 [details, diff] Patches for the files directory Second version, see comment 4
Comment on attachment 242529 [details, diff] Diff against rabbitmq-server-1.8.0.ebuild Obsoleted by update, see comment 4
Comment on attachment 242531 [details, diff] Don't start rabbitmq directly; use su to drop root privileges Obsoleted by update, see comment 4
i have tried your init script, but it does not work (at least on baselayout-2/openrc): # /etc/init.d/rabbitmq start * Starting RabbitMQ... ... usage: epmd [-d|-debug] [DbgExtra...] [-port No] [-daemon] [-d|-debug] [-port No] [-names|-kill] See the Erlang epmd manual page for info about the usage. The -port and DbgExtra options are -port No Let epmd listen to another port than default 4369 -d -debug Enable debugging. This will give a log to the standard error stream. It will shorten the number of saved used node names to 5. If you give more than one debug flag you may get more debugging information. -packet_timout Seconds Set the number of seconds a connection can be inactive before epmd times out and closes the connection (default 60). -delay_accept Seconds To simulate a busy server you can insert a delay between epmd gets notified about that a new connection is requested and when the connections gets accepted. -delay_write Seconds Also a simulation of a busy server. Inserts a delay before a reply is sent. * start-stop-daemon: failed to start `/usr/lib/erlang/bin/epmd' [ !! ] * ERROR: rabbitmq failed to start i've looked at upstreams init script, and it does not seem to support running as user rabbitmq either. i've tried to make it work with openrcs start-stop-daemon, but i cannot seem to make it work. i've also noticed that epmd is being run as rabbitmq too, which may not be a good idea if multiple erlang applications are running, but i'm no erlang expert ...
(In reply to comment #9) > i have tried your init script, but it does not work (at least on > baselayout-2/openrc): > > # /etc/init.d/rabbitmq start > * Starting RabbitMQ... ... > usage: epmd [-d|-debug] [DbgExtra...] [-port No] [-daemon] > [-d|-debug] [-port No] [-names|-kill] Since I don't start epmd myself, I suspect this might be an issue with rabbitmq's startup scripts. Since I can't reproduce the problem, it's up to you to find out what's going wrong :-) Try finding the location where the problem occurs (bash -x...). Regarding starting epmd: Erlang starts the daemon automatically on demand. So perhaps shutting it down when terminating rabbitmq is not 100% correct... if you consider installations with several Erlang nodes per machine, a separate start script would be the clean solution (which should live in the Erlang package). My guess is that this is a rather obscure situation (otherwise, Erlang wouldn't start the daemon by itself), though.
i've copied debians rabbitmq-script-wrapper, which basically uses the same su approach you had in the beginning. anything else seems to be a waste of time to debug. thanks! as soon as bug 334979 is fixed, the rabbitmq init script will use epmd as dependency too.