[rabbitmq-discuss] Debian/Ubuntu apt package issues.

Carlton Gibson carlton.gibson at noumenal.co.uk
Sat Apr 23 11:04:52 BST 2011


Hi Matthias, 

Thanks for the reply.

On 23 Apr 2011, at 00:19, Matthias Radestock wrote:
> Carlton Gibson wrote:
>> I found I had to change the ownership of everything (?) in /var/lib/rabbitmq/mnesia to rabbitmq from root to get rabbitmq-server to restart. My thought is that this should be done automatically by the .deb package.
> 
> And that's exactly what the .deb does. The postinst contains
> 
> chown -R rabbitmq:rabbitmq /var/lib/rabbitmq
> chown -R rabbitmq:rabbitmq /var/log/rabbitmq
> 
> So I wonder how you ended up with those dirs owned by root. It can't be a general problem with the .deb since otherwise we'd have hordes of angry debian/ubuntu users beating down our door.
> 
> You mention that the problem started when trying to restart rabbit after a config change. That implies that rabbit was running ok up to that point, so either it was running as root at the time (bad) or/and the permissions on the dirs changed from rabbitmq to root somehow.
> 
> If you can find a way to reproduce this problem starting from a "clean" machine (i.e. no rabbit remnants on it) please post the steps here.

I'm not sure that I'm going to be able to try and replicate this issue right now. However, I can tell you exactly what I did...

First I installed RabbitMQ, which was started by the install script, and then spent a bit of messing around trying to get rabbitmqctl to work. 
(I was trying to run it from the wrong place -- would there be anything there that would change permissions?)

$  sudo aptitude install rabbitmq-server 
$  rabbitctl status                         <---- command not found
$  ps aux | grep rabbit                     <---- okay, where is it?
$  ls /usr/lib/rabbitmq/bin/ 
$  /usr/lib/rabbitmq/bin/rabbitmqctl status 
$  sudo /usr/lib/rabbitmq/bin/rabbitmqctl status <---- nodedown -- oh poo, what's this?
$  netstat -lptn                                 <---- looks like it's running
$  ps aux  | grep rabbit                  <---- yep, looks like it's running
$  sudo /usr/lib/rabbitmq/bin/rabbitmq-server    <---- No!. It really is running! 
$  /usr/lib/rabbitmq/bin/rabbitmqctl status 
$  sudo /usr/lib/rabbitmq/bin/rabbitmqctl status <---- Hmmm, confused.
$  erl -sname foo -cookie coo                    <---- okay lets try this... yep, it's running
$  ps aux | grep rabbit 
$  ls /etc/init.d/                               <---- Hang on, maybe there's an init.d script
$  cat /etc/init.d/rabbitmq-server               <---- Yep.
$  sudo /etc/init.d/rabbitmq-server status       <---- Ah ha! There it is.
$  sudo /usr/sbin/rabbitmqctl status             <---- And there, brilliant.
$  ln -s /usr/sbin/rabbitmqctl rabbitmqctl       <---- lets put this somewhere I can find it.

Then I adjusted the config, before trying to restart: 

$  sudo rabbitmqctl add_user  [...]         <---- details elided 
$  sudo rabbitmqctl add_vhost [...] 
$  sudo rabbitmqctl set_permissions [...]
$  sudo rabbitmqctl list_users 
$  sudo rabbitmqctl delete_user guest 
$  sudo nano /etc/rabbitmq/rabbitmq.config   <----- just setup SSL
$  sudo /etc/init.d/rabbitmq-server restart        <---- And here's where I got the error

What follows is lots of `$ cat /var/log/rabbitmq/startup_log` until I emailed the list. This was all done in a single session, with nothing omitted, on a server that had never seen RabbitMQ (or Erlang) before. 

On solving the permissions error I started RabbitMQ with the init.d script; I presume the installer did the same. 

The output of `$ ps aux  | grep rabbit` (with a couple of blank lines to separate the long entry) is: 

$ ps aux | grep rabbit
rabbitmq 23851  0.0  0.1  10760   348 ?        S    Apr22   0:00 /usr/lib/erlang/erts-5.7.4/bin/epmd -daemon
root     25301  0.0  0.2   4144   572 ?        Ss   Apr22   0:00 sh -c /usr/sbin/rabbitmq-server > /var/log/rabbitmq/startup_log             2> /var/log/rabbitmq/startup_err
root     25304  0.0  0.2   4144   568 ?        S    Apr22   0:00 /bin/sh /usr/sbin/rabbitmq-server
rabbitmq 25310  0.0  0.4  35636  1228 ?        S    Apr22   0:00 su rabbitmq -s /bin/sh -c /usr/lib/rabbitmq/bin/rabbitmq-server 
rabbitmq 25311  0.0  0.2   4144   568 ?        S    Apr22   0:00 sh -c /usr/lib/rabbitmq/bin/rabbitmq-server 

rabbitmq 25313  0.0 12.3 114788 30940 ?        Sl   Apr22   0:24 /usr/lib/erlang/erts-5.7.4/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -noshell -noinput -sname rabbit at web -boot /var/lib/rabbitmq/mnesia/rabbit at web-plugins-expand/rabbit -config /etc/rabbitmq/rabbitmq -kernel inet_default_connect_options [{nodelay,true}] -sasl errlog_type error -kernel error_logger {file,"/var/log/rabbitmq/rabbit at web.log"} -sasl sasl_error_logger {file,"/var/log/rabbitmq/rabbit at web-sasl.log"} -os_mon start_cpu_sup true -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/rabbit at web"

rabbitmq 25403  0.0  0.1   4044   304 ?        Ss   Apr22   0:00 /usr/lib/erlang/lib/os_mon-2.2.4/priv/bin/cpu_sup
rabbitmq 25404  0.0  0.1  10760   360 ?        Ss   Apr22   0:00 inet_gethost 4
rabbitmq 25405  0.0  0.2  12860   616 ?        S    Apr22   0:00 inet_gethost 4
carlton  25869  0.0  0.2   6208   584 pts/1    R+   08:50   0:00 grep --color=auto rabbit

I didn't save the output of this command from prior to attempting the restart but I'd say it was essentially the same. (There were the two root processes calling rabbitmq-server, with the others being rabbitmq.)

If you can point out where I went wrong I would be glad to learn. Hopefully this sheds some light, even if it's not a reproduce case. 

Regards,
Carlton



More information about the rabbitmq-discuss mailing list