Navigation

Troubleshooting

MongoDB Atlas

MongoDB Atlas is a hosted MongoDB service option in the cloud which requires no installation overhead and offers a free tier to get started.

Errors when retrieving the public key

During Import the public key used by the package management system step of the Install MongoDB Community Edition procedure, you may encounter a "gpg: no valid OpenPGP data found." error.

Ensure you are copying the command exactly as documented. The operation should respond with OK.

To check that the MongoDB public GPG key exists on your system, run the following command in the terminal:

sudo apt-key list

The output should include an entry that resembles the following:

/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2018-04-18 [SC] [expires: 2023-04-17]
      2069 1EEC 3521 6C63 CAF6  6CE1 6564 08E3 90CF B1F5
uid           [ unknown] MongoDB 4.4 Release Signing Key <[email protected]>

Errors when running sudo apt update

You may encounter one or more errors that resemble the following when running sudo apt-get update as part of the Install MongoDB Community Edition procedure:

W: GPG error: https://repo.mongodb.org/apt/ubuntu <release>/mongodb-org/4.4 Release: \
   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4B7C549A058F8B6B
E: The repository 'https://repo.mongodb.org/apt/ubuntu <release>/mongodb-org/4.4 Release' \
   is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

These errors indicate that the MongoDB Public GPG key was not added in step Import the public key used by the package management system of the Install MongoDB Community Edition procedure.

Repeating the Import the public key used by the package management system step of the Install MongoDB Community Edition procedure typically resolves this issue. Ensure you are copying the command and key exactly as documented.

You can validate that the MongoDB public GPG key exists on your system by running the following command in the terminal:

sudo apt-key list

The output should include an entry that resembles the following:

--------------------
pub   rsa4096 2018-04-18 [SC] [expires: 2023-04-17]
      2069 1EEC 3521 6C63 CAF6  6CE1 6564 08E3 90CF B1F5
uid           [ unknown] MongoDB 4.4 Release Signing Key <[email protected]>

Errors when running sudo apt install -y mongodb-org

You may encounter an error that resembles the following when running sudo apt install -y mongodb-org in step Create a list file for MongoDB of the Install MongoDB Community Edition procedure:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mongodb-org

This error indicates that the /etc/apt/sources.list.d/mongodb-org-4.4.list may be configured incorrectly or is missing.

To review the contents of the mongodb-org-4.4.list file, run the following command in the terminal or shell:

cat /etc/apt/sources.list.d/mongodb-org-4.4.list

If the file contents do not exactly match the documentation for your Ubuntu version in the step linked above, remove the file and repeat the Create a list file for MongoDB step. If the file does not exist, create it as part of that step.

Once you have validated that the mongodb-org-4.4.list file exists and has the correct contents, run sudo apt update to update the apt repositories and retry sudo apt install -y mongodb-org.

Unable to install package due to dpkg-deb: error

You may encounter an error that resembles the following when installing the mongodb-org package:

dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.4.0_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1

This error indicates that the system already had the Ubuntu mongodb package installed prior to installing the official MongoDB Inc. mongodb-org packages. To confirm wheter the host has the Ubuntu mongodb package installed, run the following command in a terminal or shell:

sudo apt list --installed | grep mongo

If your output resembles the following, you must uninstall the Ubuntu mongodb package before retrying the Install MongoDB Community Edition procedure:

mongodb/bionic,now 1:3.6.3-0ubuntu1 amd64 [installed]
mongodb-clients/bionic,now 1:3.6.3-0ubuntu1 amd64 [installed,automatic]
mongodb-server/bionic,bionic,now 1:3.6.3-0ubuntu1 all [installed,automatic]
mongodb-server-core/bionic,now 1:3.6.3-0ubuntu1 amd64 [installed,automatic]

Run the following commands in a terminal or shell to fully remove the Ubuntu mongodb package before retrying the installation procedure:

sudo apt remove mongodb
sudo apt purge mongodb
sudo apt autoremove

Note

sudo apt purge mongodb removes any default configuration files installed by the Ubuntu mongodb package. If you have modified these configuration files and want to keep those modifications, copy the files to another directory such as /home/your-user-name.

If your output includes a mix of mongodb-org and mongodb binaries, you may need to first apt remove, apt purge, and apt autoremove the mongodb-org package before attempting to remove and purge the Ubuntu mongodb package. After clearing all MongoDB-related packages, retry the installation procedure.