[SERVER-47197] Debian server package does not provide a way to start the server in Docker Created: 31/Mar/20  Updated: 06/Feb/23  Resolved: 23/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.2.5
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Oleg Pudeyev (Inactive) Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Won't Do Votes: 3
Labels: sdp-backlog-purge
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Development Platform
Operating System: Linux
Participants:

 Description   

I followed the instructions in https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/ to install 4.2 server on a Debian Docker image using this dockerfile: https://github.com/p-mongo/tests/blob/master/server-docker/Dockerfile

The server installed successfully, however I am not seeing how to start it.

The instructions at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/ provide two alternatives: systemd and sysv init.

Since the Docker environment does not have systemd as pid 1 (my pid 1 is bash), I was not successful in following the systemd route:

root@c501a52f1929:/# systemctl start mongod
bash: systemctl: command not found
root@c501a52f1929:/# apt install systemd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dbus dmsetup libapparmor1 libargon2-1 libcryptsetup12 libdbus-1-3 libdevmapper1.02.1 libexpat1
  libidn11 libip4tc0 libjson-c3 libkmod2 libnss-systemd libpam-systemd systemd-sysv
Suggested packages:
  default-dbus-session-bus | dbus-session-bus systemd-container policykit-1
The following NEW packages will be installed:
  dbus dmsetup libapparmor1 libargon2-1 libcryptsetup12 libdbus-1-3 libdevmapper1.02.1 libexpat1
  libidn11 libip4tc0 libjson-c3 libkmod2 libnss-systemd libpam-systemd systemd systemd-sysv
0 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
Need to get 5367 kB of archives.
After this operation, 18.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://deb.debian.org/debian buster/main amd64 libapparmor1 amd64 2.13.2-10 [94.7 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 libargon2-1 amd64 0~20171227-0.2 [19.6 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 dmsetup amd64 2:1.02.155-3 [90.8 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 libdevmapper1.02.1 amd64 2:1.02.155-3 [141 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 libjson-c3 amd64 0.12.1+ds-2 [26.9 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 libcryptsetup12 amd64 2:2.1.0-5+deb10u2 [193 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 libidn11 amd64 1.33-2.2 [116 kB]
Get:8 http://deb.debian.org/debian buster/main amd64 libip4tc0 amd64 1.8.2-4 [70.2 kB]
Get:9 http://deb.debian.org/debian buster/main amd64 libkmod2 amd64 26-1 [52.7 kB]
Get:10 http://deb.debian.org/debian buster/main amd64 systemd amd64 241-7~deb10u3 [3495 kB]
Get:11 http://deb.debian.org/debian buster/main amd64 systemd-sysv amd64 241-7~deb10u3 [99.6 kB]
Get:12 http://deb.debian.org/debian buster/main amd64 libdbus-1-3 amd64 1.12.16-1 [214 kB]
Get:13 http://deb.debian.org/debian buster/main amd64 libexpat1 amd64 2.2.6-2+deb10u1 [106 kB]
Get:14 http://deb.debian.org/debian buster/main amd64 dbus amd64 1.12.16-1 [235 kB]
Get:15 http://deb.debian.org/debian buster/main amd64 libnss-systemd amd64 241-7~deb10u3 [204 kB]
Get:16 http://deb.debian.org/debian buster/main amd64 libpam-systemd amd64 241-7~deb10u3 [208 kB]
Fetched 5367 kB in 3s (1766 kB/s)       
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libapparmor1:amd64.
(Reading database ... 7450 files and directories currently installed.)
Preparing to unpack .../0-libapparmor1_2.13.2-10_amd64.deb ...
Unpacking libapparmor1:amd64 (2.13.2-10) ...
Selecting previously unselected package libargon2-1:amd64.
Preparing to unpack .../1-libargon2-1_0~20171227-0.2_amd64.deb ...
Unpacking libargon2-1:amd64 (0~20171227-0.2) ...
Selecting previously unselected package dmsetup.
Preparing to unpack .../2-dmsetup_2%3a1.02.155-3_amd64.deb ...
Unpacking dmsetup (2:1.02.155-3) ...
Selecting previously unselected package libdevmapper1.02.1:amd64.
Preparing to unpack .../3-libdevmapper1.02.1_2%3a1.02.155-3_amd64.deb ...
Unpacking libdevmapper1.02.1:amd64 (2:1.02.155-3) ...
Selecting previously unselected package libjson-c3:amd64.
Preparing to unpack .../4-libjson-c3_0.12.1+ds-2_amd64.deb ...
Unpacking libjson-c3:amd64 (0.12.1+ds-2) ...
Selecting previously unselected package libcryptsetup12:amd64.
Preparing to unpack .../5-libcryptsetup12_2%3a2.1.0-5+deb10u2_amd64.deb ...
Unpacking libcryptsetup12:amd64 (2:2.1.0-5+deb10u2) ...
Selecting previously unselected package libidn11:amd64.
Preparing to unpack .../6-libidn11_1.33-2.2_amd64.deb ...
Unpacking libidn11:amd64 (1.33-2.2) ...
Selecting previously unselected package libip4tc0:amd64.
Preparing to unpack .../7-libip4tc0_1.8.2-4_amd64.deb ...
Unpacking libip4tc0:amd64 (1.8.2-4) ...
Selecting previously unselected package libkmod2:amd64.
Preparing to unpack .../8-libkmod2_26-1_amd64.deb ...
Unpacking libkmod2:amd64 (26-1) ...
Selecting previously unselected package systemd.
Preparing to unpack .../9-systemd_241-7~deb10u3_amd64.deb ...
Unpacking systemd (241-7~deb10u3) ...
Setting up libapparmor1:amd64 (2.13.2-10) ...
Setting up libargon2-1:amd64 (0~20171227-0.2) ...
Setting up libjson-c3:amd64 (0.12.1+ds-2) ...
Setting up libidn11:amd64 (1.33-2.2) ...
Setting up libip4tc0:amd64 (1.8.2-4) ...
Setting up libkmod2:amd64 (26-1) ...
Setting up libdevmapper1.02.1:amd64 (2:1.02.155-3) ...
Setting up libcryptsetup12:amd64 (2:2.1.0-5+deb10u2) ...
Setting up systemd (241-7~deb10u3) ...
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service ��� /lib/systemd/system/getty@.service.
Created symlink /etc/systemd/system/multi-user.target.wants/remote-fs.target ��� /lib/systemd/system/remote-fs.target.
Created symlink /etc/systemd/system/dbus-org.freedesktop.timesync1.service ��� /lib/systemd/system/systemd-timesyncd.service.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service ��� /lib/systemd/system/systemd-timesyncd.service.
Setting up dmsetup (2:1.02.155-3) ...
Selecting previously unselected package systemd-sysv.
(Reading database ... 8283 files and directories currently installed.)
Preparing to unpack .../0-systemd-sysv_241-7~deb10u3_amd64.deb ...
Unpacking systemd-sysv (241-7~deb10u3) ...
Selecting previously unselected package libdbus-1-3:amd64.
Preparing to unpack .../1-libdbus-1-3_1.12.16-1_amd64.deb ...
Unpacking libdbus-1-3:amd64 (1.12.16-1) ...
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack .../2-libexpat1_2.2.6-2+deb10u1_amd64.deb ...
Unpacking libexpat1:amd64 (2.2.6-2+deb10u1) ...
Selecting previously unselected package dbus.
Preparing to unpack .../3-dbus_1.12.16-1_amd64.deb ...
Unpacking dbus (1.12.16-1) ...
Selecting previously unselected package libnss-systemd:amd64.
Preparing to unpack .../4-libnss-systemd_241-7~deb10u3_amd64.deb ...
Unpacking libnss-systemd:amd64 (241-7~deb10u3) ...
Selecting previously unselected package libpam-systemd:amd64.
Preparing to unpack .../5-libpam-systemd_241-7~deb10u3_amd64.deb ...
Unpacking libpam-systemd:amd64 (241-7~deb10u3) ...
Setting up libexpat1:amd64 (2.2.6-2+deb10u1) ...
Setting up systemd-sysv (241-7~deb10u3) ...
Setting up libnss-systemd:amd64 (241-7~deb10u3) ...
First installation detected...
Checking NSS setup...
Setting up libdbus-1-3:amd64 (1.12.16-1) ...
Setting up dbus (1.12.16-1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up libpam-systemd:amd64 (241-7~deb10u3) ...
Processing triggers for systemd (241-7~deb10u3) ...
Processing triggers for libc-bin (2.28-10) ...
root@c501a52f1929:/# systemctl start mongod
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
root@c501a52f1929:/# fstat /sbin/init 
bash: fstat: command not found
root@c501a52f1929:/# stat /sbin/init 
  File: /sbin/init -> /lib/systemd/systemd
  Size: 20        	Blocks: 0          IO Block: 4096   symbolic link
Device: 4eh/78d	Inode: 22029243    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-03-31 00:50:50.665783823 +0000
Modify: 2020-01-29 18:07:53.000000000 +0000
Change: 2020-03-31 00:50:42.305669153 +0000
 Birth: -

The sysv init route does not work either:

root@c501a52f1929:/# service mongod start
mongod: unrecognized service

According to https://stackoverflow.com/a/53165539/11093943, the sysv init route requires a sysv init script which the current Debian package does not provide:

root@c501a52f1929:/# dpkg -L mongodb-org-server
/.
/etc
/etc/mongod.conf
/lib
/lib/systemd
/lib/systemd/system
/lib/systemd/system/mongod.service
/usr
/usr/bin
/usr/bin/mongod
/usr/share
/usr/share/doc
/usr/share/doc/mongodb-org-server
/usr/share/doc/mongodb-org-server/LICENSE-Community.txt.gz
/usr/share/doc/mongodb-org-server/MPL-2.gz
/usr/share/doc/mongodb-org-server/README
/usr/share/doc/mongodb-org-server/THIRD-PARTY-NOTICES.gotools.gz
/usr/share/doc/mongodb-org-server/THIRD-PARTY-NOTICES.gz
/usr/share/doc/mongodb-org-server/changelog.gz
/usr/share/doc/mongodb-org-server/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/mongodb-org-server
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/mongod.1.gz

If this SO post is correct, the sysv init instructions at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/ are actually unusable because the package does not provide the corresponding init script.

Am I missing how to start the server in a Docker container?



 Comments   
Comment by Iryna Zhuravlova [ 23/Jan/23 ]

We have Docker containers now. We will close it as "Won't do". If this is something important and needs to be fixed, feel free to re-open the ticket and let us know why is it important. 

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