4

Following a

sudo apt-get install rabbitmq-server

I'm hitting errors when the service attempts to start (also when using systemctl start):

● rabbitmq-server.service - RabbitMQ Messaging Server
  Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Wed 2017-07-26 15:59:41 IDT; 4min 28s ago
  Process: 17895 ExecStartPost=/usr/lib/rabbitmq/bin/rabbitmq-server-wait (code=exited, status=70)
  Process: 17894 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
 Main PID: 17894 (code=exited, status=1/FAILURE)

That's in systemctl status. In journalctl -xe:

-- Unit rabbitmq-server.service has begun starting up.
Jul 26 15:59:37 myhost rabbitmq[17895]: Waiting for rabbit@myhost ...
Jul 26 15:59:37 myhost rabbitmq[17895]: pid is 17903 ...
Jul 26 15:59:40 myhost systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=1/FAILURE
Jul 26 15:59:41 myhost rabbitmq[17895]: Error: process_not_running
Jul 26 15:59:41 myhost systemd[1]: rabbitmq-server.service: Control process exited, code=exited status=70
Jul 26 15:59:41 myhost systemd[1]: Failed to start RabbitMQ Messaging Server.
-- Subject: Unit rabbitmq-server.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit rabbitmq-server.service has failed.
-- 
-- The result is failed.
Jul 26 15:59:41 myhost systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 26 15:59:41 myhost systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
kabanus
  • 24,623
  • 6
  • 41
  • 74

1 Answers1

9

OK, this was a rough one:

  1. Make sure your hostname is correct. you can run

    sudo hostname --file /etc/hostname

    to make sure. If it isn't change it by changing /etc/hostname. a.b.c.d should be enough.

  2. If you're behind a company firewall rabbitmq will fail to connect to all the interfaces. Change /etc/rabbitmq/rabbitmq-env.conf, setting NODE=rabbit@localhost. This is enough for development.

Now you can sudo apt-get install --fix-broken to complete the installation (will complain it was scheduled for more stuff). Use sudo rabbitmqctl status to make sure the node is properly running - it will say it clearly if not.

kabanus
  • 24,623
  • 6
  • 41
  • 74
  • 1
    Beautiful, this worked for me after several hours of searching. To further clarify for anyone else arriving here, `hostname` displays the hostname but calling `hostname --file /etc/hostname` will set the hostname to whatever is in the `--file` arg. – qotsa42 Aug 27 '20 at 15:50
  • Note `/etc/hostname` is the usual file on many Linux flavors your hostname is saved. If someone thinks, it's a different file, please don't edit it in replace of this name, instead, add it along side with the flavor of Linux it is relevant to. – kabanus Nov 14 '21 at 13:46