Navigation
This is an upcoming (i.e. in progress) version of the manual.

Troubleshooting

Errors when running sudo apt-key adv

You may encounter one or more errors that resemble the following when adding the MongoDB public GPG key during the Import the public key used by the package management system step of the Install MongoDB Community Edition using .deb Packages procedure:

E162F504A20CDF15827F718D4B7C549A058F8B6B not a key ID: skipping

key 0x4B7C549A058F8B6B not found on keyserver

apt-key adv sometimes reports that the MongoDB public GPG key cannot be found on the Ubuntu keyserver, or that the key is otherwise invalid. This may be due to transient network issues, firewall rules, or a temporary issue on the keyserver.

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

After retrying the step, you can check 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]
      E162 F504 A20C DF15 827F  718D 4B7C 549A 058F 8B6B
uid           [ unknown] MongoDB 4.2 Release Signing Key <packaging@mongodb.com>

You can check that the MongoDB 4.2 public GPG key exists on the Ubuntu keyserver by entering the short fingerprint 0x4B7C549A058F8B6B into the search box on https://keyserver.ubuntu.com/.

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 using .deb Packages procedure:

W: GPG error: https://repo.mongodb.org/apt/ubuntu <release>/mongodb-org/4.2 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.2 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 using .deb Packages procedure.

Repeating the Import the public key used by the package management system step of the Install MongoDB Community Edition using .deb Packages 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]
      E162 F504 A20C DF15 827F  718D 4B7C 549A 058F 8B6B
uid           [ unknown] MongoDB 4.2 Release Signing Key <packaging@mongodb.com>

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 using .deb Packages 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.2.list may be configured incorrectly or is missing.

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

cat /etc/apt/sources.list.d/mongodb-org-4.2.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.2.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.2.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 using .deb Packages 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.