Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
3
answers
2165
views
Unable to install MongoDB on Linux Mint
I cannot install MongoDB on my Linux Mint. Operating System: Linux Mint 19.1 Kernel: Linux 4.15.0-50-generic Architecture: x86-64 I followed [official documentation.][1] [1]: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ Import the public key used by the package management syst...
I cannot install MongoDB on my Linux Mint.
Operating System: Linux Mint 19.1
Kernel: Linux 4.15.0-50-generic
Architecture: x86-64
I followed official documentation.
Import the public key used by the package management system
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | sudo apt-key add -
Create a list file for MongoDB Ubuntu 18.04 (Bionic)
$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" |
sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
Reload local package
$ sudo apt-get update
Install the MongoDB package
$ sudo apt-get install -y mongodb-org
While installing got these errors:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
icoutils libboost-program-options1.65.1 libgoogle-perftools4 libpcrecpp0v5
libtcmalloc-minimal4 libwine-development libwxgtk3.0-gtk3-0v5
libyaml-cpp0.5v5 mongodb-server-core python-wxgtk3.0 python-wxversion
wine64-development
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 245 not upgraded.
Need to get 48.3 MB/73.0 MB of archives.
After this operation, 267 MB of additional disk space will be used.
Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org-shell amd64 4.0.12 [9,865 kB]
Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org-tools amd64 4.0.12 [38.5 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0/multiverse amd64 mongodb-org amd64 4.0.12 [3,528 B]
Fetched 48.3 MB in 31s (1,553 kB/s)
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 349983 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_4.0.12_amd64.deb ...
Unpacking mongodb-org-shell (4.0.12) ...
Preparing to unpack .../mongodb-org-server_4.0.12_amd64.deb ...
Unpacking mongodb-org-server (4.0.12) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.0.12_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.0.12_amd64.deb ...
Unpacking mongodb-org-mongos (4.0.12) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.0.12_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package mongodb-org-tools.
Preparing to unpack .../mongodb-org-tools_4.0.12_amd64.deb ...
Unpacking mongodb-org-tools (4.0.12) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../mongodb-org_4.0.12_amd64.deb ...
Unpacking mongodb-org (4.0.12) ...
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-server_4.0.12_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.0.12_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Tried to start the DB
$ sudo service mongod start
Failed to start mongod.service: Unit mongod.service not found.
The command below gives the same error:
sudo apt-get install -f
Unable to remove mongodb-server-core:
$ apt remove mongodb-server-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-server but it is not going to be installed
Depends: mongodb-org-mongos but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
VA splash
(153 rep)
Aug 11, 2019, 05:03 PM
• Last activity: Jul 20, 2025, 08:07 PM
1
votes
1
answers
63
views
Help figuring out how to handle errors in "mongodump" script
I have a simple bash script that's supposed to create a dump file from a database ``` docker exec -i container sh -c "mongodump --archive" > \ ~/dumps/db-$(date + "%d%m%Y").dump 2> \ ~/logs/dumps/db-$(date + "%d%m%Y").log \ ``` I've been asked to ensure the script will handle any errors, so I attemp...
I have a simple bash script that's supposed to create a dump file from a database
docker exec -i container sh -c "mongodump --archive" > \
~/dumps/db-$(date + "%d%m%Y").dump 2> \
~/logs/dumps/db-$(date + "%d%m%Y").log \
I've been asked to ensure the script will handle any errors, so I attempted adding the following to the script.
docker exec -i container sh -c "mongodump --archive" > \
~/dumps/db-$(date + "%d%m%Y").dump 2> \
~/logs/dumps/db-$(date + "%d%m%Y").log \
exit_status=$?
if [ exit_status -ne 0 ]; then
echo "An error occured while running mongodump. Exit Status: $exit_status"
fi
The above was my attempt. If the exit status is anything but 0, send an echo message with the actual exit code. The script successfully creates a dump file, however I receive the following error:
[: exit_status: integer expression expected
My assumption is that because of my log redirection, the command itself doesn't actually report a exit status on completion. But I'm not so sure. I'm still learning the ropes of Bash scripting, so any advice is appreciated.
Ambre
(111 rep)
Jan 21, 2025, 03:46 PM
• Last activity: Jan 21, 2025, 05:40 PM
0
votes
2
answers
116
views
How do I redirect the output of mongorestore to a log file?
Here is the command I'm trying to redirect the output of: ``` $ docker exec -it container sh -c 'mongorestore --archive' restore.log ``` I'm sure there are forums showing how to do this, but I wasn't even sure how to google how to do what I want to do. Any help would be appreciated.
Here is the command I'm trying to redirect the output of:
$ docker exec -it container sh -c 'mongorestore --archive' restore.log
I'm sure there are forums showing how to do this, but I wasn't even sure how to google how to do what I want to do. Any help would be appreciated.
Ambre
(111 rep)
Dec 17, 2024, 03:54 PM
• Last activity: Dec 17, 2024, 05:04 PM
0
votes
2
answers
1050
views
i am getting error : fatal error: 'openssl/sha.h' file not found while installing mongodb in mac m1 for the laravel project
``` nssl.c:24:10: fatal error: 'openssl/sha.h' file not found #include ^~~~~~~~~~~~~~~ 1 error generated. make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.lo] Error 1 ERROR: `make' failed ``` my OS Details are : ``` ProductName: macOS ProductVersion: 14.3 BuildVersion: 23D56 u...
nssl.c:24:10: fatal error: 'openssl/sha.h' file not found
#include
^~~~~~~~~~~~~~~
1 error generated.
make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.lo] Error 1
ERROR: `make' failed
my OS Details are :
ProductName: macOS
ProductVersion: 14.3
BuildVersion: 23D56
unix variant
local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:27 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8103 x86_64
php version : PHP 8.2.4
I issued the terminal command: sudo pecl install mongodb
this is from this site :
MongoDB PHP Driver
where my install has stopped with this error:
nssl.c:24:10: fatal error: 'openssl/sha.h' file not found
#include
^~~~~~~~~~~~~~~
1 error generated.
make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.lo] Error 1
ERROR: `make' failed
I found the work around below from: Mac OSX fatal error: ‘openssl/sha.h’ file not found
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
Quoting a Comment:
> Apple deprecated its OpenSSL shared libraries a while back (with OS X 10.7). That’s because OpenSSL doesn’t offer release-to-release binary compatibility, so we can’t update the shared libraries to the latest OpenSSL without breaking all the existing clients.
but i even don't have include folder in my mac ... please help
I got the path to openssl by doing which openssl
in terminal -
/opt/homebrew/bin/openssl
doing
% ls -l /opt/homebrew/bin/openssl
lrwxr-xr-x 1 janammaharjan admin 37 Feb 7 22:12
/opt/homebrew/bin/openssl -> ../Cellar/openssl@3/3.2.1/bin/openssl
Janam Maharjan
(3 rep)
Feb 7, 2024, 05:11 AM
• Last activity: Oct 17, 2024, 02:23 PM
0
votes
1
answers
140
views
How to suppress warnings of MongoDB shell?
I want to parse by `jq` output of mongo --quiet --eval "JSON.stringify(db.adminCommand('listDatabases'))" But it returns WARNING: slaveOk() is deprecated and may be removed in the next major release. Please use secondaryOk() instead. at the start of output. How to get **ONLY** `JSON` output and pars...
I want to parse by
jq
output of
mongo --quiet --eval "JSON.stringify(db.adminCommand('listDatabases'))"
But it returns
WARNING: slaveOk() is deprecated and may be removed in the next major release. Please use secondaryOk() instead.
at the start of output.
How to get **ONLY** JSON
output and parse it with no any butthurt?
palmasd1
(127 rep)
May 27, 2024, 11:49 AM
• Last activity: May 27, 2024, 01:18 PM
0
votes
0
answers
182
views
Install MongoDB on Fedora
So, I've heard that fedora doesn't include mongoDB in it's repos, and mongoDB official site doesn't provide Feodora images either. I've tried using RHEL repo, as [workaround][1], but it throws some SSL error. And anyways, mirrors don't work currently. I don't know. I need mongoDB for following throu...
So, I've heard that fedora doesn't include mongoDB in it's repos, and mongoDB official site doesn't provide Feodora images either.
I've tried using RHEL repo, as workaround , but it throws some SSL error. And anyways, mirrors don't work currently. I don't know.
I need mongoDB for following through tutorial.
Error I get:
$ mongosh --version
mongosh: OpenSSL configuration error:
0068014FD77F0000:error:030000A9:digital envelope routines:alg_module_init:unknown option:../deps/openssl/openssl/crypto/evp/evp_cnf.c:61:name=rh-allow-sha1-signatures, value=yes
Happy Cakiey
(1 rep)
Feb 8, 2024, 06:53 PM
• Last activity: Feb 8, 2024, 07:19 PM
0
votes
1
answers
193
views
grub-install error when running trying to install gnupg on ubuntu 18.04
I am trying upgrade mongodb on my Ubuntu 18:04 system and I am getting the following error when I execute the command: sudo apt-get install gnupg This is the error: Setting up grub-efi-amd64-signed (1.187.2~18.04.1+2.06-2ubuntu14) ... Installing for x86_64-efi platform. grub-install: error: cannot f...
I am trying upgrade mongodb on my Ubuntu 18:04 system and I am getting the following error when I execute the command:
sudo apt-get install gnupg
This is the error:
Setting up grub-efi-amd64-signed (1.187.2~18.04.1+2.06-2ubuntu14) ...
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
dpkg: error processing package grub-efi-amd64-signed (--configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of shim-signed:
shim-signed depends on grub-efi-amd64-signed (>= 1.167~) | grub-efi-arm64-signed (>= 1.167~); however:
Package grub-efi-amd64-signed is not configured yet.
Package grub-efi-arm64-signed is not installed.
dpkg: error processing package shim-signed (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
grub-efi-amd64-signed
shim-signed
user2570135
(103 rep)
Apr 24, 2023, 12:25 AM
• Last activity: Apr 24, 2023, 06:31 AM
0
votes
1
answers
155
views
MongoDB on Archlinux without compiling from source
I can't seem to find a precompiled package that works for Arch. I believe I've tried all the debian-style packages, to no avail. There is no longer an actively-managed mongodb package. And compiling from source apparently requires like a couple hundred gigs of space. Is there a way to get an binary...
I can't seem to find a precompiled package that works for Arch. I believe I've tried all the debian-style packages, to no avail. There is no longer an actively-managed mongodb package. And compiling from source apparently requires like a couple hundred gigs of space. Is there a way to get an binary on Arch for MongoDB without compiling from source?
editor
(105 rep)
Dec 9, 2022, 03:49 PM
• Last activity: Dec 15, 2022, 06:09 PM
1
votes
1
answers
166
views
Change mongodb data directory ubuntu permission
I want to change my mongodb data directory to my external media. The problem is that when I change data dir to my media (other than home dir), it does not work, but it works for home dir: ``` ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vend...
I want to change my mongodb data directory to my external media. The problem is that when I change data dir to my media (other than home dir), it does not work, but it works for home dir:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-11-22 12:46:57 EST; 3s ago
Docs: https://docs.mongodb.org/manual
Process: 144014 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 144014 (code=exited, status=100)
Nov 22 12:46:57 nimashiri-G5-5000 systemd: Started MongoDB Database Server.
Nov 22 12:46:57 nimashiri-G5-5000 systemd: mongod.service: Main process exited, code=exited, status=100/n/a
Nov 22 12:46:57 nimashiri-G5-5000 systemd: mongod.service: Failed with result 'exit-code'.
Any idea?
Nima shiri
(11 rep)
Nov 22, 2022, 07:15 PM
• Last activity: Nov 23, 2022, 12:56 AM
1
votes
0
answers
1246
views
MongoDB 6 fails to start on CentOS 8
MongoDb run fine with the default settings. The issue occurs when I change the default log path in `cat /etc/mongod.conf` to the below: systemLog: destination: file logAppend: true path: /var/www/logs/mongodb/mongod.log Below are my steps to install and start `mongod` While the installation shows su...
MongoDb run fine with the default settings.
The issue occurs when I change the default log path in
cat /etc/mongod.conf
to the below:
systemLog:
destination: file
logAppend: true
path: /var/www/logs/mongodb/mongod.log
Below are my steps to install and start mongod
While the installation shows successful mongod
fails to start after log path update in the /etc/mongod.conf
.
# cat /etc/yum.repos.d/mongodb-org.repo
[mongodb-org-6.0]
name=MongoDB Repository
#baseurl=https://repo.mongodb.org/yum/redhat//mongodb-org/6.0/x86_64/
baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
#Script to install and run mongod
echo "Installing mongodb"
sudo yum install -y mongodb-org
mkdir -p "$log_location/mongodb"
sudo systemctl start mongod
echo "Status mongodb"
sudo systemctl status mongod --no-pager
Output:
Installing mongodb
MongoDB Repository 5.8 kB/s | 9.4 kB 00:01
Package mongodb-org-4.0.28-1.el8.x86_64 is already installed.
Dependencies resolved.
=========================================================================================================================================================================================
Package Architecture Version Repository Size
=========================================================================================================================================================================================
Upgrading:
mongodb-org x86_64 6.0.1-1.el8 mongodb-org-6.0 11 k
mongodb-org-tools x86_64 6.0.1-1.el8 mongodb-org-6.0 11 k
Installing dependencies:
cyrus-sasl x86_64 2.1.27-6.el8_5 baseos 96 k
mongodb-database-tools x86_64 100.6.0-1 mongodb-org-6.0 48 M
mongodb-mongosh x86_64 1.5.4-1.el8 mongodb-org-6.0 41 M
mongodb-org-database x86_64 6.0.1-1.el8 mongodb-org-6.0 11 k
mongodb-org-database-tools-extra x86_64 6.0.1-1.el8 mongodb-org-6.0 16 k
Transaction Summary
=========================================================================================================================================================================================
Install 5 Packages
Upgrade 2 Packages
Total download size: 89 M
Downloading Packages:
(1/7): mongodb-mongosh-1.5.4.x86_64.rpm 51 MB/s | 41 MB 00:00
(2/7): mongodb-database-tools-100.6.0.x86_64.rpm 50 MB/s | 48 MB 00:00
(3/7): mongodb-org-database-6.0.1-1.el8.x86_64.rpm 43 kB/s | 11 kB 00:00
(4/7): mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64.rpm 66 kB/s | 16 kB 00:00
(5/7): mongodb-org-6.0.1-1.el8.x86_64.rpm 44 kB/s | 11 kB 00:00
(6/7): mongodb-org-tools-6.0.1-1.el8.x86_64.rpm 41 kB/s | 11 kB 00:00
(7/7): cyrus-sasl-2.1.27-6.el8_5.x86_64.rpm 6.5 kB/s | 96 kB 00:14
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.8 MB/s | 89 MB 00:15
MongoDB Repository 660 B/s | 1.7 kB 00:02
Importing GPG key 0x64C3C388:
Userid : "MongoDB 6.0 Release Signing Key "
Fingerprint: 39BD 841E 4BE5 FB19 5A65 400E 6A26 B1AE 64C3 C388
From : https://www.mongodb.org/static/pgp/server-6.0.asc
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64 1/9
Installing : mongodb-org-database-6.0.1-1.el8.x86_64 2/9
Installing : mongodb-mongosh-1.5.4-1.el8.x86_64 3/9
Running scriptlet: cyrus-sasl-2.1.27-6.el8_5.x86_64 4/9
Installing : cyrus-sasl-2.1.27-6.el8_5.x86_64 4/9
Running scriptlet: cyrus-sasl-2.1.27-6.el8_5.x86_64 4/9
Running scriptlet: mongodb-database-tools-100.6.0-1.x86_64 5/9
Installing : mongodb-database-tools-100.6.0-1.x86_64 5/9
Running scriptlet: mongodb-database-tools-100.6.0-1.x86_64 5/9
Upgrading : mongodb-org-tools-6.0.1-1.el8.x86_64 6/9
Upgrading : mongodb-org-6.0.1-1.el8.x86_64 7/9
Cleanup : mongodb-org-4.0.28-1.el8.x86_64 8/9
Cleanup : mongodb-org-tools-4.0.28-1.el8.x86_64 9/9
Running scriptlet: mongodb-org-tools-4.0.28-1.el8.x86_64 9/9
Verifying : cyrus-sasl-2.1.27-6.el8_5.x86_64 1/9
Verifying : mongodb-database-tools-100.6.0-1.x86_64 2/9
Verifying : mongodb-mongosh-1.5.4-1.el8.x86_64 3/9
Verifying : mongodb-org-database-6.0.1-1.el8.x86_64 4/9
Verifying : mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64 5/9
Verifying : mongodb-org-6.0.1-1.el8.x86_64 6/9
Verifying : mongodb-org-4.0.28-1.el8.x86_64 7/9
Verifying : mongodb-org-tools-6.0.1-1.el8.x86_64 8/9
Verifying : mongodb-org-tools-4.0.28-1.el8.x86_64 9/9
Upgraded:
mongodb-org-6.0.1-1.el8.x86_64 mongodb-org-tools-6.0.1-1.el8.x86_64
Installed:
cyrus-sasl-2.1.27-6.el8_5.x86_64 mongodb-database-tools-100.6.0-1.x86_64 mongodb-mongosh-1.5.4-1.el8.x86_64 mongodb-org-database-6.0.1-1.el8.x86_64
mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64
Complete!
Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xe" for details.
Status mongodb
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2022-09-05 06:36:08 UTC; 75ms ago
Docs: https://docs.mongodb.org/manual
Process: 33739 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=1/FAILURE)
Process: 33736 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 33735 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 33733 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Sep 05 06:36:08 DKERP systemd: Starting MongoDB Database Server...
Sep 05 06:36:08 DKERP mongod: about to fork child process, waiting until server is ready for connections.
Sep 05 06:36:08 DKERP mongod: forked process: 33741
Sep 05 06:36:08 DKERP mongod: ERROR: child process failed, exited with error number 1
Sep 05 06:36:08 DKERP mongod: To see additional information in this output, start without the "--fork" option.
Sep 05 06:36:08 DKERP systemd: mongod.service: Control process exited, code=exited status=1
Sep 05 06:36:08 DKERP systemd: mongod.service: Failed with result 'exit-code'.
Sep 05 06:36:08 DKERP systemd: Failed to start MongoDB Database Server.
One suggestion was to start after trying this command sudo systemctl daemon-reload
however that too did not work for me.
Unfortunately, nothing shows in the logs as evident from below output:
[root@vultr ~]# grep log /etc/mongod.conf
# where to write logging data.
logAppend: true
path: /var/www/logs/mongodb/mongod.log
[root@vultr ~]# cat /var/www/logs/mongodb/mongod.log | wc -l
cat: /var/www/logs/mongodb/mongod.log: No such file or directory
0
I'm doing mongo 6 on centos8
[root@vultr ~]# uname -a
Linux DKERP 4.18.0-408.el8.x86_64 #1 SMP Mon Jul 18 17:42:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@vultr ~]# hostnamectl
Static hostname: DKERP
Icon name: computer-vm
Chassis: vm
Machine ID: c07ca36f4c37437f8c6c6cbb7d73daf1
Boot ID: 83ee4a5872024054be50448423a9f5e7
Virtualization: microsoft
Operating System: CentOS Stream 8
CPE OS Name: cpe:/o:centos:centos:8
Kernel: Linux 4.18.0-408.el8.x86_64
Architecture: x86-64
Removed the fork
option from configuration file and here is the details debug:
[root@vultr ~]# journalctl -xe
Sep 05 10:20:26 DKERP systemd: Starting MongoDB Database Server...
-- Subject: Unit mongod.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit mongod.service has begun starting up.
Sep 05 10:20:26 DKERP mongod: 2022-09-05T10:20:26.596+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/www/logs/mongodb/mongod.log"
Sep 05 10:20:26 DKERP systemd: mongod.service: Control process exited, code=exited status=1
Sep 05 10:20:26 DKERP dbus-daemon: [system] Activating via systemd: service name='org.fedoraproject.Setroubleshootd' unit='setroubleshootd.service' requested by ':1.239' (uid=0 pi>
Sep 05 10:20:26 DKERP systemd: mongod.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit mongod.service has entered the 'failed' state with result 'exit-code'.
Sep 05 10:20:26 DKERP systemd: Failed to start MongoDB Database Server.
-- Subject: Unit mongod.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit mongod.service has failed.
--
-- The result is failed.
Sep 05 10:20:26 DKERP systemd: Starting SETroubleshoot daemon for processing new SELinux denial logs...
-- Subject: Unit setroubleshootd.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit setroubleshootd.service has begun starting up.
Sep 05 10:20:26 DKERP sudo: pam_unix(sudo:session): session closed for user root
Sep 05 10:20:27 DKERP dbus-daemon: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd'
Sep 05 10:20:27 DKERP systemd: Started SETroubleshoot daemon for processing new SELinux denial logs.
-- Subject: Unit setroubleshootd.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit setroubleshootd.service has finished starting up.
--
-- The start-up result is done.
Sep 05 10:20:28 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm
Sep 05 10:20:28 DKERP dbus-daemon: [system] Activating service name='org.fedoraproject.SetroubleshootPrivileged' requested by ':1.917' (uid=995 pid=34827 comm="/usr/libexec/platfo>
Sep 05 10:20:28 DKERP dbus-daemon: [system] Successfully activated service 'org.fedoraproject.SetroubleshootPrivileged'
Sep 05 10:20:29 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. For complete SELinux messages run: sealert -l 8a0>
Sep 05 10:20:29 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that mongod should be allowed read access on the memory.limit_in_bytes file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
Sep 05 10:20:29 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10
I then decided to temporarily disable selinux
however, I still get the below error:
[root@vultr ~]# journalctl -xe
Sep 05 10:26:43 DKERP systemd: Started SETroubleshoot daemon for processing new SELinux denial logs.
-- Subject: Unit setroubleshootd.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit setroubleshootd.service has finished starting up.
--
-- The start-up result is done.
Sep 05 10:26:43 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm
Sep 05 10:26:43 DKERP dbus-daemon: [system] Activating service name='org.fedoraproject.SetroubleshootPrivileged' requested by ':1.949' (uid=995 pid=34922 comm="/usr/libexec/platfo>
Sep 05 10:26:44 DKERP dbus-daemon: [system] Successfully activated service 'org.fedoraproject.SetroubleshootPrivileged'
Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. For complete SELinux messages run: sealert -l 8a0>
Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that mongod should be allowed read access on the memory.limit_in_bytes file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10
Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm
Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. For complete SELinux messages run: sealert -l 8a0>
Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that mongod should be allowed read access on the memory.limit_in_bytes file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10
Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm
Sep 05 10:26:44 DKERP setroubleshoot: failed to retrieve rpm info for /sys/fs/cgroup/memory/memory.limit_in_bytes
Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from getattr access on the file /sys/fs/cgroup/memory/memory.limit_in_bytes. For complete SELinux mes>
Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from getattr access on the file /sys/fs/cgroup/memory/memory.limit_in_bytes.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that mongod should be allowed getattr access on the memory.limit_in_bytes file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10
Can you please suggest how can I get mongod to run?
Ashar
(527 rep)
Sep 5, 2022, 07:00 AM
• Last activity: Sep 5, 2022, 11:37 AM
1
votes
2
answers
1966
views
System V init service can't recongnise mongod
I have been following [official guide][1] for installing mongodb but it wont run as a service. When i try $ whereis mongod mongod: /usr/bin/mongod /etc/mongod.conf /usr/share/man/man1/mongod.1.gz but step from the guide for starting the service $ sudo service mongod start mongod: unrecognized servic...
I have been following official guide for installing mongodb but it wont run as a service.
When i try
$ whereis mongod
mongod: /usr/bin/mongod /etc/mongod.conf /usr/share/man/man1/mongod.1.gz
but step from the guide for starting the service
$ sudo service mongod start
mongod: unrecognized service
Vojin Purić
(131 rep)
Aug 27, 2022, 03:13 PM
• Last activity: Aug 28, 2022, 10:15 AM
0
votes
1
answers
614
views
Get return value from kubectl exec out into powershell script
So I'm working on a powershell script that runs a pester test. The script connects to a Kubernetes pod with a Mongo database. The goal is to check whether or not a collection in the database is empty. I'm happy with the code up until the "return count" line. I'm aware there is no return command in s...
So I'm working on a powershell script that runs a pester test. The script connects to a Kubernetes pod with a Mongo database. The goal is to check whether or not a collection in the database is empty. I'm happy with the code up until the "return count" line. I'm aware there is no return command in shell, but I've put it in to illustrate.
I'm essentially trying to get the "count" value out from "kubectl exec" into the powershell code. Is this possible?
Context "Foo collection" {
It "should have no documents"{
kubectl exec -it $podName -n mongo `
-- mongosh -u root -p $mongoSecret `
--eval "`
db = db.getSiblingDB('thisOne')
collection = db.getCollection('foo')
count = collection.countDocuments({}, {limit: 1})
return count
"
$docs = count
$docs | Should -Be 0
}
}
a_wahab
(1 rep)
Jul 29, 2022, 12:43 PM
• Last activity: Aug 4, 2022, 01:07 AM
0
votes
1
answers
484
views
How to install mongo bi connector in alpine linux?
How to install mongo bi connector in alpine linux? the mongo bi connector is the 'mongosqld',https://www.mongodb.com/docs/bi-connector/current/ there are debian version, windows and macos version but not alpine version. how to install it in alpine linux
How to install mongo bi connector in alpine linux?
the mongo bi connector is the 'mongosqld',https://www.mongodb.com/docs/bi-connector/current/
there are debian version, windows and macos version but not alpine version.
how to install it in alpine linux
radiorz
(95 rep)
Apr 9, 2022, 10:00 AM
• Last activity: Apr 9, 2022, 01:35 PM
1
votes
0
answers
1570
views
Easy way to push data into MongoDB from Bash shell script?
I know you can create a Javascript file that the MongoDB shell will execute upon startup. But I'm hoping for something more "lightweight" than that. I am using a Linux program that has a scripting language built in it. But the scripting language can not do operations like opening sockets, etc. It do...
I know you can create a Javascript file that the MongoDB shell will execute upon startup. But I'm hoping for something more "lightweight" than that. I am using a Linux program that has a scripting language built in it. But the scripting language can not do operations like opening sockets, etc. It does have a "system" command to shell out to a Linux process. I would like to be able to push data into MongoDB via a Bash shell script and immediately return to the Linux process that spawned it, and quickly if I can since I intend to do this a few times a second (but not much more than that). It seems to me that shelling to the MongoDB shell and then have it execute a startup Javascript file would be a heavyweight operation relatively speaking? Is there a command line that I could craft from a bash script that would do a few quick MongoDB database operations and the exit? I have the MongoDB daemon running at all times on the default port.
Robert Oschler
(193 rep)
Jun 16, 2013, 01:06 AM
• Last activity: Feb 21, 2022, 04:44 AM
0
votes
1
answers
933
views
Running dnf update on Fedora returns conflicts for MongoDB
I'd appreciate some advice resolving the following conflict with MongoDB install on my Fedora Workstation. I've added MongoDB as a custom repo and get the following output in the terminal when running `sudo dnf update`. ``` Fedora 35 - x86_64 - Updates 69 kB/s | 19 kB 00:00 Fedora Modular 35 - x86_6...
I'd appreciate some advice resolving the following conflict with MongoDB install on my Fedora Workstation. I've added MongoDB as a custom repo and get the following output in the terminal when running
sudo dnf update
.
Fedora 35 - x86_64 - Updates 69 kB/s | 19 kB 00:00
Fedora Modular 35 - x86_64 - Updates 46 kB/s | 21 kB 00:00
RPM Fusion for Fedora 35 - Free tainted 23 kB/s | 3.6 kB 00:00
Dependencies resolved.
Problem 1: cannot install the best update candidate for package mongodb-org-database-tools-extra-4.4.4-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.12-1.el8.x86_64
Problem 2: package mongodb-org-tools-4.4.12-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.12, but none of the providers can be installed
- cannot install the best update candidate for package mongodb-org-tools-4.4.4-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.12-1.el8.x86_64
Problem 3: package mongodb-org-4.4.12-1.el8.x86_64 requires mongodb-org-tools = 4.4.12, but none of the providers can be installed
- package mongodb-org-tools-4.4.12-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.12, but none of the providers can be installed
- cannot install the best update candidate for package mongodb-org-4.4.4-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.12-1.el8.x86_64
Problem 4: problem with installed package mongodb-org-4.4.4-1.el8.x86_64
- package mongodb-org-4.4.4-1.el8.x86_64 requires mongodb-org-mongos = 4.4.4, but none of the providers can be installed
- package mongodb-org-4.4.10-1.el8.x86_64 requires mongodb-org-tools = 4.4.10, but none of the providers can be installed
- package mongodb-org-4.4.11-1.el8.x86_64 requires mongodb-org-tools = 4.4.11, but none of the providers can be installed
- package mongodb-org-4.4.12-1.el8.x86_64 requires mongodb-org-tools = 4.4.12, but none of the providers can be installed
- package mongodb-org-4.4.5-1.el8.x86_64 requires mongodb-org-tools = 4.4.5, but none of the providers can be installed
- package mongodb-org-4.4.6-1.el8.x86_64 requires mongodb-org-tools = 4.4.6, but none of the providers can be installed
- package mongodb-org-4.4.7-1.el8.x86_64 requires mongodb-org-tools = 4.4.7, but none of the providers can be installed
- package mongodb-org-4.4.8-1.el8.x86_64 requires mongodb-org-tools = 4.4.8, but none of the providers can be installed
- package mongodb-org-4.4.9-1.el8.x86_64 requires mongodb-org-tools = 4.4.9, but none of the providers can be installed
- cannot install both mongodb-org-mongos-4.4.12-1.el8.x86_64 and mongodb-org-mongos-4.4.4-1.el8.x86_64
- cannot install both mongodb-org-mongos-4.4.4-1.el8.x86_64 and mongodb-org-mongos-4.4.12-1.el8.x86_64
- package mongodb-org-tools-4.4.10-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.10, but none of the providers can be installed
- package mongodb-org-tools-4.4.11-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.11, but none of the providers can be installed
- package mongodb-org-tools-4.4.12-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.12, but none of the providers can be installed
- package mongodb-org-tools-4.4.5-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.5, but none of the providers can be installed
- package mongodb-org-tools-4.4.6-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.6, but none of the providers can be installed
- package mongodb-org-tools-4.4.7-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.7, but none of the providers can be installed
- package mongodb-org-tools-4.4.8-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.8, but none of the providers can be installed
- package mongodb-org-tools-4.4.9-1.el8.x86_64 requires mongodb-org-database-tools-extra = 4.4.9, but none of the providers can be installed
- cannot install the best update candidate for package mongodb-org-mongos-4.4.4-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.10-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.11-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.12-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.5-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.6-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.7-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.8-1.el8.x86_64
- nothing provides /usr/libexec/platform-python needed by mongodb-org-database-tools-extra-4.4.9-1.el8.x86_64
====================================================================================================================================
Package Architecture Version Repository Size
====================================================================================================================================
Skipping packages with conflicts:
(add '--best --allowerasing' to command line to force their upgrade):
mongodb-org-mongos x86_64 4.4.12-1.el8 Mongodb 17 M
Skipping packages with broken dependencies:
mongodb-org x86_64 4.4.10-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.11-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.12-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.5-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.6-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.7-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.8-1.el8 Mongodb 11 k
mongodb-org x86_64 4.4.9-1.el8 Mongodb 11 k
mongodb-org-database-tools-extra x86_64 4.4.10-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.11-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.12-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.5-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.6-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.7-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.8-1.el8 Mongodb 23 k
mongodb-org-database-tools-extra x86_64 4.4.9-1.el8 Mongodb 23 k
mongodb-org-tools x86_64 4.4.10-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.11-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.12-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.5-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.6-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.7-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.8-1.el8 Mongodb 11 k
mongodb-org-tools x86_64 4.4.9-1.el8 Mongodb 11 k
Transaction Summary
====================================================================================================================================
Skip 25 Packages
I've tried as the output suggest that running sudo dnf update --best --allowerasing
would uninstall and reinstall MongoDB. However, it returns the same conflicts. I'd appreciate some advice or suggest work around. I am using the repo information published on this page, https://developer.fedoraproject.org/tech/database/mongodb/about.html .
matthewakinowittering
(3 rep)
Feb 20, 2022, 05:51 PM
• Last activity: Feb 21, 2022, 02:26 AM
0
votes
1
answers
658
views
Is there any other way to pause current running process and run it in background other than Ctrl+Z followed by bg?
I'm trying to run several mongod processes through a Java Application using ProcessBuilder, is there a way to simulate Ctrl+Z keypress to pause the current mongod process ?
I'm trying to run several mongod processes through a Java Application using ProcessBuilder, is there a way to simulate Ctrl+Z keypress to pause the current mongod process ?
Devesh Lohumi
(101 rep)
Feb 16, 2022, 09:24 AM
• Last activity: Feb 16, 2022, 01:50 PM
0
votes
0
answers
178
views
How to choose optimal size for LVM snapshot for cloning MongoDB?
Yes, I know that my question will look familiar to many of you, but I would like to double check with before I start working on it. I have read similar question: https://unix.stackexchange.com/questions/239319/snapshot-size-in-lvm , but still one moment is not clear to me. Shortly: I need to copy Mo...
Yes, I know that my question will look familiar to many of you, but I would like to double check with before I start working on it.
I have read similar question: https://unix.stackexchange.com/questions/239319/snapshot-size-in-lvm , but still one moment is not clear to me.
Shortly:
I need to copy MongoDB from one server to another. MongoDB official documentation proposes to use exactly LVM snaphot for backing up and restoring:
https://docs.mongodb.com/manual/tutorial/backup-with-filesystem-snapshots/
Here I started to get confused. MongoDB which I need to copy is 8Tb.
Which size of LVM snapshot should I take If I need to take a snapshot, zip it, copy it to another server, move everything from it to a new LV, and run MongoDB ?
Will it be enough, let's say, 37G or not? Will I get all data inside of that LVM snapshot like they are in original LV? Everywhere I read the same thing at LVM snapshot keeps difference between two logical volumes. Does it mean if I copy such snapshot to another server I will not get all data inside of it?
Any help will be highly appreciated.
Thanks in advance!
igork
(1 rep)
Oct 29, 2021, 11:26 PM
1
votes
1
answers
1052
views
MongoDB: Failed to set up listener: SocketException: Permission denied error
Mongodb failed to start when launched as a service: service mongodb start with an error: > Failed to set up listener: SocketException: Permission denied error What to do to start it properly?
Mongodb failed to start when launched as a service:
service mongodb start
with an error:
> Failed to set up listener: SocketException: Permission denied error
What to do to start it properly?
sophros
(111 rep)
Oct 19, 2021, 09:46 PM
1
votes
1
answers
3465
views
Arch Linux + MongoDB - GLIBCXX_3.4.22 not found
I have [mongodb installed][1] on my Arch linux: $ sudo pacman -S mongodb $ pacman -Qi mongodb Name : mongodb Version : 3.2.6-2 Description : A high-performance, open source, schema-free document-oriented database Architecture : x86_64 URL : http://www.mongodb.org Licenses : AGPL3 Groups : None Provi...
I have mongodb installed on my Arch linux:
$ sudo pacman -S mongodb
$ pacman -Qi mongodb
Name : mongodb
Version : 3.2.6-2
Description : A high-performance, open source, schema-free document-oriented database
Architecture : x86_64
URL : http://www.mongodb.org
Licenses : AGPL3
Groups : None
Provides : None
Depends On : pcre snappy openssl libsasl boost-libs yaml-cpp wiredtiger
Optional Deps : libpcap: needed for mongosniff [installed]
mongodb-tools: mongoimport, mongodump, mongotop, etc
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 102.28 MiB
Packager : Bartlomiej Piotrowski
Build Date : Fri 13 May 2016 09:40:18 AM BST
Install Date : Thu 30 Jun 2016 05:24:15 AM BST
Install Reason : Explicitly installed
Install Script : Yes
Validated By : Signature
$ mongo
But I have this error below:
> mongo: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.22' not found
> (required by mongo)
I have searched around and install:
$ sudo pacman -S libstdc++5
But I still have the same problem when I try to start mongo.
Any ideas how I can fix this?
**EDIT:**
$ pacman -Qs gcc-libs
local/gcc-libs 5.3.0-4 (base)
Runtime libraries shipped by GCC
And:
$ pacman -Qo /lib/libstdc++.so.6
/usr/lib/libstdc++.so.6 is owned by gcc-libs 5.3.0-4
Run
(209 rep)
Jun 30, 2016, 04:55 AM
• Last activity: Jun 17, 2021, 10:00 PM
1
votes
0
answers
332
views
Port is open but external IPs have no access
My MongoDB is running under a docker container. On the server, I can confirm that port `27017` is open. MongoDB IP Bind is set to `0.0.0.0` to `/etc/mongod.conf` nmap -p 27017 127.0.0.1 PORT STATE SERVICE 27017/tcp open mongod IpTables also have the rule Chain INPUT (policy ACCEPT) ACCEPT tcp -- loc...
My MongoDB is running under a docker container. On the server, I can confirm that port
27017
is open. MongoDB IP Bind is set to 0.0.0.0
to /etc/mongod.conf
nmap -p 27017 127.0.0.1
PORT STATE SERVICE
27017/tcp open mongod
IpTables also have the rule
Chain INPUT (policy ACCEPT)
ACCEPT tcp -- localhost.localdomain localhost.localdomain tcp dpt:27017
ACCEPT tcp -- anywhere anywhere tcp dpt:27017
Also netstat
reports Listening
(No info could be read for "-p": geteuid()=1004 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN -
tcp6 0 0 :::6379 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::3001 :::* LISTEN -
tcp6 0 0 :::3002 :::* LISTEN -
tcp6 0 0 :::443 :::* LISTEN -
tcp6 0 0 :::9090 :::* LISTEN -
udp 0 0 0.0.0.0:10000 0.0.0.0:* -
udp 0 0 127.0.0.53:53 0.0.0.0:* -
From my computer nmap reports that the port is filtered
nmap -p 27017 xxxx.xxxxx.xxxxx
PORT STATE SERVICE
27017/tcp filtered mongod
How can I have access remotely to port 27017? What else to check?
EDIT : List of iptables -L -v
Chain INPUT (policy DROP 52 packets, 2544 bytes)
pkts bytes target prot opt in out source destination
2469 164K f2b-sshd tcp -- any any anywhere anywhere multiport dports ssh
2758 180K ACCEPT tcp -- any any localhost.localdomain localhost.localdomain tcp dpt:27017
4189 500K ufw-before-logging-input all -- any any anywhere anywhere
4189 500K ufw-before-input all -- any any anywhere anywhere
1136 119K ufw-after-input all -- any any anywhere anywhere
1130 119K ufw-after-logging-input all -- any any anywhere anywhere
1130 119K ufw-reject-input all -- any any anywhere anywhere
1130 119K ufw-track-input all -- any any anywhere anywhere
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:27017
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DOCKER-USER all -- any any anywhere anywhere
0 0 DOCKER-ISOLATION-STAGE-1 all -- any any anywhere anywhere
0 0 ACCEPT all -- any docker0 anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 DOCKER all -- any docker0 anywhere anywhere
0 0 ACCEPT all -- docker0 !docker0 anywhere anywhere
0 0 ACCEPT all -- docker0 docker0 anywhere anywhere
0 0 ufw-before-logging-forward all -- any any anywhere anywhere
0 0 ufw-before-forward all -- any any anywhere anywhere
0 0 ufw-after-forward all -- any any anywhere anywhere
0 0 ufw-after-logging-forward all -- any any anywhere anywhere
0 0 ufw-reject-forward all -- any any anywhere anywhere
0 0 ufw-track-forward all -- any any anywhere anywhere
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
7585 1341K ufw-before-logging-output all -- any any anywhere anywhere
7585 1341K ufw-before-output all -- any any anywhere anywhere
1112 164K ufw-after-output all -- any any anywhere anywhere
1112 164K ufw-after-logging-output all -- any any anywhere anywhere
1112 164K ufw-reject-output all -- any any anywhere anywhere
1112 164K ufw-track-output all -- any any anywhere anywhere
Chain DOCKER (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER-ISOLATION-STAGE-2 all -- docker0 !docker0 anywhere anywhere
0 0 RETURN all -- any any anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any docker0 anywhere anywhere
0 0 RETURN all -- any any anywhere anywhere
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
0 0 RETURN all -- any any anywhere anywhere
Chain f2b-sshd (1 references)
pkts bytes target prot opt in out source destination
2469 164K RETURN all -- any any anywhere anywhere
Chain ufw-after-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-input (1 references)
pkts bytes target prot opt in out source destination
6 468 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:netbios-ns
0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:netbios-dgm
0 0 ufw-skip-to-policy-input tcp -- any any anywhere anywhere tcp dpt:netbios-ssn
0 0 ufw-skip-to-policy-input tcp -- any any anywhere anywhere tcp dpt:microsoft-ds
0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:bootps
0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:bootpc
0 0 ufw-skip-to-policy-input all -- any any anywhere anywhere ADDRTYPE match dst-type BROADCAST
Chain ufw-after-logging-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
Chain ufw-after-logging-input (1 references)
pkts bytes target prot opt in out source destination
90 4292 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
Chain ufw-after-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 ACCEPT icmp -- any any anywhere anywhere icmp destination-unreachable
0 0 ACCEPT icmp -- any any anywhere anywhere icmp time-exceeded
0 0 ACCEPT icmp -- any any anywhere anywhere icmp parameter-problem
0 0 ACCEPT icmp -- any any anywhere anywhere icmp echo-request
0 0 ufw-user-forward all -- any any anywhere anywhere
Chain ufw-before-input (1 references)
pkts bytes target prot opt in out source destination
1206 254K ACCEPT all -- lo any anywhere anywhere
1807 124K ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
0 0 ufw-logging-deny all -- any any anywhere anywhere ctstate INVALID
0 0 DROP all -- any any anywhere anywhere ctstate INVALID
0 0 ACCEPT icmp -- any any anywhere anywhere icmp destination-unreachable
0 0 ACCEPT icmp -- any any anywhere anywhere icmp time-exceeded
0 0 ACCEPT icmp -- any any anywhere anywhere icmp parameter-problem
27 1684 ACCEPT icmp -- any any anywhere anywhere icmp echo-request
0 0 ACCEPT udp -- any any anywhere anywhere udp spt:bootps dpt:bootpc
342 17584 ufw-not-local all -- any any anywhere anywhere
0 0 ACCEPT udp -- any any anywhere 224.0.0.251 udp dpt:mdns
0 0 ACCEPT udp -- any any anywhere 239.255.255.250 udp dpt:1900
342 17584 ufw-user-input all -- any any anywhere anywhere
Chain ufw-before-logging-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-output (1 references)
pkts bytes target prot opt in out source destination
3556 407K ACCEPT all -- any lo anywhere anywhere
2917 769K ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED
39 2762 ufw-user-output all -- any any anywhere anywhere
Chain ufw-logging-allow (0 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "
Chain ufw-logging-deny (2 references)
pkts bytes target prot opt in out source destination
0 0 RETURN all -- any any anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "
Chain ufw-not-local (1 references)
pkts bytes target prot opt in out source destination
312 16348 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type LOCAL
24 768 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type MULTICAST
6 468 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type BROADCAST
0 0 ufw-logging-deny all -- any any anywhere anywhere limit: avg 3/min burst 10
0 0 DROP all -- any any anywhere anywhere
Chain ufw-reject-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-skip-to-policy-forward (0 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- any any anywhere anywhere
Chain ufw-skip-to-policy-input (7 references)
pkts bytes target prot opt in out source destination
6 468 DROP all -- any any anywhere anywhere
Chain ufw-skip-to-policy-output (0 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere
Chain ufw-track-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-output (1 references)
pkts bytes target prot opt in out source destination
1 60 ACCEPT tcp -- any any anywhere anywhere ctstate NEW
38 2702 ACCEPT udp -- any any anywhere anywhere ctstate NEW
Chain ufw-user-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-input (1 references)
pkts bytes target prot opt in out source destination
3 180 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:80
10 516 ACCEPT tcp -- any any anywhere anywhere tcp dpt:https
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:443
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:27017
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:27017
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:27017
Chain ufw-user-limit (0 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
0 0 REJECT all -- any any anywhere anywhere reject-with icmp-port-unreachable
Chain ufw-user-limit-accept (0 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any anywhere anywhere
Chain ufw-user-logging-forward (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-logging-input (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-logging-output (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-output (1 references)
pkts bytes target prot opt in out source destination
firewall status
ufw status
Status: active
To Action From
-- ------ ----
80 ALLOW Anywhere
443 ALLOW Anywhere
27017 ALLOW Anywhere
27017/tcp ALLOW Anywhere
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
27017 (v6) ALLOW Anywhere (v6)
27017/tcp (v6) ALLOW Anywhere (v6)
Maverick
(107 rep)
Mar 20, 2021, 02:13 PM
• Last activity: Mar 20, 2021, 02:32 PM
Showing page 1 of 20 total questions