[SERVER-54386] mongodb 3.6.22 install fails if systemctl daemon is not running Created: 08/Feb/21  Updated: 29/Oct/23  Resolved: 19/Feb/21

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 3.6.22
Fix Version/s: 4.9.0, 4.4.5, 4.2.14, 4.0.25

Type: Bug Priority: Major - P3
Reporter: Philipp Trulson Assignee: Ryan Egesdahl (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-52806 deb install files assume systemd Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2, v4.0
Steps To Reproduce:

docker run --rm -it --entrypoint=/bin/sh mongo:3.6
> $ apt update
> $ apt upgrade -y
...
> Setting up mongodb-org-server (3.6.22) ...
> Failed to connect to bus: No such file or directory
> dpkg: error processing package mongodb-org-server (--configure):
>  subprocess installed post-installation script returned error exit status 1
> dpkg: dependency problems prevent configuration of mongodb-org:
>  mongodb-org depends on mongodb-org-server; however:
>   Package mongodb-org-server is not configured yet.

Sprint: Dev Platform 2021-02-22
Participants:

 Description   

SERVER-52806 broke the installation on Docker images which have systemd installed without the daemon running, which is the case on the official mongo Docker image. That's why an upgrade or installation fails completely. Older versions likeĀ 3.6.21 can be installed without a problem.

The problem lies in the postinstall script which assumes that if the systemctl binary is present the daemon must be running:

        # Check for changes to the service file
        if $(command systemctl --help >/dev/null); then
            systemctl daemon-reload
        fi

The result is the error

Failed to connect to bus: No such file or directory



 Comments   
Comment by Githook User [ 07/May/21 ]

Author:

{'name': 'Ryan Egesdahl', 'email': 'ryan.egesdahl@mongodb.com', 'username': 'deriamis'}

Message: SERVER-54386 Prevent install errors when systemd is not running

(cherry picked from commit 8cf3de4ca76037e9bdace59d84f8ee7403f8a03b)
(cherry picked from commit 77f008215f8b56805c84a0e70834afa9d6b628e8)
(cherry picked from commit 035483ab3e7c5d6a7cdc28f08e4c8531f0b36b63)
Branch: v4.0
https://github.com/mongodb/mongo/commit/77a4e1350031ce0c22e8ffb59060e13710969aad

Comment by Githook User [ 05/Mar/21 ]

Author:

{'name': 'Ryan Egesdahl', 'email': 'ryan.egesdahl@mongodb.com', 'username': 'deriamis'}

Message: SERVER-54386 Prevent install errors when systemd is not running

(cherry picked from commit 8cf3de4ca76037e9bdace59d84f8ee7403f8a03b)
(cherry picked from commit 77f008215f8b56805c84a0e70834afa9d6b628e8)
Branch: v4.2
https://github.com/mongodb/mongo/commit/035483ab3e7c5d6a7cdc28f08e4c8531f0b36b63

Comment by Githook User [ 03/Mar/21 ]

Author:

{'name': 'Ryan Egesdahl', 'email': 'ryan.egesdahl@mongodb.com', 'username': 'deriamis'}

Message: SERVER-54386 Prevent install errors when systemd is not running

(cherry picked from commit 8cf3de4ca76037e9bdace59d84f8ee7403f8a03b)
Branch: v4.4
https://github.com/mongodb/mongo/commit/77f008215f8b56805c84a0e70834afa9d6b628e8

Comment by Githook User [ 18/Feb/21 ]

Author:

{'name': 'Ryan Egesdahl', 'email': 'ryan.egesdahl@mongodb.com', 'username': 'deriamis'}

Message: SERVER-54386 Prevent install errors when systemd is not running
Branch: master
https://github.com/mongodb/mongo/commit/8cf3de4ca76037e9bdace59d84f8ee7403f8a03b

Comment by Ryan Egesdahl (Inactive) [ 09/Feb/21 ]

philipp@trulson.de This is actually a long-term solution, in that we intend the change to be permanent. We will also be fixing the package maintainer scripts, but those changes are tied to version releases, which tend to be infrequent. Changing Dockerfile doesn't address all situations where this behavior might crop up, but it should permanently resolve the one you reported.

Comment by Philipp Trulson [ 09/Feb/21 ]

Hey Jon, thanks for the quick workaround! Yes, a longer term solution would be better, but at least it works.

Comment by Jonathan Streets (Inactive) [ 08/Feb/21 ]

hi philipp@trulson.de,
I am sorry you are having this issue. I have found a workaround by changing the 3.6 Dockerfile as follows:

diff --git a/3.6/Dockerfile b/3.6/Dockerfile
index de0b567..fff82dd 100644
--- a/3.6/Dockerfile
+++ b/3.6/Dockerfile
@@ -79,13 +79,14 @@ ARG MONGO_REPO=repo.mongodb.org
 ENV MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO}
 
 ENV MONGO_MAJOR 3.6
-ENV MONGO_VERSION 3.6.21
+ENV MONGO_VERSION 3.6.22
 # bashbrew-architectures:amd64 arm64v8
 RUN echo "deb http://$MONGO_REPO/apt/ubuntu xenial/${MONGO_PACKAGE%-unstable}/$MONGO_MAJOR multiverse" | tee "/etc/apt/sources.list.d/${MONGO_PACKAGE%-unstable}.list"
 
 RUN set -x \
 # installing "mongodb-enterprise" pulls in "tzdata" which prompts for input
        && export DEBIAN_FRONTEND=noninteractive \
+        && ln -s /bin/true /usr/local/bin/systemctl \
        && apt-get update \
        && apt-get install -y \
                ${MONGO_PACKAGE}=$MONGO_VERSION \
@@ -93,6 +94,7 @@ RUN set -x \
                ${MONGO_PACKAGE}-shell=$MONGO_VERSION \
                ${MONGO_PACKAGE}-mongos=$MONGO_VERSION \
                ${MONGO_PACKAGE}-tools=$MONGO_VERSION \
+        && rm -f /usr/local/bin/systemctl \
        && rm -rf /var/lib/apt/lists/* \
        && rm -rf /var/lib/mongodb \
        && mv /etc/mongod.conf /etc/mongod.conf.orig

Then building the container locally in the 3.6 directory

docker build . --tag mongo:test

> db.serverBuildInfo()
{
	"version" : "3.6.22",
	"gitVersion" : "62d9f36d148e4dacfec1ca8fcb110f1cc410336f",
	"modules" : [ ],
	"allocator" : "tcmalloc",
	"javascriptEngine" : "mozjs",
	"sysInfo" : "deprecated",
	"versionArray" : [
		3,
		6,
		22,
		0
	],

I will follow up with the maintainers of the docker-library repository, and our Server Team to get a longer term solution.

jon

Generated at Thu Feb 08 05:33:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.