rabbitmq-server install fails when another package is using port 5672

Bug #2130487 reported by rnrbusch
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rabbitmq-server (Ubuntu)
Status tracked in Resolute
Jammy
In Progress
Undecided
Lena Voytek
Noble
In Progress
Undecided
Lena Voytek
Plucky
Won't Fix
Undecided
Lena Voytek
Questing
In Progress
Undecided
Lena Voytek
Resolute
Fix Released
Undecided
Lena Voytek

Bug Description

[ Impact ]

When installing rabbitmq-server after another package that uses port 5672, such as garagemq, the installation will fail with:

Job for rabbitmq-server.service failed because the control process exited with error code.
See "systemctl status rabbitmq-server.service" and "journalctl -xeu rabbitmq-server.service" for details.

This is due to a combination of the systemd service failing to start when it tries to take the port, and the use of dh_installinit instead of dh_systemd_start, which provides a code block that exits with an error on service failure.

This bug is fixed by swapping to dh_systemd_start, which allows the install to continue on service failure, and by notifying the user that the service will fail by checking to see if the port is taken by another package.

[ Test Plan ]

To test, install garagemq followed by rabbitmq-server. Before this fix, this would cause the rabbitmq-server to fail. After, the install should instead display the following message and succeed:

WARNING: port 5672 is already in use by another application.
RabbitMQ server will not be started automatically.

Also, installing rabbitmq-server first should also be tested to show that the above message does not show up. Same with a rabbitmq-server upgrade.

[ Where problems could occur ]

Problems would most likely occur here due to differences in behavior between systemd's dh processes vs dh_installinit's.

[ Other Info ]

The reason dh_installinit fails is due to its generated start code being:

invoke-rc.d rabbitmq-server $_dh_action || exit 1

while dh_systemd_start's start code is

deb-systemd-invoke $_dh_action 'rabbitmq-server.service' >/dev/null || true

[ Original Description ]

E: rabbitmq-server: »installiertes post-installation-Skript des Paketes rabbitmq-server«-Unterprozess gab den Fehlerwert 1 zurück

ProblemType: Package
DistroRelease: Ubuntu 24.04
Package: rabbitmq-server 3.12.1-1ubuntu1.2
ProcVersionSignature: Ubuntu 6.14.0-34.34~24.04.1-generic 6.14.11
Uname: Linux 6.14.0-34-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.28.1-0ubuntu3.8
Architecture: amd64
CasperMD5CheckResult: pass
Date: Sat Nov 1 13:10:14 2025
ErrorMessage: »installiertes post-installation-Skript des Paketes rabbitmq-server«-Unterprozess gab den Fehlerwert 1 zurück
InstallationDate: Installed on 2025-10-31 (1 days ago)
InstallationMedia: Ubuntu 24.04.2 LTS "Noble Numbat" - Release amd64 (20250215)
PackageArchitecture: all
Python3Details: /usr/bin/python3.12, Python 3.12.3, python3-minimal, 3.12.3-0ubuntu2
PythonDetails: N/A
RelatedPackageVersions:
 dpkg 1.22.6ubuntu6.5
 apt 2.7.14build2
SourcePackage: rabbitmq-server
Title: package rabbitmq-server 3.12.1-1ubuntu1.2 failed to install/upgrade: »installiertes post-installation-Skript des Paketes rabbitmq-server«-Unterprozess gab den Fehlerwert 1 zurück
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
rnrbusch (rnrbusch) wrote :
Revision history for this message
Christian Ehrhardt (paelzer) wrote :
Download full text (4.9 KiB)

This system started with an install as 24.04 and still is on 24.04.
In there recently the log states that rabbitmq was installed

Start-Date: 2025-11-01 13:10:05
Commandline: /usr/sbin/synaptic
Requested-By: r-b (1000)
Install: erlang-xmerl:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), rabbitmq-server:amd64 (3.12.1-1ubuntu1.2), erlang-os-mon:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-syntax-tools:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-crypto:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-eldap:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), python3-vine:amd64 (5.0.0+dfsg-3, automatic), libsctp1:amd64 (1.0.19+dfsg-2build1, automatic), erlang-tools:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-asn1:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), python3-amqp:amd64 (5.2.0-1), garagemq:amd64 (0.0~git20200204.15e6a9d+ds-4ubuntu0.24.04.3+esm1), erlang-base:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), librabbitmq-dev:amd64 (0.11.0-1build2), python-amqp-doc:amd64 (5.2.0-1), libssl-dev:amd64 (3.0.13-0ubuntu3.6, automatic), erlang-snmp:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-ftp:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-inets:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, autom atic), erlang-parsetools:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-ssl:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-tftp:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), erlang-public-key:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), socat:amd64 (1.8.0.0-4build3, automatic), erlang-mnesia:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), libjs-sphinxdoc:amd64 (7.2.6-6, automatic), erlang-runtime-tools:amd64 (1:25.3.2.8+dfsg-1ubuntu4.5, automatic), libjs-underscore:amd64 (1.13.4~dfsg+~1.11.4-3, automatic)

All that can be seen of the error is that it failed to start the service after install.

rabbitmq-server (3.12.1-1ubuntu1.2) wird eingerichtet ...
info: Wähle GID aus dem Bereich von 100 bis 999 aus …
info: Lege Gruppe »rabbitmq« (GID 127) an …
info: Wähle UID aus dem Bereich von 100 bis 999 aus …

info: Lege Systembenutzer »rabbitmq« (UID 125) an …
info: Lege neuen Benutzer »rabbitmq« (UID 125) mit Gruppe »rabbitmq« an …
info: Erstelle Home-Verzeichnis »/var/lib/rabbitmq« nicht.
Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service → /usr/lib/systemd/system/rabbitmq-server.service.

Job for rabbitmq-server.service failed because the control process exited with error code.

See "systemctl status rabbitmq-server.service" and "journalctl -xeu rabbitmq-server.service" for details.

invoke-rc.d: initscript rabbitmq-server, action "start" failed.
● rabbitmq-server.service - RabbitMQ Messaging Server
     Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2025-11-01 13:10:14 CET; 5ms ago
    Process: 15133 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
   Main PID: 15133 (code=exited, status=1/FAILURE)
     Status: "Standing by"
        CPU: 2.650s
dpkg: Fehler beim Bearbeiten des Paketes rabbitmq-server (--configure):
 »installiertes post-i...

Read more...

Changed in rabbitmq-server (Ubuntu):
status: New → Triaged
Revision history for this message
Christian Ehrhardt (paelzer) wrote :

OK, this is as simple as the two MQ servers fighting over the same port.

root@n2:~# systemctl status garagemq.service
● garagemq.service - AMQP server in golang
     Loaded: loaded (/usr/lib/systemd/system/garagemq.service; enabled; preset: enabled)
     Active: active (running) since Thu 2025-11-13 10:43:40 UTC; 3min 0s ago
   Main PID: 1458 (garagemq)
      Tasks: 13 (limit: 74274)
     Memory: 14.8M (peak: 15.0M)
        CPU: 3.103s
     CGroup: /system.slice/garagemq.service
             └─1458 /usr/bin/garagemq --config /etc/garagemq/config.yaml

Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Append exchange" name=amq.fanout type=fanout vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Append exchange" name=amq.topic type=topic vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Append exchange" name=amq.header type=headers vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Append exchange" name= type=direct vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Initialize exchanges..." vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Initialize queues..." vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Initialize bindings..." vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Load messages into queues" vhost=/
Nov 13 10:43:40 n2 garagemq[1458]: time="2025-11-13T10:43:40Z" level=info msg="Server started" address="127.0.0.1:5672"
Nov 13 10:43:40 n2 systemd[1]: Started garagemq.service - AMQP server in golang.

Garagemq was started before and holds it.
In that state rabbitmq-server fails

root@n2:~# systemctl restart rabbitmq-server
Job for rabbitmq-server.service failed because the control process exited with error code.
See "systemctl status rabbitmq-server.service" and "journalctl -xeu rabbitmq-server.service" for details.

But stop the former and the latter works:

root@n2:~# systemctl stop garagemq
root@n2:~#
root@n2:~# systemctl restart rabbitmq-server
root@n2:~#

All fine now.

---

In that sence it is similar to "apt install nginx apache2" which both try to grab port 80 and the latter will fail. But while usually a service should always start with sane default, when they might conflict that is different.
In the apache/nginx example they are configured to be "tolerant" against a failing start, compare:

/var/lib/dpkg/info/rabbitmq-server.postinst:
...
invoke-rc.d rabbitmq-server $_dh_action || exit 1

/var/lib/dpkg/info/apache2.postinst
...
deb-systemd-invoke $_dh_action 'apache2.service' >/dev/null || true

Should those two have the same behavior?
Maybe, but then the discussion as with the other cases is that it would hide that one of the services didn't work on install.

garagemq already is tolerant to be the second:
deb-systemd-invoke $_dh_action 'garagemq.service' >/dev/null || true

tags: added: server-triage-discuss
Revision history for this message
Christian Ehrhardt (paelzer) wrote :

Idea concept - use ss to check if the port is taken and if so print a warning instead of starting it

tags: added: server-todo
removed: server-triage-discuss
Changed in rabbitmq-server (Ubuntu):
assignee: nobody → Lena Voytek (lvoytek)
Lena Voytek (lvoytek)
summary: - package rabbitmq-server 3.12.1-1ubuntu1.2 failed to install/upgrade:
- »installiertes post-installation-Skript des Paketes rabbitmq-
- server«-Unterprozess gab den Fehlerwert 1 zurück
+ rabbitmq-server install fails when another package is using port 5672
Lena Voytek (lvoytek)
Changed in rabbitmq-server (Ubuntu Jammy):
assignee: nobody → Lena Voytek (lvoytek)
Changed in rabbitmq-server (Ubuntu Noble):
assignee: nobody → Lena Voytek (lvoytek)
Changed in rabbitmq-server (Ubuntu Plucky):
assignee: nobody → Lena Voytek (lvoytek)
Changed in rabbitmq-server (Ubuntu Questing):
assignee: nobody → Lena Voytek (lvoytek)
Changed in rabbitmq-server (Ubuntu Resolute):
status: Triaged → In Progress
Changed in rabbitmq-server (Ubuntu Jammy):
status: New → Triaged
Changed in rabbitmq-server (Ubuntu Noble):
status: New → Triaged
Changed in rabbitmq-server (Ubuntu Plucky):
status: New → Triaged
Changed in rabbitmq-server (Ubuntu Questing):
status: New → Triaged
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Ubuntu 25.04 (Plucky Puffin) has reached end of life, so this bug will not be fixed for that specific release.

Changed in rabbitmq-server (Ubuntu Plucky):
status: Triaged → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rabbitmq-server - 4.0.5-10ubuntu2

---------------
rabbitmq-server (4.0.5-10ubuntu2) resolute; urgency=medium

  * Avoid rabbitmq-server installation failure when port 5672 is taken by
    another package (LP: #2130487)
    - d/rabbitmq-server.postinst: Warn user when rabbitmq-server.service will
      fail to start due to port conflict
    - d/rules: Allow dh_systemd_start to handle service startup by blocking
      dh_installinit. This allows rabbitmq-server.service to fail to start
      without breaking the package installation.
    - d/control: Add explicit dependency on iproute2.

 -- Lena Voytek <email address hidden> Thu, 15 Jan 2026 08:38:21 -0500

Changed in rabbitmq-server (Ubuntu Resolute):
status: In Progress → Fix Released
Lena Voytek (lvoytek)
Changed in rabbitmq-server (Ubuntu Questing):
status: Triaged → In Progress
Changed in rabbitmq-server (Ubuntu Noble):
status: Triaged → In Progress
Changed in rabbitmq-server (Ubuntu Jammy):
status: Triaged → In Progress
Lena Voytek (lvoytek)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.