Apt-get install rabbit-server fails on freshly launched ubuntu: container everytime

lxc launch ubuntu: svr
lxc exec svr bash
apt-get install rabbitmq-server


Setting up libsctp1:amd64 (1.0.16+dfsg-3) …
Setting up rabbitmq-server (3.5.7-1ubuntu0.16.04.2) …
Adding group rabbitmq' (GID 117) ... Done. Adding system userrabbitmq’ (UID 113) …
Adding new user rabbitmq' (UID 113) with grouprabbitmq’ …
Not creating home directory `/var/lib/rabbitmq’.
Job for rabbitmq-server.service failed because the control process exited with error code. See “systemctl status rabbitmq-server.service” and “journalctl -xe” for details.
invoke-rc.d: initscript rabbitmq-server, action “start” failed.
● rabbitmq-server.service - RabbitMQ Messaging Server
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-01-29 04:49:00 UTC; 5ms ago
Process: 1266 ExecStartPost=/usr/lib/rabbitmq/bin/rabbitmq-server-wait (code=exited, status=2)
Process: 1265 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 1265 (code=exited, status=1/FAILURE)

Jan 29 04:48:28 test2 systemd[1]: Starting RabbitMQ Messaging Server…
Jan 29 04:48:28 test2 rabbitmq[1266]: Waiting for rabbit@test2 …
Jan 29 04:48:28 test2 rabbitmq[1266]: pid is 1274 …
Jan 29 04:48:58 test2 systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=1/FAILURE
Jan 29 04:49:00 test2 rabbitmq[1266]: Error: process_not_running
Jan 29 04:49:00 test2 systemd[1]: rabbitmq-server.service: Control process exited, code=exited status=2
Jan 29 04:49:00 test2 systemd[1]: Failed to start RabbitMQ Messaging Server.
Jan 29 04:49:00 test2 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jan 29 04:49:00 test2 systemd[1]: rabbitmq-server.service: Failed with result ‘exit-code’.
dpkg: error processing package rabbitmq-server (–configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.23-0ubuntu10) …
Processing triggers for systemd (229-4ubuntu21) …
Processing triggers for ureadahead (0.100.0-19) …
Errors were encountered while processing:
rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am ultimately trying to install onlyoffice document server AND community server, and it always fails here. I have tried searching for a solution and I find related threads, but nothing about rabbit-server.

Not sure if this is a bug or a dumb-ass not typing properly (that would be me!). Any help greatly appreciated as I have spent many hours on this.

It worked for me, with ubuntu:x (which is the same with ubuntu:):

Setting up erlang-nox (1:18.3-dfsg-1ubuntu3) ...
Setting up libsctp1:amd64 (1.0.16+dfsg-3) ...
Setting up rabbitmq-server (3.5.7-1ubuntu0.16.04.2) ...
Adding group `rabbitmq' (GID 117) ...
Done.
Adding system user `rabbitmq' (UID 113) ...
Adding new user `rabbitmq' (UID 113) with group `rabbitmq' ...
Not creating home directory `/var/lib/rabbitmq'.
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...

What is your host?

1 Like

Host was the problem!!

The fix is so incredibly simple it’s embarrassing, but for the record: if anyone runs into the same problems I had, all you have to do is change your /etc/hosts file. Lets assume you have an lxc container named ‘office’. After launch, the file /etc/hosts looks something like this:

127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Just add a new second line entry thus:

127.0.1.1 myhost

So that your file looks like this:

127.0.0.1 localhost
127.0.1.1 myhost

'# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts 

A simple fix for what looked like a daunting error!

One minor comment - in the lines above I have the hash symbol (#) prefixed as this '# because if you put a regular # into this web sites message editor it does funky stuff to the format, so please do NOT use the ’ character in the above files. :slight_smile:

Thanks for the help. :-))

1 Like

Thanks for posting the workaround.

A bit of googling on rabbitmq and 127.0.1.1 shows the following,


which explains the source of the issue.

Thanks a lot!

It helps for me