Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save schmalliso/59e7d61205183df2b89ab402d3298ae9 to your computer and use it in GitHub Desktop.
Save schmalliso/59e7d61205183df2b89ab402d3298ae9 to your computer and use it in GitHub Desktop.
An example of a troubleshooting

MongoDB Public GPG key not added to Ubuntu

Symptoms

  • sudo apt-get update returns errors when installing MongoDB v4.0 using the .deb package:

    W: GPG error: https://repo.mongodb.org/apt/ubuntu <release>/mongodb-org/4.0 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.0 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.

Diagnose

  • Validate whether the MongoDB Public GPG key exists on your system by running the following command in your terminal:

    sudo apt-key list

    Look for the following key in the output:

    --------------------
    pub   rsa4096 2018-04-18 [SC] [expires: 2023-04-17]
          9DA3 1620 334B D75D 9DCB  49F3 6881 8C72 E525 29D4
    uid           [ unknown] MongoDB 4.0 Release Signing Key <packaging@mongodb.com>

    Ensure that the listed MongoDB Release Signing Key is appropriate for the release that you are installing (i.e. 4.0). If the key is not present or a key for a previous MongoDB release is listed instead, proceed to import the 4.0 key.

Solution

  1. Import the MongoDB Public GPG key used by the Ubuntu package management system.

    The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv {+pgp-fingerprint+}
  2. Verify that the public key is present in your system:

    sudo apt-key list

    The key should be present in the list as:

    pub   rsa4096 2018-04-18 [SC] [expires: 2023-04-17]
          9DA3 1620 334B D75D 9DCB  49F3 6881 8C72 E525 29D4
    uid           [ unknown] MongoDB 4.0 Release Signing Key <packaging@mongodb.com>

Monitoring

N/A

META FIELDS: - Category: installation, ubuntu, gpg, apt, packaging - Updated: 2019-03-20 - Product: server - Product version: v4.0 - Expiration: 1 year - Severity: ๐Ÿ™€๐Ÿ™€๐Ÿ™€๐Ÿ™€๐Ÿ™€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment