4

Here is error I am getting:

ubuntu@sync1:/etc/puppet$ sudo /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install rabbitmq-server
Reading package lists...
Building dependency tree...
Reading state information...
rabbitmq-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up rabbitmq-server (3.2.2-1) ...
 * Starting message broker rabbitmq-server                                                                        * FAILED - check /var/log/rabbitmq/startup_\{log, _err\}
                                                                                                          [fail]
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
dpkg: error processing rabbitmq-server (--configure):
 subprocess installed post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
ubuntu@sync1:/etc/puppet$ 

This happens after I run sudo puppet apply manifests/site.pp.

Here is my Rabbit class:

# See https://github.com/puppetlabs/puppetlabs-rabbitmq
class my_rabbitmq ($environment, $type, $user, $password) {

#  case $environment {
#    staging: {
#      #@todo
#    }
#    production: {
#      #@todo
#    }
#  }
#
#  case $type {
#    sync: {
#      #@todo
#    }
#    async: {
#      #@todo
#    }
#  }

class { '::rabbitmq':
  delete_guest_user => true,
  version           => '3.2.2',
}->
rabbitmq_user { 'richard':
  admin    => true,
  password => 'richard_password',
  provider => 'rabbitmqctl',
}->
rabbitmq_user_permissions { 'richard@/':
  configure_permission => '.*',
  read_permission      => '.*',
  write_permission     => '.*',
  provider             => 'rabbitmqctl',
}

}

I am trying this on Ubuntu 12.04 LTS VM. Any ideas? This is driving me crazy, I have been stuck for hours trying to figure this out.

1
  • The service is failing to start when the package install tries to start it - is anything logged when this failure happens? Dec 22, 2013 at 7:58

2 Answers 2

3

I am also having this problem. The cause is that upon installing 'rabbitmq-server' package on Ubuntu, an instance of rabbitmq starts. This is by design. Sadly.

As for a solution, I haven't found one yet.

Edit

I don't know if this is the case for you, but in my case, I was changing the node name in puppet from 'rabbit' to something else.

The brief explanation is that, as I mentioned, installing rabbitmq-server causes the rabbitmq-server service to run. By default, it uses a node name of 'rabbit'.

In my case, puppet came along, configured rabbitmq, and then, before trying to start the service, ran '/etc/init.d/rabbitmq-service status', to check and see if it was already running.

In an ideal world, the answer would have been "yes", since it was, in fact, running, but in this case, the '/etc/init.d/rabbitmq-service' script uses the configured node name to check and see if the instance is running - and when puppet changed the node name in /etc/rabbitmq/rabbitmq-env.conf, that completely broke the service script's ability to determine if it was running, so of course, the script returns 0, because it can't find a running instance.

Puppet then tries to start the new instance with the new node name, but that fails because only one service can own a port at a time, and the running instance had it.

To fix it, I set the RABBITMQ_NODENAME back to 'rabbit', and everything works.

I wrote about it here:

http://www.standalone-sysadmin.com/blog/2014/02/rabbitmq-on-ubuntu-via-puppet/

1
  • Wanted to add this workaround: Prevent automatically start of services when you install via apt / dpkg etc: echo exit 101 > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d
    – gxx
    Jan 14, 2016 at 10:47
0

http://blog.zugschlus.de/archives/974-Debians-Policy-rc.d-infrastructure-explained.html

Debian is frequently bashed for this default, and the canonical answer is to use the policy framework delivered with sysv-rc to avoid services from being started. Since this mechanism is frequently misunderstood, I am writing this article to bring some more additional confusion to this matter.

(blog post not mine)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .